This commit is contained in:
parent
f4872bfe74
commit
4de408c547
|
|
@ -34,7 +34,27 @@ func (v *VoucherBiz) WechatNotifyConsumer(ctx context.Context, tag string, req *
|
|||
return err
|
||||
}
|
||||
|
||||
if req.PlainText.ConsumeInformation.ConsumeTime != "" {
|
||||
if err = v.useLog(ctx, order, req); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return v.wxToBBUse(ctx, order, req)
|
||||
|
||||
} else if req.PlainText.Status.IsExpired() {
|
||||
|
||||
return v.expired(ctx, order)
|
||||
} else {
|
||||
return fmt.Errorf("未知通知类型:%s", req.PlainText.Status.GetText())
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
func (v *VoucherBiz) useLog(ctx context.Context, order *bo.OrderBo, req *bo.WechatVoucherNotifyBo) error {
|
||||
|
||||
if req.PlainText.ConsumeInformation.ConsumeTime == "" {
|
||||
return nil
|
||||
}
|
||||
|
||||
useTime, err2 := time.Parse(time.RFC3339, req.PlainText.ConsumeInformation.ConsumeTime)
|
||||
if err2 != nil {
|
||||
|
|
@ -48,7 +68,7 @@ func (v *VoucherBiz) WechatNotifyConsumer(ctx context.Context, tag string, req *
|
|||
}
|
||||
|
||||
if useLog == nil {
|
||||
_, err = v.UseLogRepo.Create(ctx, &bo.UseLogBo{
|
||||
_, err := v.UseLogRepo.Create(ctx, &bo.UseLogBo{
|
||||
OrderNo: order.OrderNo,
|
||||
Amount: req.PlainText.ConsumeInformation.ConsumeAmount,
|
||||
Type: vo.UseLogTypeUsed,
|
||||
|
|
@ -58,18 +78,8 @@ func (v *VoucherBiz) WechatNotifyConsumer(ctx context.Context, tag string, req *
|
|||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return v.wxToBBUse(ctx, order, req)
|
||||
|
||||
} else if req.PlainText.Status.IsExpired() {
|
||||
|
||||
return v.expired(ctx, order)
|
||||
} else {
|
||||
return fmt.Errorf("未知通知类型:%s", req.PlainText.Status.GetText())
|
||||
}
|
||||
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v *VoucherBiz) used(ctx context.Context, order *bo.OrderBo) error {
|
||||
|
|
|
|||
Loading…
Reference in New Issue