auto-sync: 2026-05-21 00:14:36

This commit is contained in:
cfdaily
2026-05-21 00:14:36 +08:00
parent f30165f217
commit a42eea4467
+5 -1
View File
@@ -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