feat:添加响应结构体方便前端渲染

This commit is contained in:
Leon
2025-12-15 17:34:34 +08:00
parent 9713a23e7b
commit ab488d7b74
3 changed files with 58 additions and 21 deletions

View File

@@ -6,11 +6,6 @@ import (
"github.com/gin-gonic/gin"
)
type ListLatestRequest struct {
Limit int `json:"limit"`
LatestTime int64 `json:"latest_time"`
}
type FeedHandler struct {
service *FeedService
}
@@ -32,10 +27,10 @@ func (f *FeedHandler) ListLatest(c *gin.Context) {
if req.LatestTime > 0 {
latestTime = time.Unix(req.LatestTime, 0)
}
feeds, err := f.service.ListLatest(c.Request.Context(), req.Limit, latestTime)
feedItems, err := f.service.ListLatest(c.Request.Context(), req.Limit, latestTime)
if err != nil {
c.JSON(500, gin.H{"error": err.Error()})
return
}
c.JSON(200, feeds)
c.JSON(200, feedItems)
}