处理cp申请校验数量

This commit is contained in:
tianfeng 2025-12-11 19:41:24 +08:00
parent d6feab886c
commit 005776a9f0

View File

@ -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);
}
// 操作失败