auto-sync: 2026-06-05 12:00:01

This commit is contained in:
cfdaily
2026-06-05 12:00:01 +08:00
parent d7228dd004
commit 0fd44c4706
+19
View File
@@ -297,6 +297,25 @@ async def send_mail(body: Dict[str, Any]):
return result
@router.delete("")
async def delete_mail(prefix: Optional[str] = Query(None)):
"""批量删除邮件(按标题前缀匹配,status→cancelled"""
if not prefix:
raise HTTPException(400, "`prefix` 查询参数必填")
bb = _bb()
tasks = bb.list_tasks()
deleted_ids = []
for t in tasks:
if t.title and t.title.startswith(prefix):
if t.status not in ("cancelled",):
bb.update_task_status(t.id, "cancelled", agent="mail-cleanup-api")
deleted_ids.append(t.id)
return {"ok": True, "deleted_count": len(deleted_ids), "deleted_ids": deleted_ids}
@router.patch("/{mail_id}")
async def update_mail(mail_id: str, body: Dict[str, Any]):
"""更新 Mail(标记已读/已执行)"""