fix: 修复租户余额响应结构及租户ID引用错误

更新 TenantSurplusResp 结构以匹配实际的嵌套 JSON 响应格式,
并修正 worker 中 billing 逻辑错误引用的租户ID变量。
This commit is contained in:
2026-07-01 19:32:52 +08:00
parent 4d95ff75d2
commit 313bb692c7
2 changed files with 6 additions and 4 deletions
+2 -2
View File
@@ -50,7 +50,7 @@ func (w *asyncWorker) handleOne(ctx context.Context, task *entity.ModelGatewayTa
w.failTask(ctx, task, startTime, "租户余额不足")
return
}
g.Log().Infof(ctx, "[handleOne] 当前余额 tenantId=%d surplus=%.2f", task.TenantId, surplus)
g.Log().Infof(ctx, "[handleOne] 当前余额 tenantId=%d surplus=%.2f", model.TenantId, surplus)
// ============================================
// 2) 调用模型
@@ -127,7 +127,7 @@ func (w *asyncWorker) handleOne(ctx context.Context, task *entity.ModelGatewayTa
task.BillingData[0] = billingResult
totalFee := gconv.Float64(billingResult["total_fee"])
if totalFee > 0 {
_ = gateway.DeductBalance(util.AsyncCtx(ctx), task.TenantId, -totalFee)
_ = gateway.DeductBalance(util.AsyncCtx(ctx), model.TenantId, -totalFee)
}
}
}