Browse Source

拦截器token对比优化

tags/正式3.9.0
雍文秀 1 year ago
parent
commit
28951b5958

+ 1
- 1
sapi/src/main/java/com/xhkjedu/sapi/interceptors/RequestInterceptor.java View File

@@ -56,7 +56,7 @@ public class RequestInterceptor extends JedisUtil implements HandlerInterceptor
56 56
         if (!requestURI.contains("user/login") && !requestURI.endsWith("/get_new")
57 57
                 && N_Utils.isNotEmpty(key) && N_Utils.isNotEmpty(token)) {//非登录和获取最新版本相关接口验证token
58 58
             String redis_token = get(key);//系统缓存中保存的token
59
-            if (redis_token.equals("0")) {//获取token失败不对比
59
+            if (redis_token != null && redis_token.equals("0")) {//获取token失败不对比
60 60
             } else if (!token.equals(redis_token)) {
61 61
                 ResultVo result = new ResultVo();
62 62
                 result.setCode(2);

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/interceptors/RequestInterceptor.java View File

@@ -55,7 +55,7 @@ public class RequestInterceptor extends JedisUtil implements HandlerInterceptor
55 55
         if (!requestURI.contains("user/login") && !requestURI.endsWith("/get_new")
56 56
                 && N_Utils.isNotEmpty(key) && N_Utils.isNotEmpty(token)) {//非登录和获取最新版本相关接口验证token
57 57
             String redis_token = get(key);//系统缓存中保存的token
58
-            if (redis_token.equals("0")) {//获取token失败不对比
58
+            if (redis_token != null && redis_token.equals("0")) {//获取token失败不对比
59 59
             } else if (!token.equals(redis_token)) {
60 60
                 ResultVo result = new ResultVo();
61 61
                 result.setCode(2);

+ 1
- 1
sexam/src/main/java/com/xhkjedu/sexam/interceptors/RequestInterceptor.java View File

@@ -56,7 +56,7 @@ public class RequestInterceptor extends JedisUtil implements HandlerInterceptor
56 56
         if (!requestURI.contains("user/login") && !requestURI.endsWith("/get_new")
57 57
                 && N_Utils.isNotEmpty(key) && N_Utils.isNotEmpty(token)) {//非登录和获取最新版本相关接口验证token
58 58
             String redis_token = get(key);//系统缓存中保存的token
59
-            if (redis_token.equals("0")) {//获取token失败不对比
59
+            if (redis_token != null && redis_token.equals("0")) {//获取token失败不对比
60 60
             } else if (!token.equals(redis_token)) {
61 61
                 ResultVo result = new ResultVo();
62 62
                 result.setCode(2);

+ 1
- 1
slive/src/main/java/com/xhkjedu/slive/interceptors/RequestInterceptor.java View File

@@ -52,7 +52,7 @@ public class RequestInterceptor extends JedisUtil implements HandlerInterceptor
52 52
         if (!requestURI.contains("user/login") && !requestURI.endsWith("/get_new")
53 53
                 && N_Utils.isNotEmpty(key) && N_Utils.isNotEmpty(token)) {//非登录和获取最新版本相关接口验证token
54 54
             String redis_token = get(key);//系统缓存中保存的token
55
-            if (redis_token.equals("0")) {//获取token失败不对比
55
+            if (redis_token != null && redis_token.equals("0")) {//获取token失败不对比
56 56
             } else if (!token.equals(redis_token)) {
57 57
                 ResultVo result = new ResultVo();
58 58
                 result.setCode(2);

+ 1
- 1
sstudy/src/main/java/com/xhkjedu/sstudy/interceptors/RequestInterceptor.java View File

@@ -56,7 +56,7 @@ public class RequestInterceptor extends JedisUtil implements HandlerInterceptor
56 56
         if (!requestURI.contains("user/login") && !requestURI.endsWith("/get_new")
57 57
                 && N_Utils.isNotEmpty(key) && N_Utils.isNotEmpty(token)) {//非登录和获取最新版本相关接口验证token
58 58
             String redis_token = get(key);//系统缓存中保存的token
59
-            if (redis_token.equals("0")) {//获取token失败不对比
59
+            if (redis_token != null && redis_token.equals("0")) {//获取token失败不对比
60 60
             } else if (!token.equals(redis_token)) {
61 61
                 ResultVo result = new ResultVo();
62 62
                 result.setCode(2);

+ 1
- 1
suser/src/main/java/com/xhkjedu/suser/interceptors/RequestInterceptor.java View File

@@ -52,7 +52,7 @@ public class RequestInterceptor extends JedisUtil implements HandlerInterceptor
52 52
         if (!requestURI.contains("user/login") && !requestURI.endsWith("/get_new")
53 53
                 && N_Utils.isNotEmpty(key) && N_Utils.isNotEmpty(token)) {//非登录和获取最新版本相关接口验证token
54 54
             String redis_token = get(key);//系统缓存中保存的token
55
-            if (redis_token.equals("0")) {//获取token失败不对比
55
+            if (redis_token != null && redis_token.equals("0")) {//获取token失败不对比
56 56
             } else if (!token.equals(redis_token)) {
57 57
                 ResultVo result = new ResultVo();
58 58
                 result.setCode(2);

Loading…
Cancel
Save