From 53be552be1a9fc8f55378ec143463141c1a45ff3 Mon Sep 17 00:00:00 2001 From: SXP-Simon Date: Thu, 5 Feb 2026 21:51:59 +0800 Subject: [PATCH] =?UTF-8?q?fix(AutoScheduler):=20=E5=A2=9E=E5=BC=BA?= =?UTF-8?q?=E6=80=A7=E5=A4=84=E7=90=86=EF=BC=8C=E4=BF=9D=E6=8C=81=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E5=81=A5=E5=A3=AE=E6=80=A7=EF=BC=8C=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=8F=8B=E5=A5=BD=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _conf_schema.json | 2 +- src/scheduler/auto_scheduler.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/_conf_schema.json b/_conf_schema.json index 448b63e..68ba4b9 100644 --- a/_conf_schema.json +++ b/_conf_schema.json @@ -37,7 +37,7 @@ "type": "list", "description": "自动分析时间列表", "default": ["09:00"], - "hint": "每日自动分析的时间点列表,格式HH:MM,支持多个时间点", + "hint": "每日自动分析的时间点列表,格式HH:MM(例如 23:00 ),支持多个时间点", "items": { "type": "string" } diff --git a/src/scheduler/auto_scheduler.py b/src/scheduler/auto_scheduler.py index a166791..22ac8a1 100644 --- a/src/scheduler/auto_scheduler.py +++ b/src/scheduler/auto_scheduler.py @@ -157,6 +157,9 @@ class AutoScheduler: target_times = [] for t_str in time_config: try: + # 预处理:替换中文冒号,去除首尾空格 + t_str = str(t_str).replace(":", ":").strip() + t = datetime.strptime(t_str, "%H:%M").replace( year=now.year, month=now.month, @@ -166,7 +169,9 @@ class AutoScheduler: ) target_times.append(t) except ValueError: - logger.error(f"时间格式错误: {t_str}, 应为 HH:MM") + logger.error( + f"时间格式错误: {t_str}, 应为 HH:MM 格式,例如 23:00" + ) continue if not target_times: