feat:为ListByFollowing方法添加上redis缓存

This commit is contained in:
Leon
2025-12-24 13:04:38 +08:00
parent f0411b4577
commit 94140c3c13
4 changed files with 41 additions and 7 deletions

View File

@@ -101,7 +101,11 @@ func (f *FeedHandler) ListByFollowing(c *gin.Context) {
if err != nil {
viewerAccountID = 0
}
feedItems, err := f.service.ListByFollowing(c.Request.Context(), req.Limit, viewerAccountID)
var latestTime time.Time
if req.LatestTime > 0 {
latestTime = time.Unix(req.LatestTime, 0)
}
feedItems, err := f.service.ListByFollowing(c.Request.Context(), req.Limit, latestTime, viewerAccountID)
if err != nil {
c.JSON(500, gin.H{"error": err.Error()})
return