diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/asserts/user/UserRelationErrorCode.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/asserts/user/UserRelationErrorCode.java index 19dd4af3..daf3a0f7 100644 --- a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/asserts/user/UserRelationErrorCode.java +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/asserts/user/UserRelationErrorCode.java @@ -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"), + ; diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/SendCpApplyCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/SendCpApplyCmdExe.java index d7e1c775..5113e891 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/SendCpApplyCmdExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/SendCpApplyCmdExe.java @@ -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());