拉黑逻辑缓存处理
This commit is contained in:
parent
ff30192fe0
commit
4f56f8e8bf
@ -7,6 +7,7 @@ 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.cache.service.user.UserRelationshipCacheService;
|
||||
import com.red.circle.other.infra.database.mongo.entity.live.RoomProfile;
|
||||
import com.red.circle.other.infra.database.mongo.entity.live.RoomUserBlacklist;
|
||||
import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManagerService;
|
||||
@ -44,6 +45,7 @@ public class UserShieldBlackAddCmdExe {
|
||||
private final CpRelationshipService cpRelationshipService;
|
||||
private final UserSubscriptionService userSubscriptionService;
|
||||
private final UserRelationsCalculatorGateway userRelationsCalculatorGateway;
|
||||
private final UserRelationshipCacheService userRelationshipCacheService;
|
||||
|
||||
public void execute(UserShieldBlackUserCmd cmd) {
|
||||
|
||||
@ -94,21 +96,26 @@ 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)
|
||||
);
|
||||
boolean removed = userSubscriptionService.remove(reqUserId, shieldUserId);
|
||||
if (removed) {
|
||||
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)
|
||||
);
|
||||
boolean removedFriendId = relationshipFriendService.removeFriendId(reqUserId, shieldUserId);
|
||||
if (removedFriendId) {
|
||||
userRelationsCalculatorGateway.process(new UserRelationsCalculator()
|
||||
.setUserId(reqUserId)
|
||||
.setSubUserId(shieldUserId)
|
||||
.setIncr(Boolean.FALSE)
|
||||
.setType(UserRelationsCalculator.CounterEnum.FRIEND)
|
||||
);
|
||||
}
|
||||
userRelationshipCacheService.removeFriend(reqUserId, shieldUserId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -50,6 +50,11 @@ public interface RelationshipFriendService extends BaseService<RelationshipFrien
|
||||
*/
|
||||
Boolean checkFriend(Long userId, Long friendUserId);
|
||||
|
||||
/**
|
||||
* 删除单向好友
|
||||
*/
|
||||
boolean removeFriendId(Long userId, Long friendUserId);
|
||||
|
||||
/**
|
||||
* 移除好友.
|
||||
*
|
||||
|
||||
@ -94,6 +94,16 @@ public class RelationshipFriendServiceImpl extends
|
||||
).map(relationshipFriend -> Objects.nonNull(relationshipFriend.getId())).orElse(Boolean.FALSE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeFriendId(Long userId, Long friendUserId) {
|
||||
return delete()
|
||||
.eq(RelationshipFriend::getUserId, userId)
|
||||
.eq(RelationshipFriend::getFriendUserId, friendUserId)
|
||||
.last(PageConstant.LIMIT_ONE)
|
||||
.execute();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void removeFriend(Long userId, Long friendUserId) {
|
||||
delete()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user