修改了数据库表1

my
盛洁 5 years ago
parent 5171e31a7c
commit d44307bff1

@ -18,6 +18,7 @@ public class RegiteActivity extends AppCompatActivity {
EditText user_name;
EditText pass_word;
EditText repass_word;
EditText phone_edit;
RadioButton radio1;
RadioButton radio2;
String role;
@ -53,6 +54,7 @@ public class RegiteActivity extends AppCompatActivity {
user_name = findViewById(R.id.user_name);
pass_word = findViewById(R.id.pass_word);
repass_word = findViewById(R.id.repass_word);
phone_edit = findViewById(R.id.phone_edit);
role = "默认角色";
radio1 = findViewById(R.id.ratio1);
radio2 = findViewById(R.id.radio2);
@ -71,6 +73,7 @@ public class RegiteActivity extends AppCompatActivity {
String username = user_name.getText().toString();
String password = pass_word.getText().toString();
String repassword = repass_word.getText().toString();//从控件获取字符
String phone = phone_edit.getText().toString();
UserService uService = new UserService();
Message message = rHandler.obtainMessage();//使用handler来处理信息
if(username.trim().equals("")){//一系列条件来判断是否可注册
@ -85,15 +88,18 @@ public class RegiteActivity extends AppCompatActivity {
message.what = 2;
message.obj = "密码验证错误";
rHandler.sendMessage(message);
}else if(uService.login(username,password)!=0){
}else if(uService.login(username,password)==2){
message.what = 3;
message.obj = "用户已存在";
rHandler.sendMessage(message);//发送信息给handler
}else{
}/*else if(){
}*/else{
User user = new User();
user.setName(username);
user.setPasd(password);
user.setUsername(username);
user.setPassword(password);
user.setRole(role);
user.setPhone(phone);
uService.register(user);//注册
Intent intent = new Intent(RegiteActivity.this,SignInActivity.class);
startActivity(intent);

Loading…
Cancel
Save