feat: P1 合盘/星座/问答与测测完整设计包及模拟器取证工具
落地 synastry/star/ask API 与 H5 页面,补齐 cece-frontend-re complete-design 证据文档,并加入 Android 模拟器截图抓取脚本。 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/explore"
|
||||
"github.com/yuxingu/digital-psychology/apps/api/pkg/response"
|
||||
)
|
||||
|
||||
// ExploreHandler serves the explore catalog.
|
||||
type ExploreHandler struct{}
|
||||
|
||||
// Register mounts explore routes.
|
||||
func (h *ExploreHandler) Register(rg *gin.RouterGroup) {
|
||||
rg.GET("/explore/catalog", h.Catalog)
|
||||
rg.GET("/explore/catalog/:key", h.Category)
|
||||
}
|
||||
|
||||
// Catalog handles GET /explore/catalog.
|
||||
func (h *ExploreHandler) Catalog(c *gin.Context) {
|
||||
response.OK(c, gin.H{"categories": explore.Catalog()})
|
||||
}
|
||||
|
||||
// Category handles GET /explore/catalog/:key.
|
||||
func (h *ExploreHandler) Category(c *gin.Context) {
|
||||
cat := explore.CategoryByKey(c.Param("key"))
|
||||
if cat == nil {
|
||||
response.Fail(c, http.StatusNotFound, 40402, "category not found")
|
||||
return
|
||||
}
|
||||
response.OK(c, cat)
|
||||
}
|
||||
Reference in New Issue
Block a user