/** 用户登录 */ public void login(WebRequest request, WebResponse response) { User user = request.parameterToEntity(User.class); User sessionUser = userService.checkLogin(user); if (CoreUtil.notNull(sessionUser)) { WebUtil.sessionAttr(request, SystemConstant.SESSION_CURRENT_USER, sessionUser); response.write(SystemConstant.MESSAGE_SUCCESS); } else { response.write(SystemConstant.MESSAGE_FAILURE); } }
/** 用户注册 */ public void register(WebRequest request, WebResponse response) { User user = request.parameterToEntity(User.class); user.setRegistDt(new Date()); user.setStatus(SystemConstant.STATUS_AVAILABLE); userService.save(user); }
/** 检查帐户是否可用 */ public void accountAvailable(WebRequest request, WebResponse response) { User user = new User(); user.setUsername(request.getParameter("username")); response.write(String.valueOf(userService.accountAvailable(user))); }