From a42eea4467d1efcae8a8ba109b7e864d4c082bff Mon Sep 17 00:00:00 2001 From: cfdaily Date: Thu, 21 May 2026 00:14:36 +0800 Subject: [PATCH] auto-sync: 2026-05-21 00:14:36 --- src/api/blackboard_routes.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/api/blackboard_routes.py b/src/api/blackboard_routes.py index 96660a0..0698584 100644 --- a/src/api/blackboard_routes.py +++ b/src/api/blackboard_routes.py @@ -74,11 +74,15 @@ async def create_task(project_id: str, body: Dict[str, Any]): prefix = re.sub(r'[^a-z0-9]', '-', project_id.lower()).strip('-')[:20] date_str = datetime.now().strftime('%Y%m%d') # seq: 查当前项目最大 seq + import sqlite3 + db_path = get_data_root() / project_id / "blackboard.db" try: - max_id_row = bb._conn.execute( + conn = sqlite3.connect(str(db_path), timeout=5) + max_id_row = conn.execute( "SELECT id FROM tasks WHERE id LIKE ? ORDER BY id DESC LIMIT 1", (f"{prefix}-{date_str}-%",) ).fetchone() + conn.close() seq = int(max_id_row[0].split('-')[-1]) + 1 if max_id_row else 1 except Exception: seq = 1