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:
jackyu66git
2026-08-13 20:02:01 +08:00
co-authored by Cursor
parent 655141980a
commit 56f661748a
27 changed files with 773 additions and 25 deletions
+11
View File
@@ -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)