From 274404862352f22f5fd28f7f9e1cfa01c5534b2b Mon Sep 17 00:00:00 2001 From: feitianbubu Date: Mon, 6 Jul 2026 09:05:06 +0800 Subject: [PATCH 1/2] fix: apply default ali video duration when value is non-positive --- relay/channel/task/ali/adaptor.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/relay/channel/task/ali/adaptor.go b/relay/channel/task/ali/adaptor.go index f364547231bb..2b85c4357ef0 100644 --- a/relay/channel/task/ali/adaptor.go +++ b/relay/channel/task/ali/adaptor.go @@ -415,7 +415,8 @@ func (a *TaskAdaptor) convertToAliRequest(info *relaycommon.RelayInfo, req relay } else { aliReq.Parameters.Duration = seconds } - } else { + } + if aliReq.Parameters.Duration <= 0 { aliReq.Parameters.Duration = 5 // 默认5秒 } From 9c028452a68786099f6b1c9539b703f815f56812 Mon Sep 17 00:00:00 2001 From: feitianbubu Date: Mon, 6 Jul 2026 09:18:35 +0800 Subject: [PATCH 2/2] fix: persist task quota after async settlement --- model/task.go | 4 ++++ service/task_billing.go | 3 +++ 2 files changed, 7 insertions(+) diff --git a/model/task.go b/model/task.go index 9c0cb6dd7bd5..cf936ed1f967 100644 --- a/model/task.go +++ b/model/task.go @@ -417,6 +417,10 @@ func (Task *Task) Update() error { return err } +func (t *Task) UpdateQuota() error { + return DB.Model(t).Update("quota", t.Quota).Error +} + // UpdateWithStatus performs a conditional UPDATE guarded by fromStatus (CAS). // Returns (true, nil) if this caller won the update, (false, nil) if // another process already moved the task out of fromStatus. diff --git a/service/task_billing.go b/service/task_billing.go index 31e29e32eeef..785a8675632e 100644 --- a/service/task_billing.go +++ b/service/task_billing.go @@ -215,6 +215,9 @@ func RecalculateTaskQuota(ctx context.Context, task *model.Task, actualQuota int taskAdjustTokenQuota(ctx, task, quotaDelta) task.Quota = actualQuota + if err := task.UpdateQuota(); err != nil { + logger.LogError(ctx, fmt.Sprintf("差额结算回写 quota 失败 task %s: %s", task.TaskID, err.Error())) + } var logType int var logQuota int