public String androidRegist() {
    AppUser user = new AppUser();
    user.setUserName(username);
    user.setIsValid("1");
    user.setPassWord(password);
    user.setPhone(phone);
    user.setRegistTime(new Date());
    user.setRole("ROLE_USER");
    user.setEmail(email);
    user.setGrade(gradeService.get(1L)); // 默认等级为1
    appUserService.save(user);

    Map<String, Object> map = new HashMap<String, Object>();
    map.put("username", user.getUserName());
    map.put("userid", user.getUserId());
    map.put("grade", user.getGrade().getGradeCode());
    map.put("email", user.getEmail());
    map.put("phone", user.getPhone());
    map.put("state", 1); // 1 成功 0 失败
    this._writeData(map);
    return null;
  }
 public String androidLogin() {
   AppUser user = appUserService.login(username, password);
   Map<String, Object> map = new HashMap<String, Object>();
   if (user != null) {
     map.put("username", user.getUserName());
     map.put("userid", user.getUserId());
     map.put("email", user.getEmail());
     map.put("phone", user.getPhone());
     map.put("grade", user.getGrade().getGradeCode());
     map.put("state", 1); // 1 成功 0 失败
   } else {
     AppUser user2 = appUserService.findAppUserByUserName(username);
     if (user2 != null) {
       map.put("username", username);
     } else {
       map.put("username", "");
     }
     map.put("userid", "");
     map.put("state", 0); // 1 成功 0 失败
   }
   this._writeData(map);
   return null;
 }