fix(api): 文本回放 - 增加增量配额与生命周期清理 (#144)

Closes #144
This commit is contained in:
ddCat committed 2026-08-05 16:54:47 +08:00
1 parent 38c4f63e2e
commit 4721c1e97f
11 files changed
+389 -3

No files matched your search

+4 -1
View File
@@ -222,7 +222,7 @@ func (r *Repository) RetryTaskWithBilling(userID string, taskID string, order *m
}
updates := map[string]any{
"status": model.TaskStatusQueued, "stage": "等待队列调度", "progress": 5, "error": "", "result_json": "",
"started_at": nil, "completed_at": nil, "updated_at": time.Now(),
"text_draft": "", "started_at": nil, "completed_at": nil, "updated_at": time.Now(),
}
if order != nil {
updates["billing_order_id"] = order.ID
@@ -239,6 +239,9 @@ func (r *Repository) RetryTaskWithBilling(userID string, taskID string, order *m
if updated.RowsAffected != 1 {
return ErrTaskNotRetryable
}
if err := tx.Delete(&model.TaskTextDelta{}, "user_id = ? AND task_id = ?", userID, taskID).Error; err != nil {
return err
}
return tx.First(&task, "id = ? AND user_id = ?", taskID, userID).Error
})
return &task, err