feat(user-relation): 实现用户关注与取消关注功能

- 在 t_following 和 t_fans 表中添加联合唯一索引,确保关注关系的幂等性- 新增 RocketMQ 消费者 FollowUnfollowConsumer,处理关注和取消关注消息
- 实现关注逻辑,通过事务保证关注表和粉丝表数据一致性
- 修改 DeleteNoteLocalCacheConsumer 的 consumerGroup 名称,避免消费者组冲突,否则可能遇到消费者不消费的情况
This commit is contained in:
2025-10-12 21:17:39 +08:00
parent 5a7564d504
commit 362c32cbd6
4 changed files with 111 additions and 5 deletions

View File

@@ -175,4 +175,8 @@ CREATE TABLE `t_fans`
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_unicode_ci COMMENT ='用户粉丝表';
ALTER TABLE t_following ADD UNIQUE uk_user_id_following_user_id(user_id, following_user_id);
ALTER TABLE t_fans ADD UNIQUE uk_user_id_fans_user_id(user_id, fans_user_id);