feat: 新增会话与结果管理功能及扩展字段
重构执行列表树状结构,扁平化日期节点下的输出项,新增会话列表查询、结果删除与软删除标记,引入扩展字段与模板配置,升级依赖版本。
This commit is contained in:
+14
-2
@@ -126,7 +126,13 @@ 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), model.TenantId, -totalFee)
|
||||
for attempt := 0; attempt <= maxRetry; attempt++ {
|
||||
err = gateway.DeductBalance(util.AsyncCtx(ctx), model.TenantId, -totalFee)
|
||||
if err == nil {
|
||||
break
|
||||
}
|
||||
g.Log().Warningf(ctx, "[handleOne] 扣除余额失败 taskId=%s attempt=%d/%d err=%v", task.TaskID, attempt, maxRetry, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -337,7 +343,13 @@ func (w *asyncWorker) parseAndRetry(ctx context.Context, body map[string]any, mo
|
||||
task.BillingData = append(task.BillingData, billingResult)
|
||||
totalFee := gconv.Float64(billingResult["total_fee"])
|
||||
if totalFee > 0 {
|
||||
_ = gateway.DeductBalance(util.AsyncCtx(ctx), task.TenantId, -totalFee)
|
||||
for a := 0; a <= maxRetry; a++ {
|
||||
errr := gateway.DeductBalance(util.AsyncCtx(ctx), task.TenantId, -totalFee)
|
||||
if errr == nil {
|
||||
break
|
||||
}
|
||||
g.Log().Warningf(ctx, "[handleOne] 扣除余额失败 taskId=%s attempt=%d/%d err=%v", task.TaskID, a, maxRetry, errr)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user