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; }
/** * 重置时验证原密码 * * @return */ public String androidAjaxLogin() { HttpServletRequest request = getRequest(); HttpServletResponse response = getResponse(); AppUser user = appUserService.login(userid, password); Map<String, Object> map = new HashMap<String, Object>(); if (user != null) { map.put("state", 1); // 1 成功 0 失败 } else { map.put("state", 0); // 1 成功 0 失败 } AjaxResponseUtil.returnData(request, response, "", 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; }
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; }