落地输入合规、探索题库、报告日/时辰刷新、账号头像、OEJTS 量表,并补齐 H5 埋点与 Admin 漏斗;同步 ESS 工件、切至自建 Git、清理 GitHub Actions。 Co-authored-by: Cursor <cursoragent@cursor.com>
33 lines
788 B
Go
33 lines
788 B
Go
package home
|
||
|
||
import (
|
||
"time"
|
||
)
|
||
|
||
var shichenNames = [12]string{"子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥"}
|
||
|
||
// ShichenWindow is the current Chinese double-hour window.
|
||
type ShichenWindow struct {
|
||
Index int
|
||
Name string
|
||
Start time.Time
|
||
End time.Time
|
||
}
|
||
|
||
// CurrentShichen returns the 十二时辰 window for now (子时 23:00–01:00 …).
|
||
func CurrentShichen(now time.Time) ShichenWindow {
|
||
h := now.Hour()
|
||
idx := ((h + 1) % 24) / 2
|
||
startHour := (idx*2 + 23) % 24
|
||
start := time.Date(now.Year(), now.Month(), now.Day(), startHour, 0, 0, 0, now.Location())
|
||
if start.After(now) {
|
||
start = start.Add(-24 * time.Hour)
|
||
}
|
||
return ShichenWindow{
|
||
Index: idx,
|
||
Name: shichenNames[idx],
|
||
Start: start,
|
||
End: start.Add(2 * time.Hour),
|
||
}
|
||
}
|