feat(ECR-012–016): 合规、题库、时辰刷新、头像、MBTI OEJTS 与埋点
落地输入合规、探索题库、报告日/时辰刷新、账号头像、OEJTS 量表,并补齐 H5 埋点与 Admin 漏斗;同步 ESS 工件、切至自建 Git、清理 GitHub Actions。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
// Package explore provides the L1→L3 explore catalog.
|
||||
package explore
|
||||
|
||||
import "github.com/yuxingu/digital-psychology/apps/api/internal/repository"
|
||||
|
||||
// Item is a leaf tool in the catalog.
|
||||
type Item struct {
|
||||
Key string `json:"key"`
|
||||
@@ -22,8 +24,8 @@ type Category struct {
|
||||
Items []Item `json:"items"`
|
||||
}
|
||||
|
||||
// Catalog returns the full explore tree (deterministic, no DB).
|
||||
// Order: 四核心优先,量表后置。
|
||||
// Catalog returns the full explore tree (deterministic base; tests filled by WithPublishedScales).
|
||||
// Order: 解码 → 量表题库 → 星座 / 匹配 / 节律 …
|
||||
func Catalog() []Category {
|
||||
return []Category{
|
||||
{
|
||||
@@ -33,6 +35,11 @@ func Catalog() []Category {
|
||||
{Key: "portrait", Title: "愈心解码", Description: "生日生成性格解码报告", Path: "/portrait", Icon: "△", Tone: "gold", Badge: "热"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Key: "tests", Title: "量表题库", Description: "人格与偏好测评(已发布)",
|
||||
Icon: "◆", Tone: "blue",
|
||||
Items: defaultScaleItems(),
|
||||
},
|
||||
{
|
||||
Key: "star", Title: "星座", Description: "排盘 · 运势 · 合盘",
|
||||
Icon: "✦", Tone: "night",
|
||||
@@ -72,24 +79,56 @@ func Catalog() []Category {
|
||||
{Key: "ask", Title: "AI 成长助手", Description: "结合档案整理感受", Path: "/ask", Icon: "◎", Tone: "gold"},
|
||||
},
|
||||
},
|
||||
{
|
||||
Key: "tests", Title: "更多测评", Description: "轻量量表(次要入口)",
|
||||
Icon: "◆", Tone: "blue",
|
||||
Items: []Item{
|
||||
{Key: "mbti-lite", Title: "人格类型探索", Description: "能量与决策偏好(轻量)", Path: "/scales/mbti-lite", Icon: "◆", Tone: "blue"},
|
||||
{Key: "enneagram-lite", Title: "动机模式探索", Description: "内在动机九型向轻测", Path: "/scales/enneagram-lite", Icon: "⑨", Tone: "purple"},
|
||||
{Key: "bigfive-lite", Title: "性格五维探索", Description: "稳定特质速览", Path: "/scales/bigfive-lite", Icon: "◈", Tone: "teal"},
|
||||
{Key: "love-style", Title: "亲密互动探索", Description: "亲密关系中的互动偏好", Path: "/scales/love-style", Icon: "♡", Tone: "rose"},
|
||||
{Key: "eq-lite", Title: "情绪觉察探索", Description: "识别与调节情绪的习惯", Path: "/scales/eq-lite", Icon: "♥", Tone: "pink"},
|
||||
{Key: "stress-index", Title: "压力负荷探索", Description: "近期压力与恢复方式", Path: "/scales/stress-index", Icon: "☯", Tone: "green"},
|
||||
{Key: "career-interest", Title: "职业兴趣探索", Description: "工作动力与环境偏好", Path: "/scales/career-interest", Icon: "◎", Tone: "gold"},
|
||||
{Key: "communication-style", Title: "沟通方式探索", Description: "表达与倾听偏好", Path: "/scales/communication-style", Icon: "◆", Tone: "blue"},
|
||||
{Key: "emotion-pattern", Title: "情绪模式探索", Description: "情绪起伏与自我照顾", Path: "/scales/emotion-pattern", Icon: "♥", Tone: "pink"},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func defaultScaleItems() []Item {
|
||||
return []Item{
|
||||
{Key: "mbti-lite", Title: "MBTI测试", Description: "标准版 32 题免费 · 完整版会员", Path: "/scales/mbti-lite", Icon: "◆", Tone: "blue", Badge: "热"},
|
||||
{Key: "mbti-full", Title: "MBTI完整版", Description: "60 题 · 成长会员", Path: "/scales/mbti-full", Icon: "◆", Tone: "gold"},
|
||||
{Key: "enneagram-lite", Title: "动机模式探索", Description: "内在动机九型向轻测", Path: "/scales/enneagram-lite", Icon: "⑨", Tone: "purple"},
|
||||
{Key: "bigfive-lite", Title: "性格五维探索", Description: "稳定特质速览", Path: "/scales/bigfive-lite", Icon: "◈", Tone: "teal"},
|
||||
{Key: "love-style", Title: "亲密互动探索", Description: "亲密关系中的互动偏好", Path: "/scales/love-style", Icon: "♡", Tone: "rose"},
|
||||
{Key: "eq-lite", Title: "情绪觉察探索", Description: "识别与调节情绪的习惯", Path: "/scales/eq-lite", Icon: "♥", Tone: "pink"},
|
||||
{Key: "stress-index", Title: "压力负荷探索", Description: "近期压力与恢复方式", Path: "/scales/stress-index", Icon: "☯", Tone: "green"},
|
||||
{Key: "career-interest", Title: "职业兴趣探索", Description: "工作动力与环境偏好", Path: "/scales/career-interest", Icon: "◎", Tone: "gold"},
|
||||
{Key: "communication-style", Title: "沟通方式探索", Description: "表达与倾听偏好", Path: "/scales/communication-style", Icon: "◆", Tone: "blue"},
|
||||
{Key: "emotion-pattern", Title: "情绪模式探索", Description: "情绪起伏与自我照顾", Path: "/scales/emotion-pattern", Icon: "♥", Tone: "pink"},
|
||||
}
|
||||
}
|
||||
|
||||
// WithPublishedScales replaces the 量表题库 items with live published scales from DB.
|
||||
func WithPublishedScales(cats []Category, scales []repository.ScaleListItem) []Category {
|
||||
if len(scales) == 0 {
|
||||
return cats
|
||||
}
|
||||
items := make([]Item, 0, len(scales))
|
||||
for _, s := range scales {
|
||||
badge := ""
|
||||
tone := "blue"
|
||||
switch s.Slug {
|
||||
case "mbti-lite":
|
||||
badge = "热"
|
||||
case "mbti-full":
|
||||
tone = "gold"
|
||||
}
|
||||
items = append(items, Item{
|
||||
Key: s.Slug, Title: s.Title, Description: s.Description,
|
||||
Path: "/scales/" + s.Slug, Icon: "◆", Tone: tone, Badge: badge,
|
||||
})
|
||||
}
|
||||
out := make([]Category, len(cats))
|
||||
copy(out, cats)
|
||||
for i := range out {
|
||||
if out[i].Key == "tests" {
|
||||
out[i].Title = "量表题库"
|
||||
out[i].Description = "人格与偏好测评(已发布)"
|
||||
out[i].Items = items
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// CategoryByKey returns one category or nil.
|
||||
func CategoryByKey(key string) *Category {
|
||||
for _, c := range Catalog() {
|
||||
|
||||
Reference in New Issue
Block a user