多笔立减金
This commit is contained in:
parent
90a2f6fb32
commit
a7a2fb88ed
|
|
@ -186,12 +186,18 @@ func (biz *MultiBiz) RetryRunByMultiNotifyDataId(ctx context.Context, multiNotif
|
|||
func (biz *MultiBiz) run(ctx context.Context, req *bo.WechatVoucherNotifyBo, mnd *bo.MultiNotifyDataBo, order *bo.OrderBo) error {
|
||||
|
||||
if req.PlainText.Status.IsUsed() {
|
||||
if err := biz.OrderRepo.OverUsed(ctx, order.ID, req.PlainText.ConsumeInformation.ConsumeTime); err != nil {
|
||||
return fmt.Errorf("订单使用完成修改发生错误 error: %v", err)
|
||||
if order.Status.IsUse() {
|
||||
if err := biz.OrderRepo.MultiOverUsed(ctx, order.ID, req.PlainText.ConsumeInformation.ConsumeTime, "再次核销完成"); err != nil {
|
||||
return fmt.Errorf("订单再次核销完成修改发生错误 error: %v", err)
|
||||
}
|
||||
} else {
|
||||
if err := biz.OrderRepo.MultiOverUsed(ctx, order.ID, req.PlainText.ConsumeInformation.ConsumeTime, "核销完成"); err != nil {
|
||||
return fmt.Errorf("订单核销完成修改发生错误 error: %v", err)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if err := biz.OrderRepo.LastUsed(ctx, order.ID, req.PlainText.ConsumeInformation.ConsumeTime); err != nil {
|
||||
return fmt.Errorf("订单使用修改发生错误 error: %v", err)
|
||||
if err := biz.OrderRepo.MultiLastUsed(ctx, order.ID, req.PlainText.ConsumeInformation.ConsumeTime); err != nil {
|
||||
return fmt.Errorf("订单核销修改发生错误 error: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -269,7 +275,7 @@ func (biz *MultiBiz) bizContent(nl *bo.MultiNotifyLogBo, order *bo.OrderBo) (str
|
|||
ActivityId: nl.ActivityNo, // 批次活动号
|
||||
CouponId: nl.CouponID, // 微信券券号
|
||||
AcquiredDate: order.ReceiveSuccessTime.Format("2006-01-02 15:04:05.000"), // 券领取时间
|
||||
Status: "0", // 券状态 0:可使用,1:已使用
|
||||
Status: "1", // 券状态 0:可使用,1:已使用
|
||||
TransDate: nl.ConsumeTime.Format("2006-01-02 15:04:05.000"), // 核销时间,验券时间,格式yyyy-mm-dd hh:mm:ss.sss
|
||||
TransAmount: fmt.Sprintf("%d", nl.ConsumeAmount),
|
||||
OrderId: nl.TransactionID, // 券核销支付单号
|
||||
|
|
@ -279,9 +285,9 @@ func (biz *MultiBiz) bizContent(nl *bo.MultiNotifyLogBo, order *bo.OrderBo) (str
|
|||
Ext: "",
|
||||
}
|
||||
|
||||
if nl.Status.IsUsed() {
|
||||
req.Status = "1"
|
||||
}
|
||||
//if nl.Status.IsUsed() {
|
||||
// req.Status = "1"
|
||||
//}
|
||||
|
||||
bizJsonBytes, err := json.Marshal(req)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ type OrderRepo interface {
|
|||
Fail(ctx context.Context, id uint64, remark string) error
|
||||
Used(ctx context.Context, id uint64) error
|
||||
NotifyUsed(ctx context.Context, id uint64, transactionId string) error
|
||||
LastUsed(ctx context.Context, id uint64, lastUseTime time.Time) error
|
||||
OverUsed(ctx context.Context, id uint64, lastUseTime time.Time) error
|
||||
MultiLastUsed(ctx context.Context, id uint64, lastUseTime time.Time) error
|
||||
MultiOverUsed(ctx context.Context, id uint64, lastUseTime time.Time, remark string) error
|
||||
Available(ctx context.Context, id uint64) error
|
||||
Expired(ctx context.Context, id uint64) error
|
||||
}
|
||||
|
|
|
|||
|
|
@ -453,7 +453,7 @@ func (p *OrderRepoImpl) Used(ctx context.Context, id uint64) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (p *OrderRepoImpl) LastUsed(ctx context.Context, id uint64, lastUseTime time.Time) error {
|
||||
func (p *OrderRepoImpl) MultiLastUsed(ctx context.Context, id uint64, lastUseTime time.Time) error {
|
||||
now := time.Now()
|
||||
|
||||
tx := p.DB(ctx).
|
||||
|
|
@ -473,7 +473,7 @@ func (p *OrderRepoImpl) LastUsed(ctx context.Context, id uint64, lastUseTime tim
|
|||
return nil
|
||||
}
|
||||
|
||||
func (p *OrderRepoImpl) OverUsed(ctx context.Context, id uint64, lastUseTime time.Time) error {
|
||||
func (p *OrderRepoImpl) MultiOverUsed(ctx context.Context, id uint64, lastUseTime time.Time, remark string) error {
|
||||
now := time.Now()
|
||||
|
||||
tx := p.DB(ctx).
|
||||
|
|
@ -482,7 +482,7 @@ func (p *OrderRepoImpl) OverUsed(ctx context.Context, id uint64, lastUseTime tim
|
|||
}).
|
||||
Updates(model.Order{
|
||||
Status: vo.OrderStatusUse.GetValue(),
|
||||
Remark: "核销完成",
|
||||
Remark: remark,
|
||||
LastUseTime: &lastUseTime,
|
||||
UpdateTime: &now,
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue