feat(ECR-042): OpsCMS FeedSlot 薄写面
Admin POST/PUT 复用 admin.cms.write;C 端 GET /home/feed-slots;首页无 active 槽隐藏推荐区、失败回退展示;无新 migration。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -21,6 +21,7 @@ func (h *HomeHandler) Register(api *gin.RouterGroup) {
|
||||
g := api.Group("/home")
|
||||
g.GET("/tools", h.Tools)
|
||||
g.GET("/banners", h.Banners)
|
||||
g.GET("/feed-slots", h.FeedSlots)
|
||||
g.GET("/daily-tips", h.DailyTips)
|
||||
}
|
||||
|
||||
@@ -46,6 +47,16 @@ func (h *HomeHandler) Banners(c *gin.Context) {
|
||||
response.OK(c, gin.H{"items": items})
|
||||
}
|
||||
|
||||
func (h *HomeHandler) FeedSlots(c *gin.Context) {
|
||||
placement := c.DefaultQuery("placement", "home")
|
||||
items, err := h.Svc.ListPublicFeedSlots(c.Request.Context(), placement)
|
||||
if err != nil {
|
||||
response.Fail(c, http.StatusInternalServerError, 50049, "home feed slots failed")
|
||||
return
|
||||
}
|
||||
response.OK(c, gin.H{"items": items})
|
||||
}
|
||||
|
||||
func (h *HomeHandler) DailyTips(c *gin.Context) {
|
||||
uid, _ := middleware.UserIDFromContext(c)
|
||||
tips, err := h.Svc.DailyTips(c.Request.Context(), uid)
|
||||
|
||||
Reference in New Issue
Block a user