Sfoglia il codice sorgente

平台管理员不校验platform

dengsixing 4 mesi fa
parent
commit
2f9edbb68b

+ 7 - 3
src/main/java/com/fdkankan/jp/xspace/service/impl/UserServiceImpl.java

@@ -78,9 +78,13 @@ public class UserServiceImpl extends ServiceImpl<IUserMapper, User> implements I
             throw new BusinessException(ResultCode.PASSWORD_ERROR);
         }
 
-        List<UserPlatform> xspases = userPlatformService.list(new LambdaQueryWrapper<UserPlatform>().eq(UserPlatform::getUserId, user.getId()).eq(UserPlatform::getPlatformKey, "xspase"));
-        if(CollUtil.isEmpty(xspases)){
-            throw new BusinessException(XspaceErrorCode.CODE_90001.code(), XspaceErrorCode.CODE_90001.message());
+        List<UserRole> userRoles = userRoleService.getByUserId(user.getId());
+        boolean isPlatform = userRoles.stream().anyMatch(v -> v.getRoleId() == 5);
+        if(!isPlatform){
+            List<UserPlatform> xspases = userPlatformService.list(new LambdaQueryWrapper<UserPlatform>().eq(UserPlatform::getUserId, user.getId()).eq(UserPlatform::getPlatformKey, "xspase"));
+            if(CollUtil.isEmpty(xspases)){
+                throw new BusinessException(XspaceErrorCode.CODE_90001.code(), XspaceErrorCode.CODE_90001.message());
+            }
         }
 
         String token = this.redisLogin(user.getUserName(), JSONObject.toJSONString(user),"user");