cp 申请 不同区域不可操作

This commit is contained in:
tianfeng 2025-12-11 19:39:04 +08:00
parent 4f1e0b8be1
commit d6feab886c
2 changed files with 10 additions and 0 deletions

View File

@ -62,6 +62,11 @@ public enum UserRelationErrorCode implements IResponseErrorCode {
*/
CP_LIMIT_EXCEEDED(4311, "CP limit exceeded, maximum 4 CPs allowed"),
/**
* 不同区域不可操作.
*/
UNAVAILABLE_NOT_REGION(4312, "Unavailable to operate not same region"),
;

View File

@ -15,6 +15,7 @@ import com.red.circle.other.app.convertor.user.UserProfileAppConvertor;
import com.red.circle.other.app.dto.cmd.user.relation.cp.CpApplyCmd;
import com.red.circle.other.app.util.OfficialNoticeUtils;
import com.red.circle.other.domain.gateway.user.UserProfileGateway;
import com.red.circle.other.domain.gateway.user.ability.UserRegionGateway;
import com.red.circle.other.domain.model.user.UserProfile;
import com.red.circle.other.infra.database.cache.service.other.EnumConfigCacheService;
import com.red.circle.other.infra.database.rds.entity.user.user.CpApply;
@ -54,6 +55,7 @@ public class SendCpApplyCmdExe {
private final EnumConfigCacheService enumConfigCacheService;
private final UserProfileGateway userProfileGateway;
private final UserProfileAppConvertor userProfileAppConvertor;
private final UserRegionGateway userRegionGateway;
public void execute(CpApplyCmd cmd) {
@ -61,6 +63,9 @@ public class SendCpApplyCmdExe {
ResponseAssert.isFalse(UserRelationErrorCode.UNAVAILABLE_OPS_YOURSELF,
Objects.equals(cmd.requiredReqUserId(), cmd.getAcceptApplyUserId()));
boolean eqRegion = userRegionGateway.checkEqRegion(cmd.requiredReqUserId(), cmd.getAcceptApplyUserId());
ResponseAssert.isTrue(UserRelationErrorCode.UNAVAILABLE_NOT_REGION, eqRegion);
// 检查是否是复合申请
CpRelationship dismissingCp = cpRelationshipService.getDismissingCp(
cmd.requiredReqUserId(), cmd.getAcceptApplyUserId());