‘linchangsheng’ 2 kuukautta sitten
vanhempi
commit
127cde33f0

+ 10 - 2
mall-miniapp-service/src/main/java/com/gree/mall/miniapp/config/aop/ApiAspect.java

@@ -78,9 +78,17 @@ public class ApiAspect {
 
         //String userId = CommonUtils.getUserId(request);
         String userId = (String)redisUtil.get(Constant.RedisPrefix.TOKEN_WX+token);
-        if (StringUtils.isBlank(userId)) {
-            throw new RemoteServiceException(ResponseHelper.ResponseCode_AUTH_ERROR, "请求不合法");
+        if (StringUtils.isBlank(userId) || StringUtils.isBlank(jwtUserId)) {
+            throw new RemoteServiceException(ResponseHelper.ResponseCode_TOKEN_ID_ERROR, "请求不合法");
         }
+
+
+        User userToken = userService.getById(jwtUserId);
+        if (userToken == null) {
+            throw new RemoteServiceException(ResponseHelper.ResponseCode_TOKEN_ID_ERROR, "请求不合法");
+        }
+
+
         User user = userService.getById(userId);
         if(user == null){
             throw new RemoteServiceException(ResponseHelper.ResponseCode_AUTH_ERROR, "用户不存在,请联系相关人员");