Commit d507c2be9dba175e26c7fd69efacec90440ff9ef
1 parent
5f944c8a
登录注册接口开发
Showing
14 changed files
with
90 additions
and
55 deletions
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/common/Constant.java
@@ -170,8 +170,8 @@ public class Constant { | @@ -170,8 +170,8 @@ public class Constant { | ||
170 | /** | 170 | /** |
171 | * 代购订单使用 | 171 | * 代购订单使用 |
172 | */ | 172 | */ |
173 | - public static final Long OPERATOR_ROLE_BUYER = 10L; //操作人角色 10买家 | ||
174 | - public static final Long OPERATOR_ROLE_SELLER = 20L; //操作人角色 20卖家 | 173 | + public static final Integer OPERATOR_ROLE_BUYER = 10; //操作人角色 10买家 |
174 | + public static final Integer OPERATOR_ROLE_SELLER = 20; //操作人角色 20卖家 | ||
175 | /** 是否选择代找物流:1-是,2-否*/ | 175 | /** 是否选择代找物流:1-是,2-否*/ |
176 | public static final Integer QUERYPARAM_ISAGENTLOGISTICS_YES = 1; | 176 | public static final Integer QUERYPARAM_ISAGENTLOGISTICS_YES = 1; |
177 | public static final Integer QUERYPARAM_ISAGENTLOGISTICS_NO = 0; | 177 | public static final Integer QUERYPARAM_ISAGENTLOGISTICS_NO = 0; |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/login/SendVeriCodeReq.java
@@ -37,7 +37,7 @@ public class SendVeriCodeReq extends BaseReq { | @@ -37,7 +37,7 @@ public class SendVeriCodeReq extends BaseReq { | ||
37 | /** | 37 | /** |
38 | * 消息类型 | 38 | * 消息类型 |
39 | */ | 39 | */ |
40 | - @ApiModelProperty(value = "消息类型:1登录,2注册,3找回密码",required = true) | 40 | + @ApiModelProperty(value = "消息类型:1验证码登录,2注册,3找回密码",required = true) |
41 | private Integer msgType; | 41 | private Integer msgType; |
42 | 42 | ||
43 | 43 |
mobsite-getway-domain/src/main/java/com/diligrp/mobsite/getway/domain/protocol/login/SendVeriCodeResp.java
@@ -30,11 +30,14 @@ public class SendVeriCodeResp extends BaseResp { | @@ -30,11 +30,14 @@ public class SendVeriCodeResp extends BaseResp { | ||
30 | */ | 30 | */ |
31 | @ApiModelProperty(value = "发送结果:1成功") | 31 | @ApiModelProperty(value = "发送结果:1成功") |
32 | private Integer sendCode = SEND_CODE_ERROR; | 32 | private Integer sendCode = SEND_CODE_ERROR; |
33 | - ///** | ||
34 | - // * 万能验证码 | ||
35 | - // */ | ||
36 | - //@ApiModelProperty(value = "万能验证码") | ||
37 | - //private String passKey; | 33 | + /** |
34 | + * 验证码 | ||
35 | + */ | ||
36 | + @ApiModelProperty(value = "验证码(测试用)") | ||
37 | + private String passKey; | ||
38 | + | ||
39 | + | ||
40 | + | ||
38 | 41 | ||
39 | /** | 42 | /** |
40 | * get value of SendVeriCodeResp.sendCode | 43 | * get value of SendVeriCodeResp.sendCode |
@@ -59,4 +62,11 @@ public class SendVeriCodeResp extends BaseResp { | @@ -59,4 +62,11 @@ public class SendVeriCodeResp extends BaseResp { | ||
59 | } | 62 | } |
60 | 63 | ||
61 | 64 | ||
65 | + public String getPassKey() { | ||
66 | + return passKey; | ||
67 | + } | ||
68 | + | ||
69 | + public void setPassKey(String passKey) { | ||
70 | + this.passKey = passKey; | ||
71 | + } | ||
62 | } | 72 | } |
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/PassportRPC.java
@@ -7,6 +7,7 @@ import com.diligrp.mobsite.getway.domain.protocol.login.LoginReq; | @@ -7,6 +7,7 @@ import com.diligrp.mobsite.getway.domain.protocol.login.LoginReq; | ||
7 | import com.diligrp.mobsite.getway.domain.protocol.register.SellerRegisterReq; | 7 | import com.diligrp.mobsite.getway.domain.protocol.register.SellerRegisterReq; |
8 | import com.diligrp.mobsite.getway.domain.protocol.register.UserRegisterReq; | 8 | import com.diligrp.mobsite.getway.domain.protocol.register.UserRegisterReq; |
9 | import com.diligrp.mobsite.getway.domain.protocol.user.ModifyPwdReq; | 9 | import com.diligrp.mobsite.getway.domain.protocol.user.ModifyPwdReq; |
10 | +import com.diligrp.mobsite.getway.rpc.base.BaseOutput; | ||
10 | import com.diligrp.mobsite.getway.rpc.base.BaseService; | 11 | import com.diligrp.mobsite.getway.rpc.base.BaseService; |
11 | 12 | ||
12 | 13 | ||
@@ -31,9 +32,9 @@ public interface PassportRPC extends BaseService { | @@ -31,9 +32,9 @@ public interface PassportRPC extends BaseService { | ||
31 | 32 | ||
32 | BuyerInfoOutput buyerLogin(LoginReq req); | 33 | BuyerInfoOutput buyerLogin(LoginReq req); |
33 | 34 | ||
34 | - boolean sendVeriCodeOfSeller(String mobile,Integer msgType); | 35 | + BaseOutput<String> sendVeriCodeOfSeller(String mobile, Integer msgType); |
35 | 36 | ||
36 | - boolean sendVeriCodeOfBuyer(String mobile,Integer msgType); | 37 | + BaseOutput<String> sendVeriCodeOfBuyer(String mobile,Integer msgType); |
37 | 38 | ||
38 | boolean verifySellerSmsCode(String mobile, String veriCode); | 39 | boolean verifySellerSmsCode(String mobile, String veriCode); |
39 | 40 |
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/base/impl/BaseServiceImpl.java
@@ -54,12 +54,9 @@ import java.util.Map; | @@ -54,12 +54,9 @@ import java.util.Map; | ||
54 | } | 54 | } |
55 | 55 | ||
56 | int code = request.code(); | 56 | int code = request.code(); |
57 | - if (code != 200) { | ||
58 | - output.setCode(code); | ||
59 | - output.setResult(request.message()); | ||
60 | - } else { | ||
61 | - output.setCode(code); | ||
62 | - output.setResult(request.message()); | 57 | + output.setCode(code); |
58 | + output.setResult(request.message()); | ||
59 | + if (code == 200) { | ||
63 | String result = request.body(); | 60 | String result = request.body(); |
64 | if (type != null) { | 61 | if (type != null) { |
65 | output = JSON.parseObject(result, type); | 62 | output = JSON.parseObject(result, type); |
@@ -72,6 +69,9 @@ import java.util.Map; | @@ -72,6 +69,9 @@ import java.util.Map; | ||
72 | 69 | ||
73 | //将javabean实体类转为map类型,然后返回一个map类型的值 | 70 | //将javabean实体类转为map类型,然后返回一个map类型的值 |
74 | public static Map<String, Object> beanToMap(Object obj) { | 71 | public static Map<String, Object> beanToMap(Object obj) { |
72 | + if(obj==null){ | ||
73 | + return null; | ||
74 | + } | ||
75 | if(obj instanceof Map){ | 75 | if(obj instanceof Map){ |
76 | return (Map<String, Object>)obj; | 76 | return (Map<String, Object>)obj; |
77 | } | 77 | } |
@@ -93,4 +93,6 @@ import java.util.Map; | @@ -93,4 +93,6 @@ import java.util.Map; | ||
93 | } | 93 | } |
94 | return params; | 94 | return params; |
95 | } | 95 | } |
96 | + | ||
97 | + | ||
96 | } | 98 | } |
mobsite-getway-rpc/src/main/java/com/diligrp/mobsite/getway/rpc/impl/PassportRPCImpl.java
@@ -201,7 +201,7 @@ public class PassportRPCImpl extends BaseServiceImpl implements PassportRPC { | @@ -201,7 +201,7 @@ public class PassportRPCImpl extends BaseServiceImpl implements PassportRPC { | ||
201 | 201 | ||
202 | 202 | ||
203 | @Override | 203 | @Override |
204 | - public boolean sendVeriCodeOfSeller(String mobile,Integer msgType) { | 204 | + public BaseOutput<String> sendVeriCodeOfSeller(String mobile,Integer msgType) { |
205 | BaseOutput<String> output = null; | 205 | BaseOutput<String> output = null; |
206 | TypeReference<BaseOutput<Integer>> type = new TypeReference<BaseOutput<Integer>>() { | 206 | TypeReference<BaseOutput<Integer>> type = new TypeReference<BaseOutput<Integer>>() { |
207 | }; | 207 | }; |
@@ -232,22 +232,24 @@ public class PassportRPCImpl extends BaseServiceImpl implements PassportRPC { | @@ -232,22 +232,24 @@ public class PassportRPCImpl extends BaseServiceImpl implements PassportRPC { | ||
232 | throw new ServiceException(output.getCode(),output.getResult()); | 232 | throw new ServiceException(output.getCode(),output.getResult()); |
233 | } | 233 | } |
234 | 234 | ||
235 | - return output.getCode().equals(com.b2c.myapp.common.utils.ResultCode.OK); | 235 | + System.out.println("验证码 = " + output.getData()); |
236 | + | ||
237 | + return output; | ||
236 | } | 238 | } |
237 | 239 | ||
238 | 240 | ||
239 | @Override | 241 | @Override |
240 | - public boolean sendVeriCodeOfBuyer(String mobile,Integer msgType) { | 242 | + public BaseOutput<String> sendVeriCodeOfBuyer(String mobile,Integer msgType) { |
241 | BaseOutput<String> output = null; | 243 | BaseOutput<String> output = null; |
242 | try { | 244 | try { |
243 | if (msgType== SendVeriCodeReq.MSG_TYPE_LOGIN){ | 245 | if (msgType== SendVeriCodeReq.MSG_TYPE_LOGIN){ |
244 | - output = super.httpGet("/api/login/sendSMS/"+mobile, null, null); | 246 | + output = super.httpGet("/api/login/sendSMS/"+mobile, null, new TypeReference<BaseOutput<String>>(){}); |
245 | } | 247 | } |
246 | if (msgType== SendVeriCodeReq.MSG_TYPE_REGISTER){ | 248 | if (msgType== SendVeriCodeReq.MSG_TYPE_REGISTER){ |
247 | - output = super.httpGet("/api/register/sendBuyerRegisterSMS/"+mobile, null, null); | 249 | + output = super.httpGet("/api/register/sendBuyerRegisterSMS/"+mobile, null, new TypeReference<BaseOutput<String>>(){}); |
248 | } | 250 | } |
249 | if (msgType== SendVeriCodeReq.MSG_TYPE_RETRIEVE_PASSWORD){ | 251 | if (msgType== SendVeriCodeReq.MSG_TYPE_RETRIEVE_PASSWORD){ |
250 | - output = super.httpGet("/api/forgot/sendBuyerForgotPasswordSMS/"+mobile, null, null); | 252 | + output = super.httpGet("/api/forgot/sendBuyerForgotPasswordSMS/"+mobile, null, new TypeReference<BaseOutput<String>>(){}); |
251 | } | 253 | } |
252 | } catch (Exception e) { | 254 | } catch (Exception e) { |
253 | 255 | ||
@@ -278,7 +280,8 @@ public class PassportRPCImpl extends BaseServiceImpl implements PassportRPC { | @@ -278,7 +280,8 @@ public class PassportRPCImpl extends BaseServiceImpl implements PassportRPC { | ||
278 | throw new ServiceException(output.getCode(),output.getResult()); | 280 | throw new ServiceException(output.getCode(),output.getResult()); |
279 | } | 281 | } |
280 | 282 | ||
281 | - return output.getCode().equals(com.b2c.myapp.common.utils.ResultCode.OK); | 283 | + System.out.println("验证码(买家) = " + output.getData()); |
284 | + return output; | ||
282 | } | 285 | } |
283 | 286 | ||
284 | @Override | 287 | @Override |
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/buyer/user/impl/UserServiceImpl.java
@@ -16,6 +16,7 @@ import com.diligrp.mobsite.getway.domain.protocol.user.model.RegisterNoPlatform; | @@ -16,6 +16,7 @@ import com.diligrp.mobsite.getway.domain.protocol.user.model.RegisterNoPlatform; | ||
16 | import com.diligrp.mobsite.getway.manager.common.RegisterNoMapperManager; | 16 | import com.diligrp.mobsite.getway.manager.common.RegisterNoMapperManager; |
17 | import com.diligrp.mobsite.getway.rpc.PassportRPC; | 17 | import com.diligrp.mobsite.getway.rpc.PassportRPC; |
18 | import com.diligrp.mobsite.getway.rpc.UserRPC; | 18 | import com.diligrp.mobsite.getway.rpc.UserRPC; |
19 | +import com.diligrp.mobsite.getway.rpc.base.BaseOutput; | ||
19 | import com.diligrp.mobsite.getway.service.buyer.user.UserService; | 20 | import com.diligrp.mobsite.getway.service.buyer.user.UserService; |
20 | import com.diligrp.website.util.redis.impl.RedisUtilImpl; | 21 | import com.diligrp.website.util.redis.impl.RedisUtilImpl; |
21 | import com.diligrp.website.util.security.Validator; | 22 | import com.diligrp.website.util.security.Validator; |
@@ -69,6 +70,7 @@ public class UserServiceImpl implements UserService { | @@ -69,6 +70,7 @@ public class UserServiceImpl implements UserService { | ||
69 | 70 | ||
70 | //缓存用户信息 | 71 | //缓存用户信息 |
71 | cacheUserInfo(userInfo.getId(),req.getDeviceId()); | 72 | cacheUserInfo(userInfo.getId(),req.getDeviceId()); |
73 | + | ||
72 | if (Validator.isEmpty(req.getRegisterNo())){ | 74 | if (Validator.isEmpty(req.getRegisterNo())){ |
73 | logger.error("卖家登录激光推送id为空[userId=]",userInfo.getId()); | 75 | logger.error("卖家登录激光推送id为空[userId=]",userInfo.getId()); |
74 | }else{ | 76 | }else{ |
@@ -201,9 +203,10 @@ public class UserServiceImpl implements UserService { | @@ -201,9 +203,10 @@ public class UserServiceImpl implements UserService { | ||
201 | throw new ServiceException(ErrorMessage.USER_MOBILE_EXIST); | 203 | throw new ServiceException(ErrorMessage.USER_MOBILE_EXIST); |
202 | } | 204 | } |
203 | } | 205 | } |
204 | - passportRPC.sendVeriCodeOfBuyer(mobile,req.getMsgType()); | 206 | + BaseOutput<String> out = passportRPC.sendVeriCodeOfBuyer(mobile, req.getMsgType()); |
205 | SendVeriCodeResp resp = new SendVeriCodeResp(); | 207 | SendVeriCodeResp resp = new SendVeriCodeResp(); |
206 | resp.setSendCode(SendVeriCodeResp.SEND_CODE_SUCCESS); | 208 | resp.setSendCode(SendVeriCodeResp.SEND_CODE_SUCCESS); |
209 | + resp.setPassKey(out.getData()); | ||
207 | return resp; | 210 | return resp; |
208 | } | 211 | } |
209 | 212 |
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/seller/impl/SellerUserServiceImpl.java
@@ -19,6 +19,7 @@ import com.diligrp.mobsite.getway.manager.common.RegisterNoMapperManager; | @@ -19,6 +19,7 @@ import com.diligrp.mobsite.getway.manager.common.RegisterNoMapperManager; | ||
19 | import com.diligrp.mobsite.getway.rpc.PassportRPC; | 19 | import com.diligrp.mobsite.getway.rpc.PassportRPC; |
20 | import com.diligrp.mobsite.getway.rpc.SellerRPC; | 20 | import com.diligrp.mobsite.getway.rpc.SellerRPC; |
21 | import com.diligrp.mobsite.getway.rpc.ShopRPC; | 21 | import com.diligrp.mobsite.getway.rpc.ShopRPC; |
22 | +import com.diligrp.mobsite.getway.rpc.base.BaseOutput; | ||
22 | import com.diligrp.mobsite.getway.service.seller.SellerUserService; | 23 | import com.diligrp.mobsite.getway.service.seller.SellerUserService; |
23 | import com.diligrp.website.util.redis.impl.RedisUtilImpl; | 24 | import com.diligrp.website.util.redis.impl.RedisUtilImpl; |
24 | import com.diligrp.website.util.security.Validator; | 25 | import com.diligrp.website.util.security.Validator; |
@@ -191,9 +192,10 @@ public class SellerUserServiceImpl implements SellerUserService { | @@ -191,9 +192,10 @@ public class SellerUserServiceImpl implements SellerUserService { | ||
191 | throw new ServiceException(ErrorMessage.USER_MOBILE_EXIST); | 192 | throw new ServiceException(ErrorMessage.USER_MOBILE_EXIST); |
192 | } | 193 | } |
193 | } | 194 | } |
194 | - passportRPC.sendVeriCodeOfSeller(mobile,req.getMsgType()); | 195 | + BaseOutput<String> out = passportRPC.sendVeriCodeOfSeller(mobile, req.getMsgType()); |
195 | SendVeriCodeResp resp = new SendVeriCodeResp(); | 196 | SendVeriCodeResp resp = new SendVeriCodeResp(); |
196 | resp.setSendCode(SendVeriCodeResp.SEND_CODE_SUCCESS); | 197 | resp.setSendCode(SendVeriCodeResp.SEND_CODE_SUCCESS); |
198 | + resp.setPassKey(out.getData()); | ||
197 | return resp; | 199 | return resp; |
198 | } | 200 | } |
199 | 201 |
mobsite-getway-web/pom.xml
@@ -37,7 +37,7 @@ | @@ -37,7 +37,7 @@ | ||
37 | <artifactId>tomcat7-maven-plugin</artifactId> | 37 | <artifactId>tomcat7-maven-plugin</artifactId> |
38 | <version>2.2</version> | 38 | <version>2.2</version> |
39 | <configuration> | 39 | <configuration> |
40 | - <port>8082</port> | 40 | + <port>8080</port> |
41 | <url>http://10.28.11.181:8080/manager</url> | 41 | <url>http://10.28.11.181:8080/manager</url> |
42 | <username>gateway</username> | 42 | <username>gateway</username> |
43 | <password>123456</password> | 43 | <password>123456</password> |
mobsite-getway-web/src/main/java/com/diligrp/mobsite/getway/web/api/base/version/VersionController.java
@@ -26,7 +26,7 @@ import javax.annotation.Resource; | @@ -26,7 +26,7 @@ import javax.annotation.Resource; | ||
26 | */ | 26 | */ |
27 | @Controller | 27 | @Controller |
28 | @RequestMapping("/mobsiteApp/version/") | 28 | @RequestMapping("/mobsiteApp/version/") |
29 | -@Api(value = "mobsiteApp/version", description = "版本接口") | 29 | +@Api(value = "mobsiteApp-version", description = "版本接口") |
30 | public class VersionController extends BaseApiController{ | 30 | public class VersionController extends BaseApiController{ |
31 | 31 | ||
32 | @Resource | 32 | @Resource |
mobsite-getway-web/src/main/java/com/diligrp/mobsite/getway/web/api/buyer/user/UserController.java
@@ -147,7 +147,7 @@ public class UserController extends BaseApiController { | @@ -147,7 +147,7 @@ public class UserController extends BaseApiController { | ||
147 | @ApiOperation(value = "发送验证码到手机", httpMethod = "POST" , notes = "发送验证码到手机",response = SendVeriCodeResp.class) | 147 | @ApiOperation(value = "发送验证码到手机", httpMethod = "POST" , notes = "发送验证码到手机",response = SendVeriCodeResp.class) |
148 | @RequestMapping(value = "/sendAuthCode",method = RequestMethod.POST) | 148 | @RequestMapping(value = "/sendAuthCode",method = RequestMethod.POST) |
149 | @ResponseBody | 149 | @ResponseBody |
150 | - public void sendAuthCode(@RequestBody SendVeriCodeReq temp){ | 150 | + public void sendAuthCode(@RequestBody SendVeriCodeReq temp){ |
151 | SendVeriCodeReq req= super.getRequest(SendVeriCodeReq.class); | 151 | SendVeriCodeReq req= super.getRequest(SendVeriCodeReq.class); |
152 | try { | 152 | try { |
153 | BeanValidator.validator(req); | 153 | BeanValidator.validator(req); |
mobsite-getway-web/src/main/java/com/diligrp/mobsite/getway/web/filter/LoginTimeoutInterceptor.java
1 | package com.diligrp.mobsite.getway.web.filter; | 1 | package com.diligrp.mobsite.getway.web.filter; |
2 | 2 | ||
3 | -import com.diligrp.mobsite.getway.domain.common.*; | ||
4 | -import com.diligrp.mobsite.getway.domain.protocol.*; | 3 | +import com.diligrp.mobsite.getway.domain.common.Constant; |
4 | +import com.diligrp.mobsite.getway.domain.common.ErrorMessage; | ||
5 | +import com.diligrp.mobsite.getway.domain.common.RedisKey; | ||
6 | +import com.diligrp.mobsite.getway.domain.common.ResultCode; | ||
7 | +import com.diligrp.mobsite.getway.domain.protocol.BaseReq; | ||
8 | +import com.diligrp.mobsite.getway.domain.protocol.Token; | ||
5 | import com.diligrp.mobsite.getway.web.utils.WebContent; | 9 | import com.diligrp.mobsite.getway.web.utils.WebContent; |
6 | import com.diligrp.website.util.redis.RedisUtil; | 10 | import com.diligrp.website.util.redis.RedisUtil; |
7 | import com.diligrp.website.util.security.Validator; | 11 | import com.diligrp.website.util.security.Validator; |
8 | import org.nutz.json.Json; | 12 | import org.nutz.json.Json; |
9 | -import org.slf4j.*; | 13 | +import org.slf4j.Logger; |
14 | +import org.slf4j.LoggerFactory; | ||
10 | import org.springframework.beans.factory.annotation.Value; | 15 | import org.springframework.beans.factory.annotation.Value; |
11 | import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; | 16 | import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; |
12 | 17 | ||
13 | import javax.annotation.Resource; | 18 | import javax.annotation.Resource; |
14 | -import javax.servlet.http.*; | 19 | +import javax.servlet.http.HttpServletRequest; |
20 | +import javax.servlet.http.HttpServletResponse; | ||
15 | 21 | ||
16 | /** | 22 | /** |
17 | * <B>Description</B> 验证用户超时检测 <br /> | 23 | * <B>Description</B> 验证用户超时检测 <br /> |
@@ -49,9 +55,9 @@ public class LoginTimeoutInterceptor extends HandlerInterceptorAdapter { | @@ -49,9 +55,9 @@ public class LoginTimeoutInterceptor extends HandlerInterceptorAdapter { | ||
49 | } | 55 | } |
50 | 56 | ||
51 | //检测token信息 | 57 | //检测token信息 |
52 | - //if (!checkTokenInfo(body,request)) { | ||
53 | - // return false; | ||
54 | - //} | 58 | + if (!checkTokenInfo(body,request)) { |
59 | + return false; | ||
60 | + } | ||
55 | 61 | ||
56 | return super.preHandle(request, response, handler); | 62 | return super.preHandle(request, response, handler); |
57 | } | 63 | } |
@@ -83,10 +89,18 @@ public class LoginTimeoutInterceptor extends HandlerInterceptorAdapter { | @@ -83,10 +89,18 @@ public class LoginTimeoutInterceptor extends HandlerInterceptorAdapter { | ||
83 | return false; | 89 | return false; |
84 | } | 90 | } |
85 | 91 | ||
86 | - //登录redisKey=userId-deviceId | ||
87 | -// String loginKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, userId + Constant.COMMON_DASH + baseReq.getDeviceId()); | 92 | + |
93 | + String regularStr = ""; | ||
94 | + if (token.getUserRole() == Constant.OPERATOR_ROLE_BUYER){ | ||
95 | + regularStr = Constant.USER_ROLE_SIGN_BUYER; | ||
96 | + }else if (token.getUserRole() == Constant.OPERATOR_ROLE_SELLER){ | ||
97 | + regularStr = Constant.USER_ROLE_SIGN_SELLER; | ||
98 | + }else { | ||
99 | + log.error("请求参数userRole异常"); | ||
100 | + return false; | ||
101 | + } | ||
88 | //登录排斥验证 | 102 | //登录排斥验证 |
89 | - String loginKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, token.getUserRole()+String.valueOf(userId)); | 103 | + String loginKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, regularStr+String.valueOf(userId)); |
90 | String loginValue = redisUtil.getString(loginKey); | 104 | String loginValue = redisUtil.getString(loginKey); |
91 | if(Validator.isEmpty(loginValue) || !loginValue.equals(String.valueOf(userId))) { | 105 | if(Validator.isEmpty(loginValue) || !loginValue.equals(String.valueOf(userId))) { |
92 | log.error("用户没有登录请重新登录[userId={}]",userId); | 106 | log.error("用户没有登录请重新登录[userId={}]",userId); |
@@ -95,7 +109,7 @@ public class LoginTimeoutInterceptor extends HandlerInterceptorAdapter { | @@ -95,7 +109,7 @@ public class LoginTimeoutInterceptor extends HandlerInterceptorAdapter { | ||
95 | } | 109 | } |
96 | 110 | ||
97 | //登录设备排斥验证 | 111 | //登录设备排斥验证 |
98 | - String loginDevicedKey = redisUtil.makeKey(RedisKey.USER_DEVICEID, token.getUserRole()+String.valueOf(userId)); | 112 | + String loginDevicedKey = redisUtil.makeKey(RedisKey.USER_DEVICEID, regularStr+String.valueOf(userId)); |
99 | String loginDevicedValue = redisUtil.getString(loginDevicedKey); | 113 | String loginDevicedValue = redisUtil.getString(loginDevicedKey); |
100 | if (!Validator.isNull(baseReq.getDeviceId())) { | 114 | if (!Validator.isNull(baseReq.getDeviceId())) { |
101 | if(Validator.isEmpty(loginDevicedValue) || !loginDevicedValue.equals(baseReq.getDeviceId())) { | 115 | if(Validator.isEmpty(loginDevicedValue) || !loginDevicedValue.equals(baseReq.getDeviceId())) { |
@@ -106,7 +120,7 @@ public class LoginTimeoutInterceptor extends HandlerInterceptorAdapter { | @@ -106,7 +120,7 @@ public class LoginTimeoutInterceptor extends HandlerInterceptorAdapter { | ||
106 | } | 120 | } |
107 | 121 | ||
108 | //登录延时 | 122 | //登录延时 |
109 | - logoutDelay(userId,baseReq.getDeviceId(),token.getUserRole()); | 123 | + logoutDelay(userId,baseReq.getDeviceId(),regularStr); |
110 | 124 | ||
111 | return true; | 125 | return true; |
112 | } | 126 | } |
@@ -115,10 +129,10 @@ public class LoginTimeoutInterceptor extends HandlerInterceptorAdapter { | @@ -115,10 +129,10 @@ public class LoginTimeoutInterceptor extends HandlerInterceptorAdapter { | ||
115 | * 延迟登录超时时间 | 129 | * 延迟登录超时时间 |
116 | * @param userId 用户ID | 130 | * @param userId 用户ID |
117 | */ | 131 | */ |
118 | - private void logoutDelay(long userId,String deviceId,Integer userRole) { | 132 | + private void logoutDelay(long userId,String deviceId,String regularStr) { |
119 | try { | 133 | try { |
120 | //cookievalue的rediskey | 134 | //cookievalue的rediskey |
121 | - String loginKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, userRole+String.valueOf(userId)); | 135 | + String loginKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, regularStr+String.valueOf(userId)); |
122 | //缓存cookievalue | 136 | //缓存cookievalue |
123 | redisUtil.setStringByExpire(loginKey, String.valueOf(userId), loginExpireTime); | 137 | redisUtil.setStringByExpire(loginKey, String.valueOf(userId), loginExpireTime); |
124 | 138 |
mobsite-getway-web/src/main/resources/mybatis/sqlmap/RegisterNoMapperDao.xml
@@ -92,7 +92,7 @@ | @@ -92,7 +92,7 @@ | ||
92 | and userid = #{param.userid} | 92 | and userid = #{param.userid} |
93 | </if> | 93 | </if> |
94 | <if test="param.userType != null and param.userType != ''"> | 94 | <if test="param.userType != null and param.userType != ''"> |
95 | - and userType = #{param.userType} | 95 | + and user_type = #{param.userType} |
96 | </if> | 96 | </if> |
97 | <if test="param.registerNo != null and param.registerNo != ''"> | 97 | <if test="param.registerNo != null and param.registerNo != ''"> |
98 | and register_no = #{param.registerNo} | 98 | and register_no = #{param.registerNo} |
@@ -133,7 +133,7 @@ | @@ -133,7 +133,7 @@ | ||
133 | and userid = #{param.userid} | 133 | and userid = #{param.userid} |
134 | </if> | 134 | </if> |
135 | <if test="param.userType != null and param.userType != ''"> | 135 | <if test="param.userType != null and param.userType != ''"> |
136 | - and userType = #{param.userType} | 136 | + and user_type = #{param.userType} |
137 | </if> | 137 | </if> |
138 | <if test="param.registerNo != null and param.registerNo != ''"> | 138 | <if test="param.registerNo != null and param.registerNo != ''"> |
139 | and register_no = #{param.registerNo} | 139 | and register_no = #{param.registerNo} |
@@ -180,7 +180,7 @@ | @@ -180,7 +180,7 @@ | ||
180 | and userid = #{param.userid} | 180 | and userid = #{param.userid} |
181 | </if> | 181 | </if> |
182 | <if test="param.userType != null and param.userType != ''"> | 182 | <if test="param.userType != null and param.userType != ''"> |
183 | - and userType = #{param.userType} | 183 | + and user_type = #{param.userType} |
184 | </if> | 184 | </if> |
185 | <if test="param.registerNo != null and param.registerNo != ''"> | 185 | <if test="param.registerNo != null and param.registerNo != ''"> |
186 | and register_no = #{param.registerNo} | 186 | and register_no = #{param.registerNo} |
@@ -225,7 +225,7 @@ | @@ -225,7 +225,7 @@ | ||
225 | </foreach> | 225 | </foreach> |
226 | </if> | 226 | </if> |
227 | <if test="param.userType != null and param.userType != ''"> | 227 | <if test="param.userType != null and param.userType != ''"> |
228 | - and userType = #{param.userType} | 228 | + and user_type = #{param.userType} |
229 | </if> | 229 | </if> |
230 | <if test="device_type != null and device_type != ''"> | 230 | <if test="device_type != null and device_type != ''"> |
231 | and device_type = #{device_type} | 231 | and device_type = #{device_type} |
mobsite-getway-web/src/main/resources/spring-web.xml
@@ -104,15 +104,15 @@ | @@ -104,15 +104,15 @@ | ||
104 | 104 | ||
105 | <!--卖家--> | 105 | <!--卖家--> |
106 | 106 | ||
107 | - <mvc:exclude-mapping path="/mobsiteApp/user/buyerLogin"/> | ||
108 | - <mvc:exclude-mapping path="/mobsiteApp/user/buyerLogins"/> | ||
109 | - <mvc:exclude-mapping path="/mobsiteApp/user/sendAuthCode"/> | ||
110 | - <mvc:exclude-mapping path="/mobsiteApp/user/checkAuthCode"/> | ||
111 | - <mvc:exclude-mapping path="/mobsiteApp/user/buyerRegister"/> | ||
112 | - <mvc:exclude-mapping path="/mobsiteApp/user/buyerRegisters"/> | ||
113 | - <mvc:exclude-mapping path="/mobsiteApp/user/loginForAuth"/> | ||
114 | - <mvc:exclude-mapping path="/mobsiteApp/user/logout"/> | ||
115 | - <mvc:exclude-mapping path="/mobsiteApp/user/modifyPwd"/> | 107 | + <mvc:exclude-mapping path="/mobsiteApp/seller/user/sellerLogin"/> |
108 | + <mvc:exclude-mapping path="/mobsiteApp/seller/user/sellerLogins"/> | ||
109 | + <mvc:exclude-mapping path="/mobsiteApp/seller/user/sendAuthCode"/> | ||
110 | + <mvc:exclude-mapping path="/mobsiteApp/seller/user/checkAuthCode"/> | ||
111 | + <mvc:exclude-mapping path="/mobsiteApp/seller/user/checkMobile"/> | ||
112 | + <mvc:exclude-mapping path="/mobsiteApp/seller/user/sellerRegister"/> | ||
113 | + <mvc:exclude-mapping path="/mobsiteApp/seller/user/sellerRegisters"/> | ||
114 | + <mvc:exclude-mapping path="/mobsiteApp/seller/user/logout"/> | ||
115 | + <mvc:exclude-mapping path="/mobsiteApp/seller/user/modifyPwd"/> | ||
116 | <bean class="com.diligrp.mobsite.getway.web.filter.LoginTimeoutInterceptor"/> | 116 | <bean class="com.diligrp.mobsite.getway.web.filter.LoginTimeoutInterceptor"/> |
117 | </mvc:interceptor> | 117 | </mvc:interceptor> |
118 | <!-- <mvc:interceptor> | 118 | <!-- <mvc:interceptor> |