diff --git a/scripts/cron_to_xmpp.py b/scripts/cron_to_xmpp.py index e32acf1e..2365193b 100644 --- a/scripts/cron_to_xmpp.py +++ b/scripts/cron_to_xmpp.py @@ -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)