auto-sync: 2026-05-21 00:14:36
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user