From 1d21fc72cff6eb737c574775d869f4d282033f57 Mon Sep 17 00:00:00 2001 From: "jiaji.H" Date: Fri, 29 May 2026 11:24:43 +0800 Subject: [PATCH] =?UTF-8?q?Update=EF=BC=9A=E5=A2=9E=E5=8A=A0=E9=98=B2?= =?UTF-8?q?=E6=AD=A2=E5=9B=A0=E7=BD=91=E7=BB=9C=E6=B3=A2=E5=8A=A8=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E7=9A=84=E7=8A=B6=E6=80=81=E6=9B=B4=E6=96=B0=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/cron/task.go | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/pkg/cron/task.go b/pkg/cron/task.go index a8a18b27..57184129 100644 --- a/pkg/cron/task.go +++ b/pkg/cron/task.go @@ -293,15 +293,22 @@ func AutoManuallyConfirmWorkTask() { continue } log.Printf("扣除余额成功,作品uuid:" + req.WorkUuid) - _, err = service.CastProvider.UpdateStatus(context.Background(), &cast.UpdateStatusReq{ - WorkAction: cast.WorkActionENUM_CONFIRM, - WorkUuid: req.WorkUuid, - ConfirmRemark: req.ConfirmRemark, - CostType: resp.UsedType, - ConfirmStatus: 1, - }) - if err != nil { - log.Printf("更新作品状态失败,作品uuid:"+req.WorkUuid, zap.Error(err)) + var updateErr error + for i := 0; i < 3; i++ { + _, updateErr = service.CastProvider.UpdateStatus(context.Background(), &cast.UpdateStatusReq{ + WorkAction: cast.WorkActionENUM_CONFIRM, + WorkUuid: req.WorkUuid, + ConfirmRemark: req.ConfirmRemark, + CostType: resp.UsedType, + ConfirmStatus: 1, + }) + if updateErr == nil { + break + } + time.Sleep(time.Second * time.Duration(i+1)) // 退避重试 + } + if updateErr != nil { + log.Printf("更新作品状态失败(已重试3次),作品uuid:" + req.WorkUuid) continue } }