baifucheng пре 3 месеци
родитељ
комит
d5de8e813e

+ 2 - 1
ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/LoginApiInterceptor.java

@@ -52,10 +52,11 @@ public class LoginApiInterceptor implements HandlerInterceptor {
             return true;
         }
 
+        // 先校验redis中的token是否存在,如果不存在,则直接提示登录过期
         String cacheUserStr = redisTemplate.opsForValue().get(Constants.JWT_TOKEN + accessToken);
         if (ObjectUtil.isEmpty(cacheUserStr)) {
             //这里抛给前端的为一个自定义异常枚举,可自己定义
-            throw new ServiceException(ExceptionEnum.USER_NOT_LOGIN);
+            throw new ServiceException(ExceptionEnum.TOKEN_EXPIRED);
         }
 
         try {