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
         if (!requestURI.contains("user/login") && !requestURI.endsWith("/get_new")
56
         if (!requestURI.contains("user/login") && !requestURI.endsWith("/get_new")
57
                 && N_Utils.isNotEmpty(key) && N_Utils.isNotEmpty(token)) {//非登录和获取最新版本相关接口验证token
57
                 && N_Utils.isNotEmpty(key) && N_Utils.isNotEmpty(token)) {//非登录和获取最新版本相关接口验证token
58
             String redis_token = get(key);//系统缓存中保存的token
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
             } else if (!token.equals(redis_token)) {
60
             } else if (!token.equals(redis_token)) {
61
                 ResultVo result = new ResultVo();
61
                 ResultVo result = new ResultVo();
62
                 result.setCode(2);
62
                 result.setCode(2);

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

55
         if (!requestURI.contains("user/login") && !requestURI.endsWith("/get_new")
55
         if (!requestURI.contains("user/login") && !requestURI.endsWith("/get_new")
56
                 && N_Utils.isNotEmpty(key) && N_Utils.isNotEmpty(token)) {//非登录和获取最新版本相关接口验证token
56
                 && N_Utils.isNotEmpty(key) && N_Utils.isNotEmpty(token)) {//非登录和获取最新版本相关接口验证token
57
             String redis_token = get(key);//系统缓存中保存的token
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
             } else if (!token.equals(redis_token)) {
59
             } else if (!token.equals(redis_token)) {
60
                 ResultVo result = new ResultVo();
60
                 ResultVo result = new ResultVo();
61
                 result.setCode(2);
61
                 result.setCode(2);

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

56
         if (!requestURI.contains("user/login") && !requestURI.endsWith("/get_new")
56
         if (!requestURI.contains("user/login") && !requestURI.endsWith("/get_new")
57
                 && N_Utils.isNotEmpty(key) && N_Utils.isNotEmpty(token)) {//非登录和获取最新版本相关接口验证token
57
                 && N_Utils.isNotEmpty(key) && N_Utils.isNotEmpty(token)) {//非登录和获取最新版本相关接口验证token
58
             String redis_token = get(key);//系统缓存中保存的token
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
             } else if (!token.equals(redis_token)) {
60
             } else if (!token.equals(redis_token)) {
61
                 ResultVo result = new ResultVo();
61
                 ResultVo result = new ResultVo();
62
                 result.setCode(2);
62
                 result.setCode(2);

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

52
         if (!requestURI.contains("user/login") && !requestURI.endsWith("/get_new")
52
         if (!requestURI.contains("user/login") && !requestURI.endsWith("/get_new")
53
                 && N_Utils.isNotEmpty(key) && N_Utils.isNotEmpty(token)) {//非登录和获取最新版本相关接口验证token
53
                 && N_Utils.isNotEmpty(key) && N_Utils.isNotEmpty(token)) {//非登录和获取最新版本相关接口验证token
54
             String redis_token = get(key);//系统缓存中保存的token
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
             } else if (!token.equals(redis_token)) {
56
             } else if (!token.equals(redis_token)) {
57
                 ResultVo result = new ResultVo();
57
                 ResultVo result = new ResultVo();
58
                 result.setCode(2);
58
                 result.setCode(2);

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

56
         if (!requestURI.contains("user/login") && !requestURI.endsWith("/get_new")
56
         if (!requestURI.contains("user/login") && !requestURI.endsWith("/get_new")
57
                 && N_Utils.isNotEmpty(key) && N_Utils.isNotEmpty(token)) {//非登录和获取最新版本相关接口验证token
57
                 && N_Utils.isNotEmpty(key) && N_Utils.isNotEmpty(token)) {//非登录和获取最新版本相关接口验证token
58
             String redis_token = get(key);//系统缓存中保存的token
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
             } else if (!token.equals(redis_token)) {
60
             } else if (!token.equals(redis_token)) {
61
                 ResultVo result = new ResultVo();
61
                 ResultVo result = new ResultVo();
62
                 result.setCode(2);
62
                 result.setCode(2);

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

52
         if (!requestURI.contains("user/login") && !requestURI.endsWith("/get_new")
52
         if (!requestURI.contains("user/login") && !requestURI.endsWith("/get_new")
53
                 && N_Utils.isNotEmpty(key) && N_Utils.isNotEmpty(token)) {//非登录和获取最新版本相关接口验证token
53
                 && N_Utils.isNotEmpty(key) && N_Utils.isNotEmpty(token)) {//非登录和获取最新版本相关接口验证token
54
             String redis_token = get(key);//系统缓存中保存的token
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
             } else if (!token.equals(redis_token)) {
56
             } else if (!token.equals(redis_token)) {
57
                 ResultVo result = new ResultVo();
57
                 ResultVo result = new ResultVo();
58
                 result.setCode(2);
58
                 result.setCode(2);

Loading…
Cancel
Save