Browse Source

token不存在

lyhzzz 1 năm trước cách đây
mục cha
commit
ec931b19fc

+ 10 - 9
src/main/java/com/fdkankan/manage/service/impl/JySceneUserAuthServiceImpl.java

@@ -150,7 +150,7 @@ public class JySceneUserAuthServiceImpl extends ServiceImpl<IJySceneUserAuthMapp
     }
 
     @Override
-    public void addAuth(JySceneUserAuth param) {
+    public synchronized void addAuth(JySceneUserAuth param) {
         if(StringUtils.isBlank(param.getNum()) ){
             throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
         }
@@ -160,7 +160,6 @@ public class JySceneUserAuthServiceImpl extends ServiceImpl<IJySceneUserAuthMapp
             throw new BusinessException(ResultCode.SCENE_NOT_EXITS);
         }
 
-
         if(StringUtils.isBlank(param.getRyId()) ){
             throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
         }
@@ -273,10 +272,18 @@ public class JySceneUserAuthServiceImpl extends ServiceImpl<IJySceneUserAuthMapp
         if(pro == null && plus == null){
             throw new BusinessException(ResultCode.SCENE_NOT_EXITS);
         }
+        SceneAuthVo sceneAuthVo = new SceneAuthVo();
+
+        JySceneAuth jySceneAuth = jySceneAuthService.getByNum(num);
+        if(jySceneAuth!=null && jySceneAuth.getAuthType() == 1){
+            sceneAuthVo.setViewAuth(true);
+        }
+
         String redisKey = String.format(RedisKeyUtil.loginToken,token);
         if(!redisUtil.hasKey(redisKey)){
-            throw new BusinessException(ResultCode.USER_NOT_LOGIN);
+            return sceneAuthVo;
         }
+
         String userStr = redisUtil.get(redisKey);
         ManageLoginResponse result = JSONObject.parseObject(userStr,ManageLoginResponse.class);
         Long userId = result.getUserId();
@@ -284,12 +291,6 @@ public class JySceneUserAuthServiceImpl extends ServiceImpl<IJySceneUserAuthMapp
             redisUtil.del(redisKey);
             throw new BusinessException(ResultCode.USER_NOT_LOGIN);
         }
-        SceneAuthVo sceneAuthVo = new SceneAuthVo();
-
-        JySceneAuth jySceneAuth = jySceneAuthService.getByNum(num);
-        if(jySceneAuth!=null && jySceneAuth.getAuthType() == 1){
-            sceneAuthVo.setViewAuth(true);
-        }
 
         SysUser byId = sysUserService.getById(result.getId());
         JyUser jyUser = jyUserService.getBySysId(byId.getId());