feat(comment): 实现评论热度同步到 Redis ZSet

- 新增 Lua 脚本支持热点评论添加与更新
- 在评论消费端同步一级评论至 Redis 热点评论 ZSet
- 支持批量更新评论热度并维护 Redis 中的 Top 500 热点评论
- 修改 CommentDO 和 CommentHeatBO 模型,增加 noteId 字段以支持按笔记分组
- 调整 Mapper XML 查询字段,补充 note_id 字段用于构建 Redis Key
- 优化 Redis 脚本执行逻辑,确保线程安全及数据一致性
- 更新 HTTP 测试用例内容,验证 Redis 同步功能正确性
This commit is contained in:
2025-11-08 15:48:18 +08:00
parent 85e6bab079
commit bd775b805c
7 changed files with 175 additions and 7 deletions

View File

@@ -298,9 +298,9 @@ Authorization: Bearer {{token}}
{
"noteId": 1862481582414102549,
"content": "这是一条测试评论计数的二级评论666",
"content": "这是一条测试同步Redis并更新热度的评论",
"imageUrl": "https://cdn.pixabay.com/photo/2025/10/05/15/06/autumn-9875155_1280.jpg",
"replyCommentId": 4002
"replyCommentId": 8001
}
### 批量添加评论