diff --git a/internal/biz/bo/wechat_voucher_bo.go b/internal/biz/bo/wechat_voucher_bo.go index 648f772..4817f28 100644 --- a/internal/biz/bo/wechat_voucher_bo.go +++ b/internal/biz/bo/wechat_voucher_bo.go @@ -7,7 +7,7 @@ type ConsumeInformation struct { ConsumeTime string `json:"consume_time"` ConsumeMchid string `json:"consume_mchid"` TransactionID string `json:"transaction_id"` - ConsumeAmount int64 `json:"consume_amount,omitempty"` + ConsumeAmount int64 `json:"consume_amount,omitempty"` // 核销金额,仅有当business_type=MULTIUSE时,才会返回。单位,分 } // PlainText 定义明文数据结构体 @@ -23,6 +23,7 @@ type PlainText struct { NoCash bool `json:"no_cash"` Singleitem bool `json:"singleitem"` ConsumeInformation ConsumeInformation `json:"consume_information,omitempty"` + BusinessType string `json:"business_type,omitempty"` // 枚举值 MULTIUSE:消费金,仅有当business_type=MULTIUSE时,才会返回 } type WechatVoucherNotifyBo struct { diff --git a/internal/biz/order.go b/internal/biz/order.go index 5a03016..2978cac 100644 --- a/internal/biz/order.go +++ b/internal/biz/order.go @@ -258,7 +258,7 @@ func (v *VoucherBiz) bbToWx(ctx context.Context, order *bo.OrderBo, cmbReply *v1 return v.KxMixRepo.Request(ctx, req.GetNotice()) } -func (v *VoucherBiz) wxToBB(ctx context.Context, order *bo.OrderBo, wxReq *bo.WechatVoucherNotifyBo) error { +func (v *VoucherBiz) wxToBBUse(ctx context.Context, order *bo.OrderBo, wxReq *bo.WechatVoucherNotifyBo) error { req := &kog.WechatToBBRequest{ ActivityId: order.BatchNo, diff --git a/internal/biz/wechat_notify.go b/internal/biz/wechat_notify.go index 992d9dc..a625bbf 100644 --- a/internal/biz/wechat_notify.go +++ b/internal/biz/wechat_notify.go @@ -23,24 +23,22 @@ func (v *VoucherBiz) WechatNotifyConsumer(ctx context.Context, tag string, req * if req.PlainText.Status.IsSended() { - err = v.available(ctx, order) + return v.available(ctx, order) } else if req.PlainText.Status.IsUsed() { - err = v.used(ctx, order) + if err = v.used(ctx, order); err != nil { + return err + } + return v.wxToBBUse(ctx, order, req) } else if req.PlainText.Status.IsExpired() { - err = v.expired(ctx, order) + return v.expired(ctx, order) } else { return fmt.Errorf("未知通知类型:%s", req.PlainText.Status.GetText()) } - if err != nil { - return err - } - - return v.wxToBB(ctx, order, req) }) }