public String androidReset() { AppUser user = appUserService.get(userid); Map<String, Object> map = new HashMap<String, Object>(); if (user != null && !"".equals(user)) { user.setPassWord(password); appUserService.update(user); map.put("state", 1); // 1 成功 0 失败 } else { map.put("state", 0); // 1 成功 0 失败 } this._writeData(map); return null; }
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; }