多笔立减

This commit is contained in:
ziming 2025-08-11 11:37:43 +08:00
parent 4a65fa66c0
commit 355340e1c5
2 changed files with 10 additions and 18 deletions

View File

@ -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 := "# <font color='green'>" +
"<h1>立减金发放报警通知</h1>" +
"</font> \n" +
"<font color='black'>" +
"券领取发生异常了" +
"[<font color='red'>%s</font>]" +
"</font>"
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
// 警示信息(简化版)

View File

@ -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 // 过滤调该类型错误通知
}