fix(risk): align freeze countdown with latest close not stale 4h until

Pick the shortest active cooloff end and derive 1h/4h label from remaining time.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-18 20:27:13 +08:00
parent ff8caf7f8d
commit 9c778e0232
3 changed files with 38 additions and 8 deletions
+2 -1
View File
@@ -101,7 +101,8 @@ APP_TIMEZONE=Asia/Shanghai
- 共用脚本:`static/account_risk_badge.js`(实例 `/static/…`,中控 `/assets/account_risk_badge.js`
- 样式:`static/account_risk_badge.css`
- 展示格式:`4h冻结 · 3h 12m`;日冻结为距下一交易日切点剩余时间
- 时间戳按 **`APP_TIMEZONE`(默认 `Asia/Shanghai`** 计算,与实例 `app_now()` 一致;旧版 naive-as-UTC 写入的库内毫秒会自动修正
- 时间戳按 **`APP_TIMEZONE`(默认 `Asia/Shanghai`** 计算;倒计时取 `cooloff_until_ms``last_close + cooloff_hours` 中**更短且未过期**的时间,避免复盘缩短为 1h 后仍显示旧 4h 倒计时
- 1h / 4h 标签按**实际剩余时长**判断,不再单独依赖可能过期的 `cooloff_hours` 字段
## 相关代码