Files
digital-psychology/apps/api/internal/handler/home.go
T
jackyu66gitandCursor 7ab9add5dd
ci / h5 (push) Canceled after 0s
ci / api (push) Canceled after 0s
ci / ess-docs (push) Canceled after 0s
feat(ops): ECR-007 行为分析与 ECR-008 内容运营后台
落地埋点 ingest/数据看板、首页宫格 CMS 与测评上下架;含账号引导、问答流式与免责声明去重,以及 review P1 审计同事务修复。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-07 02:26:16 +08:00

35 lines
824 B
Go

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})
}