diff --git a/service/task/worker.go b/service/task/worker.go index f1229c0..7ae433b 100644 --- a/service/task/worker.go +++ b/service/task/worker.go @@ -38,21 +38,19 @@ func (w *asyncWorker) handleOne(ctx context.Context, task *entity.ModelGatewayTa rawData []byte result map[string]any err error + surplus float64 ) g.Log().Infof(ctx, "[handleOne] 开始 taskId=%s model=%s", task.TaskID, task.ModelName) // ============================================ // 1) 查询余额 // ============================================ - var surplus float64 - if len(model.BillingConfig) > 0 { - surplus, _ = gateway.GetTenantSurplus(ctx, task.TenantId) - if surplus <= 0 { - w.failTask(ctx, task, startTime, "租户余额不足") - return - } - g.Log().Infof(ctx, "[handleOne] 当前余额 tenantId=%d surplus=%.2f", task.TenantId, surplus) + surplus, _ = gateway.GetTenantSurplus(ctx, task.TenantId) + if surplus <= 0 { + w.failTask(ctx, task, startTime, "租户余额不足") + return } + g.Log().Infof(ctx, "[handleOne] 当前余额 tenantId=%d surplus=%.2f", task.TenantId, surplus) // ============================================ // 2) 调用模型