fix(AutoScheduler): 增强性处理,保持代码健壮性,增加友好提示

This commit is contained in:
SXP-Simon
2026-02-05 21:51:59 +08:00
parent 781e4e6fe6
commit 53be552be1
2 changed files with 7 additions and 2 deletions
+1 -1
View File
@@ -37,7 +37,7 @@
"type": "list",
"description": "自动分析时间列表",
"default": ["09:00"],
"hint": "每日自动分析的时间点列表,格式HH:MM,支持多个时间点",
"hint": "每日自动分析的时间点列表,格式HH:MM(例如 23:00 ,支持多个时间点",
"items": {
"type": "string"
}
+6 -1
View File
@@ -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: