🐛 Fix some feed api issue
This commit is contained in:
parent
50704892f0
commit
e4d2a625d9
@ -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,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user