feat(count): 实现粉丝与关注计数服务

- 新增粉丝数与关注数的 MQ 消费逻辑
- 实现 Redis 计数更新与数据库落库操作
- 添加流量削峰限流机制提升系统稳定性
- 完善计数 DTO 与枚举类型定义
- 扩展 JsonUtils 工具类支持 Map 转换
- 更新 MQ 常量与 Redis Key 管理策略
-优化 MyBatis Mapper 支持计数插入或更新操作,Mybatis-plus操作起来属于硬编码,所以使用MyBatis的XML形式
This commit is contained in:
2025-10-16 19:21:28 +08:00
parent c6ac7193c1
commit d59acad051
12 changed files with 422 additions and 7 deletions

View File

@@ -16,4 +16,16 @@
<!--@mbg.generated-->
id, user_id, fans_total, following_total, note_total, like_total, collect_total
</sql>
<insert id="insertOrUpdateFansTotalByUserId" parameterType="map">
INSERT INTO t_user_count (user_id, fans_total)
VALUES (#{userId}, #{count})
ON DUPLICATE KEY UPDATE fans_total = fans_total + (#{count});
</insert>
<insert id="insertOrUpdateFollowingTotalByUserId">
INSERT INTO t_user_count (user_id, following_total)
VALUES (#{userId}, #{count})
ON DUPLICATE KEY UPDATE following_total = following_total + (#{count});
</insert>
</mapper>