完善验收采集调度与截图管理

This commit is contained in:
2026-09-01 16:18:00 +08:00
parent af340206a5
commit 292bd3a126
7 changed files with 401 additions and 44 deletions

View File

@@ -377,6 +377,9 @@ def init_database() -> None:
acceptance_migrations = {
"schedule_enabled": "INTEGER NOT NULL DEFAULT 0",
"schedule_weekday": "INTEGER",
"schedule_weekdays": "TEXT",
"schedule_start_time": "TEXT NOT NULL DEFAULT '00:00'",
"schedule_end_time": "TEXT NOT NULL DEFAULT '23:59'",
"next_run_at": "TEXT",
"last_run_at": "TEXT",
"scheduled_from_task_id": "INTEGER",
@@ -387,6 +390,15 @@ def init_database() -> None:
for column, definition in acceptance_migrations.items():
if column not in acceptance_columns:
conn.execute(f"ALTER TABLE acceptance_tasks ADD COLUMN {column} {definition}")
legacy_schedules = conn.execute(
"""SELECT id,schedule_weekday FROM acceptance_tasks
WHERE schedule_weekday IS NOT NULL
AND (schedule_weekdays IS NULL OR schedule_weekdays='')"""
).fetchall()
conn.executemany(
"UPDATE acceptance_tasks SET schedule_weekdays=? WHERE id=?",
[(json.dumps([row["schedule_weekday"]]), row["id"]) for row in legacy_schedules],
)
# 将旧版本保存在 acceptance_xhs_notes.parsed_json 中的成功结果迁移到
# 全局去重的笔记业务表;任务关联仍由 acceptance_xhs_notes 保留。
legacy_rows = conn.execute(