FengChaoYu 2 ヶ月 前
コミット
9180bbdd9a

+ 6 - 0
mall-miniapp-service/src/main/java/com/gree/mall/miniapp/config/aop/ApiAspect.java

@@ -69,6 +69,12 @@ public class ApiAspect {
             }
         }
         String token = CommonUtils.getToken(request);
+
+        String jwtUserId = CommonUtils.getUserId(request);
+        if (token.equals(jwtUserId)) {
+            throw new RemoteServiceException(ResponseHelper.ResponseCode_TOKEN_ID_ERROR, "请求不合法");
+        }
+
 //        log.info("用户token:{} 访问 {}", token, request.getRequestURI());
         //String userId = CommonUtils.getUserId(request);
         String userId = (String)redisUtil.get(Constant.RedisPrefix.TOKEN_WX+token);

+ 1 - 0
mall-miniapp-service/src/main/java/com/gree/mall/miniapp/helper/ResponseHelper.java

@@ -10,6 +10,7 @@ public class ResponseHelper<T> {
     public final static int ResponseCode_COMMON = 501;//通用拦截提示
     public final static int ResponseCode_AUTH_ERROR = 1001;//非法请求
     public final static int ResponseCode_NOT_PHONE = 4001;//未找到师傅手机号
+    public final static int ResponseCode_TOKEN_ID_ERROR = 4444;// token解释userId出错
     public final static int ResponseCode_NOT_SIGN_G_PAY_CONFIRM = 40171;//未广州签支付确认书
     public final static int ResponseCode_NOT_SIGN_F_PAY_CONFIRM = 40172;//未佛山签支付确认书