This commit is contained in:
ziming 2025-05-20 17:48:45 +08:00
parent 07f15ce605
commit 0dd2d8d3d6
3 changed files with 9 additions and 10 deletions

View File

@ -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 {

View File

@ -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,

View File

@ -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)
})
}