feat(media): 作品保存恢复 - 按原任务重试交付并避免重复生成计费

This commit is contained in:
ddCat
2026-09-22 15:47:24 +08:00
parent acbb354e97
commit 48a82ded74
49 changed files with 1710 additions and 50 deletions

View File

@@ -750,7 +750,7 @@ func (s *Service) LogAPICall(log model.ApiCallLog) error {
stdlog.Printf("provider billing request id update failed: billing_order_id=%s provider_request_id=%s error=%v", log.BillingOrderID, log.ProviderRequestID, err)
}
}
if log.TaskID != "" {
if log.TaskID != "" && (log.RequestKind == "create" || log.RequestKind == "poll" || log.RequestKind == "cancel") {
stage := log.RequestKind
var nextPollAt *time.Time
if stage == "create" && log.Status == model.ApiCallStatusSucceeded && log.ProviderRequestID != "" {
@@ -798,7 +798,9 @@ func (s *Service) LogAPICall(log model.ApiCallLog) error {
}
func (s *Service) mergeVideoAPICallLog(log model.ApiCallLog) (bool, error) {
if log.Capability != "video" || (log.RequestKind != "poll" && log.RequestKind != "download") {
// Delivery is a separate outcome: a failed download must not rewrite a
// successful generation request as failed.
if log.Capability != "video" || log.RequestKind != "poll" {
return false, nil
}
if log.TaskID == "" && log.ProviderRequestID == "" {