feat(ECR-041): OpsCMS Banner 薄写面(Write-Wave 首刀)
Admin POST/PUT + admin.cms.write/审计;C 端 GET /home/banners;首页投影回退静态 homeFeeds;migration 000051;不碰 FeedSlot/支付/UGC。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -20,6 +20,7 @@ type HomeHandler struct {
|
||||
func (h *HomeHandler) Register(api *gin.RouterGroup) {
|
||||
g := api.Group("/home")
|
||||
g.GET("/tools", h.Tools)
|
||||
g.GET("/banners", h.Banners)
|
||||
g.GET("/daily-tips", h.DailyTips)
|
||||
}
|
||||
|
||||
@@ -35,6 +36,16 @@ func (h *HomeHandler) Tools(c *gin.Context) {
|
||||
response.OK(c, gin.H{"items": items})
|
||||
}
|
||||
|
||||
func (h *HomeHandler) Banners(c *gin.Context) {
|
||||
placement := c.DefaultQuery("placement", "home")
|
||||
items, err := h.Svc.ListPublicBanners(c.Request.Context(), placement)
|
||||
if err != nil {
|
||||
response.Fail(c, http.StatusInternalServerError, 50046, "home banners 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