feat(ops): ECR-007 行为分析与 ECR-008 内容运营后台
落地埋点 ingest/数据看板、首页宫格 CMS 与测评上下架;含账号引导、问答流式与免责声明去重,以及 review P1 审计同事务修复。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"github.com/yuxingu/digital-psychology/apps/api/internal/repository"
|
||||
"github.com/yuxingu/digital-psychology/apps/api/internal/service/home"
|
||||
"github.com/yuxingu/digital-psychology/apps/api/pkg/response"
|
||||
)
|
||||
|
||||
// HomeHandler serves GET /api/v1/home/* (DeviceAuth).
|
||||
type HomeHandler struct {
|
||||
Svc *home.Service
|
||||
}
|
||||
|
||||
// Register mounts home routes.
|
||||
func (h *HomeHandler) Register(api *gin.RouterGroup) {
|
||||
g := api.Group("/home")
|
||||
g.GET("/tools", h.Tools)
|
||||
}
|
||||
|
||||
func (h *HomeHandler) Tools(c *gin.Context) {
|
||||
items, err := h.Svc.ListPublic(c.Request.Context())
|
||||
if err != nil {
|
||||
response.Fail(c, http.StatusInternalServerError, 50030, "home tools failed")
|
||||
return
|
||||
}
|
||||
if items == nil {
|
||||
items = []repository.HomeTool{}
|
||||
}
|
||||
response.OK(c, gin.H{"items": items})
|
||||
}
|
||||
Reference in New Issue
Block a user