|
@@ -96,16 +96,14 @@ public class AuthInterceptor implements HandlerInterceptor {
|
|
throw new BusinessException(ExceptionResultEnum.TOKEN_NO);
|
|
throw new BusinessException(ExceptionResultEnum.TOKEN_NO);
|
|
}
|
|
}
|
|
Date expireTime = tbSession.getExpireTime();
|
|
Date expireTime = tbSession.getExpireTime();
|
|
- if (Objects.nonNull(expireTime) && expireTime.getTime() <= System.currentTimeMillis()) {
|
|
|
|
- throw new BusinessException(ExceptionResultEnum.TOKEN_NO);
|
|
|
|
- } else {
|
|
|
|
- if (Objects.isNull(tbUser)) {
|
|
|
|
- tbUser = tbUserService.getById(userId);
|
|
|
|
- RedisUtil.setUser(tbUser.getId(), platform, tbUser);
|
|
|
|
- }
|
|
|
|
- if (Objects.nonNull(expireTime) && (expireTime.getTime() - System.currentTimeMillis()) <= SystemConstant.REFRESH_EXPIRE_TIME) {
|
|
|
|
- RedisUtil.refreshUserSession(sessionId, platform);
|
|
|
|
- }
|
|
|
|
|
|
+ //手机端的token时长为一个月,所以会出现缓存没有的情况
|
|
|
|
+ if (Objects.isNull(tbUser)) {
|
|
|
|
+ tbUser = tbUserService.getById(userId);
|
|
|
|
+ RedisUtil.setUser(tbUser.getId(), platform, tbUser);
|
|
|
|
+ }
|
|
|
|
+ //还剩5分钟刷新缓存
|
|
|
|
+ if (Objects.nonNull(expireTime) && (expireTime.getTime() - System.currentTimeMillis()) <= SystemConstant.REFRESH_EXPIRE_TIME) {
|
|
|
|
+ RedisUtil.refreshUserSession(sessionId, platform);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
AuthDto authDto = (AuthDto) EhcacheUtil.get(SystemConstant.AUTH_CACHE, userId);
|
|
AuthDto authDto = (AuthDto) EhcacheUtil.get(SystemConstant.AUTH_CACHE, userId);
|