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: