feat:添加按照点赞数的feed流

This commit is contained in:
Leon
2025-12-16 14:02:17 +08:00
parent ead7153cc4
commit 0915e13e8f
6 changed files with 93 additions and 2 deletions

View File

@@ -34,3 +34,20 @@ func (f *FeedHandler) ListLatest(c *gin.Context) {
}
c.JSON(200, feedItems)
}
func (f *FeedHandler) ListLikesCount(c *gin.Context) {
var req ListLikesCountRequest
if err := c.ShouldBindJSON(&req); err != nil {
c.JSON(400, gin.H{"error": err.Error()})
return
}
if req.Limit <= 0 || req.Limit > 50 {
req.Limit = 10
}
feedItems, err := f.service.ListLikesCount(c.Request.Context(), req.Limit, req.LikesCount)
if err != nil {
c.JSON(500, gin.H{"error": err.Error()})
return
}
c.JSON(200, feedItems)
}