lyhzzz 6 months ago
parent
commit
28b5d6d44d

+ 1 - 0
src/main/java/com/fdkankan/ucenter/common/constants/ResultCode.java

@@ -13,6 +13,7 @@ public enum ResultCode {
     DIS_COO_ERROR(500005, "解除失败,相机没协作用户"),
     NOT_PER(500006, "权限不足"),
     COO_ERROR(500007, "协作失败,请先解除协作"),
+    COO_LIMIT_ERROR(500007, "协作失败,协作数量超过限制"),
 
     USER_NOT_LOGIN(3004, "用户未登录"),
     PARAM_MISS(3001, "参数缺失"),

+ 3 - 0
src/main/java/com/fdkankan/ucenter/service/impl/SceneCooperationServiceImpl.java

@@ -283,6 +283,9 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
         if(param.getUserNameList().contains( loginUserName)){
             throw new BusinessException(LoginConstant.FAILURE_CODE_3024, LoginConstant.FAILURE_MSG_3024);
         }
+        if(param.getUserNameList().size() >5){
+            throw new BusinessException(ResultCode.COO_LIMIT_ERROR);
+        }
         User loginUser = userService.getByUserName(loginUserName);
 
         List<User> users = new ArrayList<>();