chore(ECR-001,ECR-003): 关闭结构对齐并清理 outlook JSON 旧键

正式关闭 ECR-001/002;删除 fortune 双写与 lucky 字段,H5 改读 outlook/boost。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
jackyu66git
2026-08-05 20:39:34 +08:00
co-authored by Cursor
parent 69fa1b85d6
commit 67701d1f7b
22 changed files with 286 additions and 133 deletions
+11 -11
View File
@@ -9,7 +9,7 @@ import (
"github.com/yuxingu/digital-psychology/apps/api/internal/star/natal"
)
// Period is one fortune block.
// Period is one outlook block (daily…lifetime).
type Period struct {
Key string `json:"key"`
Title string `json:"title"`
@@ -17,7 +17,7 @@ type Period struct {
Label string `json:"label"`
Dims map[string]int `json:"dims"`
Tip string `json:"tip"`
Lucky string `json:"lucky"`
Boost string `json:"boost"` // soft accent tip (was lucky; ECR-003)
Caution string `json:"caution"`
Focus string `json:"focus"`
}
@@ -40,7 +40,7 @@ type Bundle struct {
Transits []Transit `json:"transits"`
}
// Build returns fortune for natal chart as of asOf (date matters).
// Build returns period outlook for natal chart as of asOf (date matters).
func Build(chart natal.Chart, asOf time.Time) Bundle {
if asOf.IsZero() {
asOf = time.Now()
@@ -118,7 +118,7 @@ func lifetime(chart natal.Chart) Period {
"money": 48 + (seed*5)%42, "mood": 55 + (seed*7)%35,
},
Tip: tip, Focus: "人生阶段",
Lucky: "长期复盘 · 边界清晰",
Boost: "长期复盘 · 边界清晰",
Caution: "避免把阶段标签当成宿命;可调整节奏与选择。",
}
}
@@ -197,7 +197,7 @@ func period(key, title string, seed int, sun, moon float64, chart natal.Chart, f
"love": love, "career": career, "money": money, "mood": mood,
},
Tip: tips[i], Focus: focuses[i%len(focuses)],
Lucky: luckyFrom(seed),
Boost: boostFrom(seed),
Caution: cautionFrom(seed, chart),
}
}
@@ -205,19 +205,19 @@ func period(key, title string, seed int, sun, moon float64, chart natal.Chart, f
func scoreLabel(s int) string {
switch {
case s >= 85:
return "大吉"
return "高能"
case s >= 75:
return ""
return "顺畅"
case s >= 65:
return "中平偏吉"
return "偏顺"
case s >= 55:
return "平稳"
default:
return "需谨慎"
return "宜缓行"
}
}
func luckyFrom(seed int) string {
func boostFrom(seed int) string {
colors := []string{"红色", "金色", "蓝色", "绿色", "紫色", "白色"}
nums := []string{"3", "6", "7", "8", "9"}
return colors[seed%len(colors)] + " · 数字 " + nums[seed%len(nums)]
@@ -256,6 +256,6 @@ func (b Bundle) AsMap() map[string]any {
func periodMap(p Period) map[string]any {
return map[string]any{
"key": p.Key, "title": p.Title, "score": p.Score, "label": p.Label,
"dims": p.Dims, "tip": p.Tip, "lucky": p.Lucky, "caution": p.Caution, "focus": p.Focus,
"dims": p.Dims, "tip": p.Tip, "boost": p.Boost, "caution": p.Caution, "focus": p.Focus,
}
}