🐛 Fix some feed api issue

This commit is contained in:
LittleSheep 2024-07-07 16:26:50 +08:00
parent 50704892f0
commit e4d2a625d9

View File

@ -100,20 +100,8 @@ func listFeed(c *fiber.Ctx) error {
return feed[i].CreatedAt.After(feed[j].CreatedAt) return feed[i].CreatedAt.After(feed[j].CreatedAt)
}) })
start := offset
end := start + take
if start > len(feed) {
return c.JSON(fiber.Map{
"count": postCount + articleCount,
"data": []FeedRecord{},
})
}
if end > len(feed) {
end = len(feed)
}
return c.JSON(fiber.Map{ return c.JSON(fiber.Map{
"count": postCount + articleCount, "count": postCount + articleCount,
"data": feed[start:end], "data": feed,
}) })
} }