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,58 @@
|
||||
// Package companion provides solar-term tips and mood helpers.
|
||||
package companion
|
||||
|
||||
import "time"
|
||||
|
||||
// SolarTerm is today's life tip (not fortune).
|
||||
type SolarTerm struct {
|
||||
Name string `json:"name"`
|
||||
Tip string `json:"tip"`
|
||||
Date string `json:"date"`
|
||||
}
|
||||
|
||||
var terms = []struct {
|
||||
Start int
|
||||
Name string
|
||||
Tip string
|
||||
}{
|
||||
{1, "小寒", "天冷宜温补作息,少熬夜,给身心留一点缓冲。"},
|
||||
{15, "大寒", "注意保暖与情绪稳定,适合整理这一年想放下的事。"},
|
||||
{32, "立春", "万物复苏,适合定一个小而清晰的成长目标。"},
|
||||
{47, "雨水", "润物无声,试试每天记录一件让你安心的小事。"},
|
||||
{62, "惊蛰", "能量回升,适合重启被搁置的习惯,别一次做太多。"},
|
||||
{77, "春分", "昼夜均衡,留意工作与休息的平衡,沟通也留余地。"},
|
||||
{92, "清明", "适合回顾与告别,把情绪说给信任的人或写下来。"},
|
||||
{107, "谷雨", "播种季,把计划拆成可完成的一步即可。"},
|
||||
{122, "立夏", "心气易浮,留出安静时段,喝水、慢走都有帮助。"},
|
||||
{137, "小满", "不必求满,进度到八成就值得肯定自己。"},
|
||||
{152, "芒种", "忙碌中记得停一下,问自己:此刻最需要什么?"},
|
||||
{167, "夏至", "白昼最长,保护睡眠,午后可短暂休息恢复专注。"},
|
||||
{183, "小暑", "炎热易烦躁,沟通前先降温自己的情绪。"},
|
||||
{198, "大暑", "宜清淡饮食与适度运动,别用透支换效率。"},
|
||||
{213, "立秋", "开始收敛节奏,复盘上半年,调整下阶段重心。"},
|
||||
{228, "处暑", "暑气渐消,适合温和地恢复规律作息。"},
|
||||
{243, "白露", "早晚温差大,关照身体的同时关照情绪波动。"},
|
||||
{258, "秋分", "又一次平衡点,整理关系与边界,轻装前行。"},
|
||||
{273, "寒露", "宜保暖与内观,少责备自己,多一点耐心。"},
|
||||
{288, "霜降", "适合沉淀,读一点喜欢的内容,给心灵加温。"},
|
||||
{303, "立冬", "进入收藏季,减少无效社交消耗,守护精力。"},
|
||||
{318, "小雪", "天寒宜静,可用书写梳理焦虑与期待。"},
|
||||
{333, "大雪", "慢下来也是前进,允许自己休息而不内疚。"},
|
||||
{348, "冬至", "一阳初生,适合与亲近的人连结,表达感谢。"},
|
||||
}
|
||||
|
||||
// TodaySolar returns approximate solar term by day-of-year (not ephemeris).
|
||||
func TodaySolar(now time.Time) SolarTerm {
|
||||
doy := now.YearDay()
|
||||
cur := terms[0]
|
||||
for _, t := range terms {
|
||||
if doy >= t.Start {
|
||||
cur = t
|
||||
}
|
||||
}
|
||||
return SolarTerm{
|
||||
Name: cur.Name,
|
||||
Tip: cur.Tip,
|
||||
Date: now.Format("2006-01-02"),
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package companion
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestTodaySolar(t *testing.T) {
|
||||
term := TodaySolar(time.Date(2026, 8, 2, 12, 0, 0, 0, time.UTC))
|
||||
if term.Name == "" || term.Tip == "" {
|
||||
t.Fatalf("empty term: %#v", term)
|
||||
}
|
||||
blob := term.Name + term.Tip
|
||||
for _, bad := range []string{"算命", "占卜"} {
|
||||
if strings.Contains(blob, bad) {
|
||||
t.Fatalf("forbidden %q", bad)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user