fix:修复因数据库缺少 working_hours 列导致 ROI 配置失败的问题。

- 手动执行 SQL:ALTER TABLE rois ADD COLUMN working_hours TEXT
- 确保现有 SQLite 数据库(security_monitor.db)结构与模型定义一致
- 避免因字段缺失引发 API 或算法读取异常
This commit is contained in:
2026-01-22 16:44:26 +08:00
parent 123903950b
commit cb46d12cfa
8 changed files with 127 additions and 10 deletions

View File

@@ -293,11 +293,12 @@ class AlgorithmManager:
algo_params.update(params)
if algorithm_type == "leave_post":
roi_working_hours = algo_params.get("working_hours") or self.working_hours
self.algorithms[roi_id]["leave_post"] = LeavePostAlgorithm(
threshold_sec=algo_params.get("threshold_sec", 300),
confirm_sec=algo_params.get("confirm_sec", 10),
return_sec=algo_params.get("return_sec", 30),
working_hours=self.working_hours,
working_hours=roi_working_hours,
)
elif algorithm_type == "intrusion":
self.algorithms[roi_id]["intrusion"] = IntrusionAlgorithm(