fix(risk): stop stale 4h cooloff after 1h journal expires

Anchor last_close on journal save, ignore leftover stored until when 1h window ended, and clear expired cooloff on trading-day rollover.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-18 22:04:14 +08:00
parent 9c778e0232
commit c73944581c
3 changed files with 105 additions and 31 deletions
+2 -3
View File
@@ -98,11 +98,10 @@ APP_TIMEZONE=Asia/Shanghai
## 前端倒计时
- 共用脚本:`static/account_risk_badge.js`(实例 `/static/…`,中控 `/assets/account_risk_badge.js`
- 共用脚本:`static/account_risk_badge.js?v=2`
- 样式:`static/account_risk_badge.css`
- 展示格式:`4h冻结 · 3h 12m`;日冻结为距下一交易日切点剩余时间
- 时间戳按 **`APP_TIMEZONE`(默认 `Asia/Shanghai`** 计算;倒计时取 `cooloff_until_ms``last_close + cooloff_hours` 中**更短且未过期**的时间,避免复盘缩短为 1h 后仍显示旧 4h 倒计时
- 1h / 4h 标签按**实际剩余时长**判断,不再单独依赖可能过期的 `cooloff_hours` 字段
- 勿与交易记录列表中的历史平仓时间混淆:风控只看 `account_risk_state` 表内 **最后一次用户主动平仓** 及其复盘结果
## 相关代码