mock use
This commit is contained in:
parent
6a7da03a25
commit
c3901c7f94
|
|
@ -30,13 +30,7 @@ func (v *VoucherBiz) WechatNotifyConsumer(ctx context.Context, tag string, req *
|
|||
|
||||
} else if req.PlainText.Status.IsUsed() {
|
||||
|
||||
if err = v.used(ctx, order, req.PlainText.ConsumeInformation.ConsumeTime); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
_ = v.wxToBBUse(ctx, order, req)
|
||||
|
||||
return v.useLog(ctx, order, req)
|
||||
return v.used(ctx, order, req)
|
||||
|
||||
} else if req.PlainText.Status.IsExpired() {
|
||||
|
||||
|
|
@ -90,11 +84,11 @@ func (v *VoucherBiz) createUseLog(ctx context.Context, order *bo.OrderBo, req *b
|
|||
return nil
|
||||
}
|
||||
|
||||
func (v *VoucherBiz) used(ctx context.Context, order *bo.OrderBo, consumeTime string) error {
|
||||
func (v *VoucherBiz) used(ctx context.Context, order *bo.OrderBo, req *bo.WechatVoucherNotifyBo) error {
|
||||
|
||||
var usedTime time.Time
|
||||
if consumeTime != "" {
|
||||
usedTime, _ = time.Parse(time.RFC3339, consumeTime)
|
||||
if req.PlainText.ConsumeInformation.ConsumeTime != "" {
|
||||
usedTime, _ = time.Parse(time.RFC3339, req.PlainText.ConsumeInformation.ConsumeTime)
|
||||
} else {
|
||||
usedTime = time.Now()
|
||||
}
|
||||
|
|
@ -108,7 +102,17 @@ func (v *VoucherBiz) used(ctx context.Context, order *bo.OrderBo, consumeTime st
|
|||
return err
|
||||
}
|
||||
|
||||
return v.notify(ctx, order)
|
||||
if err := v.notify(ctx, order); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := v.useLog(ctx, order, req); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
_ = v.wxToBBUse(ctx, order, req)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v *VoucherBiz) available(ctx context.Context, order *bo.OrderBo) error {
|
||||
|
|
|
|||
Loading…
Reference in New Issue