diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/ProcessCpApplyCmd.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/ProcessCpApplyCmd.java index 6f5d41b2..1ff3698c 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/ProcessCpApplyCmd.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/ProcessCpApplyCmd.java @@ -70,6 +70,12 @@ public class ProcessCpApplyCmd { // 非复合申请:CP已存在 ResponseAssert.isFalse(UserRelationErrorCode.ME_OR_YOU_CP_EXISTED, cpRelationshipService.existsCp(cpApply.getSendApplyUserId(), cpApply.getAcceptApplyUserId())); + + // 检查CP数量限制(最多4个) + int senderCpCount = cpRelationshipService.countNormalCp(cmd.requiredReqUserId()); + int receiverCpCount = cpRelationshipService.countNormalCp(cpApply.getAcceptApplyUserId()); + ResponseAssert.isFalse(UserRelationErrorCode.CP_LIMIT_EXCEEDED, senderCpCount >= 4); + ResponseAssert.isFalse(UserRelationErrorCode.CP_LIMIT_EXCEEDED, receiverCpCount >= 4); } // 操作失败