From 890f723716646d579c4db2cfc5e5f25d65c9cd43 Mon Sep 17 00:00:00 2001 From: ziming Date: Wed, 2 Jul 2025 10:36:39 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=84=E8=AD=A622?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/biz/warning_budget.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/internal/biz/warning_budget.go b/internal/biz/warning_budget.go index 326a3b9..fad3bba 100644 --- a/internal/biz/warning_budget.go +++ b/internal/biz/warning_budget.go @@ -6,6 +6,7 @@ import ( "fmt" "github.com/go-kratos/kratos/v2/log" "github.com/wechatpay-apiv3/wechatpay-go/services/cashcoupons" + "runtime" "strconv" "strings" "time" @@ -109,7 +110,15 @@ func (this *VoucherBiz) cronWarningBudget(ctx context.Context) error { }) } -func (this *VoucherBiz) WarningBudget(ctx context.Context, product *bo.ProductBo) error { +func (this *VoucherBiz) WarningBudget(ctx context.Context, product *bo.ProductBo) (wErr error) { + + defer func() { + if err := recover(); err != nil { + _, file, line, _ := runtime.Caller(1) // 1 表示获取当前调用者的调用信息 + log.Errorf("预警查询,发生错误:req:%s,err:%v,file:%s,line:%d", product.BatchNo, err, file, line) + wErr = fmt.Errorf("预警查询,panic: %v", err) + } + }() if product.WarningBudget == 0 { return fmt.Errorf("no warning budget")