From 7e54491e687bc037060a36f2af7c16bb70a2600d Mon Sep 17 00:00:00 2001 From: qiurunze Date: Fri, 25 Jan 2019 19:34:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=B3=A8=E5=86=8C=E7=99=BB?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- miaosha-admin/miaosha-admin-api/pom.xml | 13 +++++- .../com/geekq/admin/entity/Logininfo.java | 3 +- .../admin/service/ILogininfoService.java | 5 +- miaosha-admin/miaosha-admin-service/pom.xml | 7 ++- .../geekq/admin/mapper/LogininfoMapper.java | 5 +- .../geekq/admin/mapper/LogininfoMapper.xml | 36 ++++++++++----- .../service/impl/LogininfoServiceImpl.java | 46 ++++++++++++------- .../com/geekq/admin/utils/UserContext.java | 37 +++++++++++++++ .../src/main/resources/resource/db.properties | 2 +- .../applicationContext-dubbo-provider.xml | 10 ++-- miaosha-admin/miaosha-admin-web/pom.xml | 7 +-- .../geekq/web/controller/LoginController.java | 18 +++++++- .../geekq/web/controller/PayController.java | 5 +- .../web/controller/RegisterController.java | 17 ++++--- .../web/interceptor/LoginInterceptor.java | 37 +++++++-------- .../java/com/geekq/web/utils/UserContext.java | 37 +++++++++++++++ .../applicationContext-dubbo-consumer.xml | 4 +- .../src/main/webapp/login.html | 4 +- .../src/main/webapp/register.html | 6 +-- .../com/geekq/common/enums/ResultStatus.java | 2 + .../utils/resultbean/AbstractResult.java | 1 + .../common/utils/resultbean/ResultGeekQ.java | 6 ++- .../common/utils/resultbean/ResultJSON.java | 30 ++++++++++++ miaosha-admin/pom.xml | 14 +++++- 24 files changed, 267 insertions(+), 85 deletions(-) create mode 100644 miaosha-admin/miaosha-admin-service/src/main/java/com/geekq/admin/utils/UserContext.java create mode 100644 miaosha-admin/miaosha-admin-web/src/main/java/com/geekq/web/utils/UserContext.java create mode 100644 miaosha-admin/miaosha-common/src/main/java/com/geekq/common/utils/resultbean/ResultJSON.java diff --git a/miaosha-admin/miaosha-admin-api/pom.xml b/miaosha-admin/miaosha-admin-api/pom.xml index d8d1227..80f6096 100644 --- a/miaosha-admin/miaosha-admin-api/pom.xml +++ b/miaosha-admin/miaosha-admin-api/pom.xml @@ -16,7 +16,18 @@ 1.18.2 provided - + + + + + + + + + + + + com.geekq miaosha-common diff --git a/miaosha-admin/miaosha-admin-api/src/main/java/com/geekq/admin/entity/Logininfo.java b/miaosha-admin/miaosha-admin-api/src/main/java/com/geekq/admin/entity/Logininfo.java index 0740f1a..f90dde1 100644 --- a/miaosha-admin/miaosha-admin-api/src/main/java/com/geekq/admin/entity/Logininfo.java +++ b/miaosha-admin/miaosha-admin-api/src/main/java/com/geekq/admin/entity/Logininfo.java @@ -6,13 +6,14 @@ import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; +import java.io.Serializable; import java.util.Date; @Setter @Getter @AllArgsConstructor @NoArgsConstructor -public class Logininfo { +public class Logininfo implements Serializable { private Long id; private String nickname; diff --git a/miaosha-admin/miaosha-admin-api/src/main/java/com/geekq/admin/service/ILogininfoService.java b/miaosha-admin/miaosha-admin-api/src/main/java/com/geekq/admin/service/ILogininfoService.java index c306ed4..55a1f7e 100644 --- a/miaosha-admin/miaosha-admin-api/src/main/java/com/geekq/admin/service/ILogininfoService.java +++ b/miaosha-admin/miaosha-admin-api/src/main/java/com/geekq/admin/service/ILogininfoService.java @@ -2,7 +2,6 @@ package com.geekq.admin.service; import com.geekq.admin.entity.Logininfo; import com.geekq.common.utils.resultbean.ResultGeekQ; -import org.springframework.stereotype.Service; import java.util.List; import java.util.Map; @@ -13,7 +12,7 @@ public interface ILogininfoService { * @param username * @param password */ - ResultGeekQ register(String username, String password); + void register(String username, String password); /** * 检查是否有重复的用户名 @@ -26,7 +25,7 @@ public interface ILogininfoService { * @param password * @return */ - Logininfo login(String name, String password, int userType, String ip); + ResultGeekQ login(String name, String password, int userType, String ip); /** * 是否有管理员 diff --git a/miaosha-admin/miaosha-admin-service/pom.xml b/miaosha-admin/miaosha-admin-service/pom.xml index 6246a7f..e159321 100644 --- a/miaosha-admin/miaosha-admin-service/pom.xml +++ b/miaosha-admin/miaosha-admin-service/pom.xml @@ -17,10 +17,10 @@ 0.0.1-SNAPSHOT - com.alibaba dubbo + 2.6.0 org.springframework @@ -86,6 +86,11 @@ com.alibaba druid + + javax.servlet + servlet-api + 2.5 + diff --git a/miaosha-admin/miaosha-admin-service/src/main/java/com/geekq/admin/mapper/LogininfoMapper.java b/miaosha-admin/miaosha-admin-service/src/main/java/com/geekq/admin/mapper/LogininfoMapper.java index c719994..04d07ea 100644 --- a/miaosha-admin/miaosha-admin-service/src/main/java/com/geekq/admin/mapper/LogininfoMapper.java +++ b/miaosha-admin/miaosha-admin-service/src/main/java/com/geekq/admin/mapper/LogininfoMapper.java @@ -18,9 +18,12 @@ public interface LogininfoMapper { int updateByPrimaryKey(Logininfo record); - int getCountByUsername(@Param("username") String username, + int getCountByNickname(@Param("nickname") String nickname, @Param("userType") int userType); + Logininfo getLoginInfoByNickname(@Param("nickname") String nickname, + @Param("userType") int userType); + Logininfo login(@Param("name") String name, @Param("password") String password, @Param("userType") int userType); diff --git a/miaosha-admin/miaosha-admin-service/src/main/java/com/geekq/admin/mapper/LogininfoMapper.xml b/miaosha-admin/miaosha-admin-service/src/main/java/com/geekq/admin/mapper/LogininfoMapper.xml index 6d51673..ab54c44 100644 --- a/miaosha-admin/miaosha-admin-service/src/main/java/com/geekq/admin/mapper/LogininfoMapper.xml +++ b/miaosha-admin/miaosha-admin-service/src/main/java/com/geekq/admin/mapper/LogininfoMapper.xml @@ -10,6 +10,11 @@ + + + + + @@ -19,18 +24,20 @@ - insert into logininfo (username,password, state,usertype,admin) - values (#{username,jdbcType=VARCHAR},#{password,jdbcType=VARCHAR},#{state,jdbcType=TINYINT},#{userType},#{admin}) + insert into logininfo (nickname,password, state,usertype,admin,salt,registerdate,lastlogindate) + values (#{nickname,jdbcType=VARCHAR},#{password,jdbcType=VARCHAR},#{state,jdbcType=TINYINT},#{userType},#{admin} + ,#{salt},#{registerDate},#{lastLoginDate}) - update logininfo set username = #{username,jdbcType=VARCHAR},password =#{password,jdbcType=VARCHAR}, - state = #{state,jdbcType=TINYINT},usertype = #{userType},admin=#{admin} + update logininfo set nickname = #{nickname,jdbcType=VARCHAR},password =#{password,jdbcType=VARCHAR}, + state = #{state,jdbcType=TINYINT},usertype = #{userType},admin=#{admin},salt = #{salt}, + registerdate = #{registerDate},lastlogindate = #{lastLoginDate} where id = #{id,jdbcType=BIGINT} - id, username, password, state,usertype,admin + id, nickname, password, state,usertype,admin ,salt , registerdate , lastlogindate - + select count(id) from logininfo where nickname=#{nickname} and usertype = #{userType} - + + + + + \ No newline at end of file diff --git a/miaosha-admin/miaosha-admin-service/src/main/java/com/geekq/admin/service/impl/LogininfoServiceImpl.java b/miaosha-admin/miaosha-admin-service/src/main/java/com/geekq/admin/service/impl/LogininfoServiceImpl.java index 1c7371a..6fe9b88 100644 --- a/miaosha-admin/miaosha-admin-service/src/main/java/com/geekq/admin/service/impl/LogininfoServiceImpl.java +++ b/miaosha-admin/miaosha-admin-service/src/main/java/com/geekq/admin/service/impl/LogininfoServiceImpl.java @@ -1,14 +1,15 @@ package com.geekq.admin.service.impl; +import com.geekq.admin.entity.IpLog; import com.geekq.admin.entity.Logininfo; import com.geekq.admin.entity.Userinfo; import com.geekq.admin.mapper.IpLogMapper; import com.geekq.admin.mapper.LogininfoMapper; import com.geekq.admin.mapper.UserinfoMapper; import com.geekq.admin.service.ILogininfoService; +import com.geekq.admin.utils.UserContext; import com.geekq.common.enums.Constants; import com.geekq.common.enums.ResultStatus; -import com.geekq.common.utils.Constanst; import com.geekq.common.utils.MD5.MD5Utils; import com.geekq.common.utils.resultbean.ResultGeekQ; import org.slf4j.Logger; @@ -37,12 +38,10 @@ public class LogininfoServiceImpl implements ILogininfoService { private UserinfoMapper userinfoMapper; @Override - public ResultGeekQ register(String username, String password) { + public void register(String username, String password) { - ResultGeekQ resultGeekQ = ResultGeekQ.build(); - int count = loginInfoMapper.getCountByUsername(username, Constants.USERTYPE_NORMAL); - if(count > 0) { - try { + int count = loginInfoMapper.getCountByNickname(username, Constants.USERTYPE_NORMAL); + if(count <= 0) { Logininfo logininfo =new Logininfo(); logininfo.setNickname(username); //获取随机salt @@ -52,29 +51,44 @@ public class LogininfoServiceImpl implements ILogininfoService { logininfo.setState(Constants.STATE_NORMAL); logininfo.setUserType(Constants.USERTYPE_NORMAL); logininfo.setRegisterDate(new Date()); + logininfo.setLastLoginDate(new Date()); logininfo.setSalt(salt); this.loginInfoMapper.insert(logininfo); //初始化一个Userinfo Userinfo userinfo = Userinfo.empty(logininfo.getId()); - this.userinfoMapper.insert(userinfo); - } catch (Exception e) { - logger.error("注册失败!",e); - resultGeekQ.withError(ResultStatus.RESIGETER_FAIL); - } + int result = this.userinfoMapper.insert(userinfo); }else{ - resultGeekQ.withError(ResultStatus.RESIGETER_NICKNAMEEXIST); + throw new RuntimeException("用户名已经存在!"); } - return resultGeekQ; } @Override public boolean checkUsername(String name, int userType) { - return this.loginInfoMapper.getCountByUsername(name, userType)<=0; + return this.loginInfoMapper.getCountByNickname(name, userType)<=0; } @Override - public Logininfo login(String name, String password, int userType, String ip) { - return null; + public ResultGeekQ login(String name, String password, int userType, String ip) { + ResultGeekQ resultGeekQ = ResultGeekQ.build(); + + try { + IpLog log = new IpLog(name,new Date(),ip,userType,null); + Logininfo logininfo = loginInfoMapper.getLoginInfoByNickname(name,Constants.USERTYPE_NORMAL); + String salt = logininfo.getSalt(); + Logininfo current = this.loginInfoMapper.login(name, + MD5Utils.formPassToDBPass(password,salt), userType); + if(current != null){ + UserContext.putLogininfo(current); + log.setLoginInfoId(current.getId()); + log.setLoginState(IpLog.LOGINSTATE_SUCCESS); + } + ipLogMapper.insert(log); + resultGeekQ.setData(logininfo); + } catch (Exception e) { + logger.error("登录发生错误!",e); + resultGeekQ.withError(ResultStatus.LOGIN_FIAL); + } + return resultGeekQ; } @Override diff --git a/miaosha-admin/miaosha-admin-service/src/main/java/com/geekq/admin/utils/UserContext.java b/miaosha-admin/miaosha-admin-service/src/main/java/com/geekq/admin/utils/UserContext.java new file mode 100644 index 0000000..b616889 --- /dev/null +++ b/miaosha-admin/miaosha-admin-service/src/main/java/com/geekq/admin/utils/UserContext.java @@ -0,0 +1,37 @@ +package com.geekq.admin.utils; + + +import com.geekq.admin.entity.Logininfo; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; + +public class UserContext { + + public static final String LOGIN_IN_SESSION = "logininfo"; + public static final String VERIFYCODE_IN_SESSION = "VERIFYCODE_IN_SESSION"; + + private static HttpServletRequest getRequest() { + return ((ServletRequestAttributes) RequestContextHolder + .getRequestAttributes()).getRequest(); + } + + public static void putLogininfo(Logininfo logininfo) { + getRequest().getSession().setAttribute(LOGIN_IN_SESSION, logininfo); + } + + public static Logininfo getCurrent() { + return (Logininfo) getRequest().getSession().getAttribute( + LOGIN_IN_SESSION); + } + +// public static void putVerifyCode(VerifyCode code) { +// getRequest().getSession().setAttribute(VERIFYCODE_IN_SESSION, code); +// } +// +// public static VerifyCode getVerifyCode() { +// return (VerifyCode) getRequest().getSession().getAttribute( +// VERIFYCODE_IN_SESSION); +// } +} diff --git a/miaosha-admin/miaosha-admin-service/src/main/resources/resource/db.properties b/miaosha-admin/miaosha-admin-service/src/main/resources/resource/db.properties index 2a9df93..d3b9969 100644 --- a/miaosha-admin/miaosha-admin-service/src/main/resources/resource/db.properties +++ b/miaosha-admin/miaosha-admin-service/src/main/resources/resource/db.properties @@ -1,4 +1,4 @@ jdbc.driver=com.mysql.jdbc.Driver -jdbc.url=jdbc:mysql://localhost:3306/miaosha?characterEncoding=utf-8 +jdbc.url=jdbc:mysql://localhost:3306/miaosha2?characterEncoding=utf-8 jdbc.username=root jdbc.password=nihaoma diff --git a/miaosha-admin/miaosha-admin-service/src/main/resources/spring/applicationContext-dubbo-provider.xml b/miaosha-admin/miaosha-admin-service/src/main/resources/spring/applicationContext-dubbo-provider.xml index 1ff5cc8..2f78015 100644 --- a/miaosha-admin/miaosha-admin-service/src/main/resources/spring/applicationContext-dubbo-provider.xml +++ b/miaosha-admin/miaosha-admin-service/src/main/resources/spring/applicationContext-dubbo-provider.xml @@ -6,19 +6,19 @@ http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd"> - + - + - + + ref="ordersService" timeout="60000"> + ref="logininfoServiceImpl" timeout="60000"> diff --git a/miaosha-admin/miaosha-admin-web/pom.xml b/miaosha-admin/miaosha-admin-web/pom.xml index 4386008..3d7a951 100644 --- a/miaosha-admin/miaosha-admin-web/pom.xml +++ b/miaosha-admin/miaosha-admin-web/pom.xml @@ -31,12 +31,7 @@ com.alibaba dubbo - - - org.springframework - spring - - + 2.6.0 org.apache.zookeeper diff --git a/miaosha-admin/miaosha-admin-web/src/main/java/com/geekq/web/controller/LoginController.java b/miaosha-admin/miaosha-admin-web/src/main/java/com/geekq/web/controller/LoginController.java index f1476c5..8dbd67b 100644 --- a/miaosha-admin/miaosha-admin-web/src/main/java/com/geekq/web/controller/LoginController.java +++ b/miaosha-admin/miaosha-admin-web/src/main/java/com/geekq/web/controller/LoginController.java @@ -1,13 +1,18 @@ package com.geekq.web.controller; +import com.geekq.admin.entity.Logininfo; +import com.geekq.admin.service.ILogininfoService; +import com.geekq.common.enums.Constants; import com.geekq.common.utils.resultbean.ResultGeekQ; import com.geekq.common.vo.LoginVo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; +import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; @@ -20,11 +25,20 @@ public class LoginController extends BaseController { private static Logger logger = LoggerFactory.getLogger(LoginController.class); + @Autowired + private ILogininfoService iLogininfoService; + @RequestMapping("/login" ) @ResponseBody - public ResultGeekQ dologin(HttpServletResponse response, LoginVo loginVo) { + public ResultGeekQ dologin(HttpServletResponse response, + HttpServletRequest request, + String username, String password) { ResultGeekQ result = ResultGeekQ.build(); - logger.info(loginVo.toString()); + ResultGeekQ login = this.iLogininfoService.login(username, password, + Constants.USERTYPE_NORMAL,request.getRemoteAddr()); + if(ResultGeekQ.isSuccess(login)){ + result.withError(login.getCode(),login.getMessage()); + } return result; } } diff --git a/miaosha-admin/miaosha-admin-web/src/main/java/com/geekq/web/controller/PayController.java b/miaosha-admin/miaosha-admin-web/src/main/java/com/geekq/web/controller/PayController.java index f16869f..5590555 100644 --- a/miaosha-admin/miaosha-admin-web/src/main/java/com/geekq/web/controller/PayController.java +++ b/miaosha-admin/miaosha-admin-web/src/main/java/com/geekq/web/controller/PayController.java @@ -1,7 +1,9 @@ package com.geekq.web.controller; +import com.geekq.web.interceptor.RequiredLogin; import com.geekq.web.service.CulsterService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Required; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @@ -13,7 +15,8 @@ public class PayController { @Autowired private CulsterService buyService; - + + @RequiredLogin @RequestMapping("/index") public String index() { return "login"; diff --git a/miaosha-admin/miaosha-admin-web/src/main/java/com/geekq/web/controller/RegisterController.java b/miaosha-admin/miaosha-admin-web/src/main/java/com/geekq/web/controller/RegisterController.java index 9b13930..b1a7be3 100644 --- a/miaosha-admin/miaosha-admin-web/src/main/java/com/geekq/web/controller/RegisterController.java +++ b/miaosha-admin/miaosha-admin-web/src/main/java/com/geekq/web/controller/RegisterController.java @@ -4,6 +4,7 @@ import com.geekq.admin.service.ILogininfoService; import com.geekq.common.enums.Constants; import com.geekq.common.enums.ResultStatus; import com.geekq.common.utils.resultbean.ResultGeekQ; +import com.geekq.common.utils.resultbean.ResultJSON; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -24,12 +25,16 @@ public class RegisterController extends BaseController{ @RequestMapping("/register") @ResponseBody - public ResultGeekQ register(String username, String password) { - /** - * 登录注册 - */ - return logininfoService.register(username,password); - + public ResultJSON register(String username, String password) { + ResultJSON json = new ResultJSON(); + try { + this.logininfoService.register(username, password); + json.setSuccess(true); + } catch (RuntimeException e) { + logger.error("注册失败",e); + json.setMsg("注册失败,请联系相关人员!"); + } + return json; } @RequestMapping("/checkUsername") diff --git a/miaosha-admin/miaosha-admin-web/src/main/java/com/geekq/web/interceptor/LoginInterceptor.java b/miaosha-admin/miaosha-admin-web/src/main/java/com/geekq/web/interceptor/LoginInterceptor.java index c14e821..e540dd9 100644 --- a/miaosha-admin/miaosha-admin-web/src/main/java/com/geekq/web/interceptor/LoginInterceptor.java +++ b/miaosha-admin/miaosha-admin-web/src/main/java/com/geekq/web/interceptor/LoginInterceptor.java @@ -1,32 +1,29 @@ package com.geekq.web.interceptor; +import com.geekq.web.utils.UserContext; import org.springframework.web.method.HandlerMethod; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -/** - * @author 邱润泽 - * 拦截器 拦截至主页面 - */ public class LoginInterceptor extends HandlerInterceptorAdapter { -// @Override -// public boolean preHandle(HttpServletRequest request, -// HttpServletResponse response, Object handler) throws Exception { -// if (handler instanceof HandlerMethod) { -// HandlerMethod hm = (HandlerMethod) handler; -// RequiredLogin rl = hm.getMethodAnnotation(RequiredLogin.class); -// if (rl != null) { -//// if (request.getSession().getAttribute( -//// UserContext.LOGIN_IN_SESSION) == null) { -// response.sendRedirect("/login.html"); -// return false; -// } -//// } -// } -// return super.preHandle(request, response, handler); -// } + @Override + public boolean preHandle(HttpServletRequest request, + HttpServletResponse response, Object handler) throws Exception { + if (handler instanceof HandlerMethod) { + HandlerMethod hm = (HandlerMethod) handler; + RequiredLogin rl = hm.getMethodAnnotation(RequiredLogin.class); + if (rl != null) { + if (request.getSession().getAttribute( + UserContext.LOGIN_IN_SESSION) == null) { + response.sendRedirect("/login.html"); + return false; + } + } + } + return super.preHandle(request, response, handler); + } } diff --git a/miaosha-admin/miaosha-admin-web/src/main/java/com/geekq/web/utils/UserContext.java b/miaosha-admin/miaosha-admin-web/src/main/java/com/geekq/web/utils/UserContext.java new file mode 100644 index 0000000..3e3f167 --- /dev/null +++ b/miaosha-admin/miaosha-admin-web/src/main/java/com/geekq/web/utils/UserContext.java @@ -0,0 +1,37 @@ +package com.geekq.web.utils; + + +import com.geekq.admin.entity.Logininfo; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; + +public class UserContext { + + public static final String LOGIN_IN_SESSION = "logininfo"; + public static final String VERIFYCODE_IN_SESSION = "VERIFYCODE_IN_SESSION"; + + private static HttpServletRequest getRequest() { + return ((ServletRequestAttributes) RequestContextHolder + .getRequestAttributes()).getRequest(); + } + + public static void putLogininfo(Logininfo logininfo) { + getRequest().getSession().setAttribute(LOGIN_IN_SESSION, logininfo); + } + + public static Logininfo getCurrent() { + return (Logininfo) getRequest().getSession().getAttribute( + LOGIN_IN_SESSION); + } + +// public static void putVerifyCode(VerifyCode code) { +// getRequest().getSession().setAttribute(VERIFYCODE_IN_SESSION, code); +// } +// +// public static VerifyCode getVerifyCode() { +// return (VerifyCode) getRequest().getSession().getAttribute( +// VERIFYCODE_IN_SESSION); +// } +} diff --git a/miaosha-admin/miaosha-admin-web/src/main/resources/spring/applicationContext-dubbo-consumer.xml b/miaosha-admin/miaosha-admin-web/src/main/resources/spring/applicationContext-dubbo-consumer.xml index 5592d0b..26f9ff3 100644 --- a/miaosha-admin/miaosha-admin-web/src/main/resources/spring/applicationContext-dubbo-consumer.xml +++ b/miaosha-admin/miaosha-admin-web/src/main/resources/spring/applicationContext-dubbo-consumer.xml @@ -6,10 +6,10 @@ http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd"> - + - + diff --git a/miaosha-admin/miaosha-admin-web/src/main/webapp/login.html b/miaosha-admin/miaosha-admin-web/src/main/webapp/login.html index a01d5e0..3f4b9d1 100644 --- a/miaosha-admin/miaosha-admin-web/src/main/webapp/login.html +++ b/miaosha-admin/miaosha-admin-web/src/main/webapp/login.html @@ -42,7 +42,7 @@ //验证成功后,提交操作; submitHandler:function(form){ $(form).ajaxSubmit(function(data){ - if(data.success){ + if(data.status='success'){ $.messager.confirm("提示","登陆成功,点击确定跳转到个人中心",function(){ window.location.href="/personal.do"; }); @@ -91,7 +91,7 @@
- +
diff --git a/miaosha-admin/miaosha-admin-web/src/main/webapp/register.html b/miaosha-admin/miaosha-admin-web/src/main/webapp/register.html index 1dc2ef2..fc41ee8 100644 --- a/miaosha-admin/miaosha-admin-web/src/main/webapp/register.html +++ b/miaosha-admin/miaosha-admin-web/src/main/webapp/register.html @@ -49,7 +49,7 @@ data:{username:value}, async:false, success:function(data){ - ret= data.success; + ret= data.data; } }); return ret; @@ -85,7 +85,7 @@ }, submitHandler:function(form){ $(form).ajaxSubmit(function(data){ - if(data.success){ + if(data.data){ $.messager.confirm("提示","注册成功,请重新登录系统!",function(){ window.location.href="/login.html"; }); @@ -121,7 +121,7 @@