fix: 每日汇总只发一次(16:35)+加sent标记防重复

This commit is contained in:
知微
2026-07-10 17:05:29 +08:00
parent e2f02ad023
commit ea139b05b0
+5 -3
View File
@@ -335,17 +335,19 @@ def scan():
today = datetime.now().strftime("%Y-%m-%d")
stats = load_silent_stats()
if stats.get("date") != today:
stats = {"date": today, "silent": 0, "short": 0, "script": 0}
stats = {"date": today, "silent": 0, "short": 0, "script": 0, "sent": False}
stats["silent"] += n_silent
stats["short"] += n_short
stats["script"] += n_script
save_silent_stats(stats)
# 16:30~16:35 发送当日汇总(收盘后
# 收盘后16:35发送一次当日汇总(不重复发
now = datetime.now()
hhmm = now.hour * 60 + now.minute
if 990 <= hhmm <= 995: # 16:30~16:35
if hhmm == 995 and not stats.get("sent"): # 16:35,仅一次
send_silent_summary(stats)
stats["sent"] = True
save_silent_stats(stats)
log = f"推送{n_pushed}份,静默拦截{n_silent}份,过短{n_short}份,跳过脚本{n_script}"
print(log, file=sys.stderr)