From c953fd6869c824a1dd2d788c37a74e6929dd0019 Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Mon, 19 Jan 2026 16:42:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=89=E9=BB=91=E4=BA=BA=E6=95=B0=E5=87=8F?= =?UTF-8?q?=E5=B0=91=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../user/UserShieldBlackAddCmdExe.java | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/UserShieldBlackAddCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/UserShieldBlackAddCmdExe.java index 23e9c901..1698cdf4 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/UserShieldBlackAddCmdExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/UserShieldBlackAddCmdExe.java @@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.red.circle.framework.core.asserts.ResponseAssert; import com.red.circle.framework.core.response.CommonErrorCode; import com.red.circle.other.app.dto.cmd.user.user.UserShieldBlackUserCmd; +import com.red.circle.other.domain.gateway.user.ability.UserRelationsCalculatorGateway; +import com.red.circle.other.domain.model.user.ability.UserRelationsCalculator; import com.red.circle.other.infra.database.cache.service.other.EnumConfigCacheService; import com.red.circle.other.infra.database.mongo.entity.live.RoomProfile; import com.red.circle.other.infra.database.mongo.entity.live.RoomUserBlacklist; @@ -41,6 +43,7 @@ public class UserShieldBlackAddCmdExe { private final RelationshipFriendService relationshipFriendService; private final CpRelationshipService cpRelationshipService; private final UserSubscriptionService userSubscriptionService; + private final UserRelationsCalculatorGateway userRelationsCalculatorGateway; public void execute(UserShieldBlackUserCmd cmd) { @@ -62,11 +65,12 @@ public class UserShieldBlackAddCmdExe { shieldBlackService.saveShieldBlack(cmd.requiredReqUserId() , cmd.getShieldUserId()); - relationshipFriendService.removeFriend(cmd.requiredReqUserId(), cmd.getShieldUserId()); - relationshipFriendService.removeFriend(cmd.getShieldUserId(), cmd.requiredReqUserId()); - userSubscriptionService.remove(cmd.requiredReqUserId(), cmd.getShieldUserId()); - userSubscriptionService.remove(cmd.getShieldUserId(), cmd.requiredReqUserId()); + Long reqUserId = cmd.requiredReqUserId(); + Long shieldUserId = cmd.getShieldUserId(); + // 取消关注并删除好友 + cancelSubAndRmFriend(reqUserId, shieldUserId); + cancelSubAndRmFriend(shieldUserId, reqUserId); // 拉黑房间 BaseInfo beBlackUser = baseInfoService.getById(cmd.getShieldUserId()); @@ -89,4 +93,22 @@ public class UserShieldBlackAddCmdExe { } + private void cancelSubAndRmFriend(Long reqUserId, Long shieldUserId) { + userSubscriptionService.remove(reqUserId, shieldUserId); + userRelationsCalculatorGateway.process(new UserRelationsCalculator() + .setUserId(reqUserId) + .setSubUserId(shieldUserId) + .setIncr(Boolean.FALSE) + .setType(UserRelationsCalculator.CounterEnum.SUBSCRIPTION) + ); + + relationshipFriendService.removeFriend(reqUserId, shieldUserId); + userRelationsCalculatorGateway.process(new UserRelationsCalculator() + .setUserId(reqUserId) + .setSubUserId(shieldUserId) + .setIncr(Boolean.FALSE) + .setType(UserRelationsCalculator.CounterEnum.FRIEND) + ); + } + }