feat(hot-rank): add per-channel hot ranking functionality
Some checks failed
Build Backend / build (push) Failing after 1m52s
Build Backend / build-docker (push) Has been skipped

Add channel-specific hot post filtering and ranking across the posts
listing flow. Introduce refreshChannelRanks to compute per-channel hot
scores, new Redis cache keys for channel hot ranks, and update
repository/service/handler layers to accept channelID filtering
parameters. Update HotRankWorker dependency injection to include
ChannelRepository.
This commit is contained in:
lafay
2026-04-26 11:39:41 +08:00
parent 02466603f9
commit 27ea8689f9
7 changed files with 329 additions and 70 deletions

View File

@@ -57,6 +57,14 @@ func HotRankTopIDsKey() string {
return HotRankTopIDs
}
func HotRankZSetChannelKey(channelID string) string {
return fmt.Sprintf("%s:ch:%s", HotRankZSet, channelID)
}
func HotRankTopIDsChannelKey(channelID string) string {
return fmt.Sprintf("%s:ch:%s", HotRankTopIDs, channelID)
}
func PostListKey(postType string, userID string, page, pageSize int) string {
if userID == "" {
return fmt.Sprintf("%s:%s:%d:%d", PrefixPostList, postType, page, pageSize)