diff --git a/internal/biz/alarm.go b/internal/biz/alarm.go index e1254bb..1fb092e 100644 --- a/internal/biz/alarm.go +++ b/internal/biz/alarm.go @@ -43,7 +43,7 @@ func (this *VoucherBiz) alarm(ctx context.Context, order *bo.OrderBo, errMsg str // 通知 title := fmt.Sprintf("券发放异常") - if err = this.DingMixRepo.SendMarkdownMessage(ctx, title, alarmText2(order, errMsg)); err != nil { + if err = this.DingMixRepo.SendMarkdownMessage(ctx, title, alarmText(order, errMsg)); err != nil { return err } @@ -55,22 +55,7 @@ func (this *VoucherBiz) alarm(ctx context.Context, order *bo.OrderBo, errMsg str }) } -func (this *VoucherBiz) alarmText(_ context.Context, order *bo.OrderBo, errMsg string) string { - - remarks := fmt.Sprintf("订单号:%s,商品编号:%s,原因:%s", order.OrderNo, order.ProductNo, errMsg) - - msg := "# " + - "

立减金发放报警通知

" + - "
\n" + - "" + - "券领取发生异常了" + - "[%s]" + - "" - - return fmt.Sprintf(msg, remarks) -} - -func alarmText2(order *bo.OrderBo, errMsg string) string { +func alarmText(order *bo.OrderBo, errMsg string) string { var card strings.Builder // 警示信息(简化版) diff --git a/internal/biz/order.go b/internal/biz/order.go index e56760c..4ef70cc 100644 --- a/internal/biz/order.go +++ b/internal/biz/order.go @@ -120,10 +120,17 @@ func (this *VoucherBiz) success(ctx context.Context, order *bo.OrderBo, voucherN func (this *VoucherBiz) fail(ctx context.Context, order *bo.OrderBo, errReq error) error { - if err := this.OrderRepo.Fail(ctx, order.ID, errReq.Error()); err != nil { + errMsg := errReq.Error() + + if err := this.OrderRepo.Fail(ctx, order.ID, errMsg); err != nil { return err } + if errMsg == `Post "https://api.mch.weixin.qq.com/v3/marketing/favor/users/oW97fjrv_ntYBPjMsaaEMRSj6TPA/coupons": EOF` { + // 微信:不同微信号,领取了很多次,自然人限领,发放频率限制,微信研发排期,后续这个错误信息应该会更新,近期没那么快同步上去 + return nil + } + if err2.IsWechatAccountFail(errReq) || err2.IsWechatUserMaxCoupons(errReq) { return nil // 过滤调该类型错误通知 }