Commit 64d35ddfa617e22b8fec44b642e31ac17f7dd545
1 parent
93423d0c
登录注册接口开发
Showing
4 changed files
with
27 additions
and
4 deletions
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/buyer/user/impl/UserServiceImpl.java
... | ... | @@ -68,7 +68,7 @@ public class UserServiceImpl implements UserService { |
68 | 68 | public LoginResp buyerlogin(LoginReq req) { |
69 | 69 | BuyerInfoOutput userInfo = passportRPC.buyerLogin(req); |
70 | 70 | |
71 | - //缓存用户信息 | |
71 | + //缓存用户登录信息 | |
72 | 72 | cacheUserInfo(userInfo.getId(),req.getDeviceId()); |
73 | 73 | |
74 | 74 | if (Validator.isEmpty(req.getRegisterNo())){ |
... | ... | @@ -246,6 +246,18 @@ public class UserServiceImpl implements UserService { |
246 | 246 | LogoutResp resp = new LogoutResp(); |
247 | 247 | |
248 | 248 | |
249 | + //解除登录缓存信息 | |
250 | + //userId | |
251 | + String cookieUserIdKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, Constant.USER_ROLE_SIGN_BUYER+String.valueOf(req.getUserId())); | |
252 | + //设备id | |
253 | + String cookieDeviceIdKey = redisUtil.makeKey(RedisKey.USER_DEVICEID, Constant.USER_ROLE_SIGN_BUYER+String.valueOf(req.getUserId())); | |
254 | + try { | |
255 | + redisUtil.deleteByKey(cookieUserIdKey); | |
256 | + redisUtil.deleteByKey(cookieDeviceIdKey); | |
257 | + } | |
258 | + catch(Exception e) { | |
259 | + logger.error("买家退出登录异常:清除登录缓存信息失败",e); | |
260 | + } | |
249 | 261 | // 解除绑定极光ID |
250 | 262 | if(!Validator.isEmpty(req.getRegisterNo())){ |
251 | 263 | ... | ... |
mobsite-getway-service/src/main/java/com/diligrp/mobsite/getway/service/seller/impl/SellerUserServiceImpl.java
... | ... | @@ -256,6 +256,19 @@ public class SellerUserServiceImpl implements SellerUserService { |
256 | 256 | LogoutResp resp = new LogoutResp(); |
257 | 257 | |
258 | 258 | |
259 | + //解除登录缓存信息 | |
260 | + //userId | |
261 | + String cookieUserIdKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, Constant.USER_ROLE_SIGN_SELLER+String.valueOf(req.getUserId())); | |
262 | + //设备id | |
263 | + String cookieDeviceIdKey = redisUtil.makeKey(RedisKey.USER_DEVICEID, Constant.USER_ROLE_SIGN_SELLER+String.valueOf(req.getUserId())); | |
264 | + try { | |
265 | + redisUtil.deleteByKey(cookieUserIdKey); | |
266 | + redisUtil.deleteByKey(cookieDeviceIdKey); | |
267 | + } | |
268 | + catch(Exception e) { | |
269 | + logger.error("卖家退出登录异常:清除登录缓存信息失败",e); | |
270 | + } | |
271 | + | |
259 | 272 | // 解除绑定极光ID |
260 | 273 | if(!Validator.isEmpty(req.getRegisterNo())){ |
261 | 274 | ... | ... |
mobsite-getway-web/src/main/java/com/diligrp/mobsite/getway/web/filter/LoginTimeoutInterceptor.java
... | ... | @@ -135,7 +135,7 @@ public class LoginTimeoutInterceptor extends HandlerInterceptorAdapter { |
135 | 135 | String loginKey = redisUtil.makeKey(RedisKey.USER_LOGININFO, regularStr+String.valueOf(userId)); |
136 | 136 | //缓存cookievalue |
137 | 137 | redisUtil.setStringByExpire(loginKey, String.valueOf(userId), loginExpireTime); |
138 | - | |
138 | + | |
139 | 139 | } catch (Exception e) { |
140 | 140 | log.error("用户登录延迟失败[userId={},msg={}]", userId, e); |
141 | 141 | } | ... | ... |
mobsite-getway-web/src/main/resources/spring-web.xml
... | ... | @@ -84,7 +84,6 @@ |
84 | 84 | <mvc:exclude-mapping path="/mobsiteApp/user/buyerRegister"/> |
85 | 85 | <mvc:exclude-mapping path="/mobsiteApp/user/buyerRegisters"/> |
86 | 86 | <mvc:exclude-mapping path="/mobsiteApp/user/loginForAuth"/> |
87 | - <mvc:exclude-mapping path="/mobsiteApp/user/logout"/> | |
88 | 87 | <mvc:exclude-mapping path="/mobsiteApp/user/modifyPwd"/> |
89 | 88 | |
90 | 89 | <mvc:exclude-mapping path="/mobsiteApp/goods/getProductByCid"/> |
... | ... | @@ -111,7 +110,6 @@ |
111 | 110 | <mvc:exclude-mapping path="/mobsiteApp/seller/user/checkMobile"/> |
112 | 111 | <mvc:exclude-mapping path="/mobsiteApp/seller/user/sellerRegister"/> |
113 | 112 | <mvc:exclude-mapping path="/mobsiteApp/seller/user/sellerRegisters"/> |
114 | - <mvc:exclude-mapping path="/mobsiteApp/seller/user/logout"/> | |
115 | 113 | <mvc:exclude-mapping path="/mobsiteApp/seller/user/modifyPwd"/> |
116 | 114 | <bean class="com.diligrp.mobsite.getway.web.filter.LoginTimeoutInterceptor"/> |
117 | 115 | </mvc:interceptor> | ... | ... |