多笔立减金
This commit is contained in:
parent
a7a2fb88ed
commit
b841ad3661
|
|
@ -7,6 +7,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/go-kratos/kratos/v2/log"
|
"github.com/go-kratos/kratos/v2/log"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
err2 "voucher/api/err"
|
err2 "voucher/api/err"
|
||||||
v1 "voucher/api/v1"
|
v1 "voucher/api/v1"
|
||||||
|
|
@ -186,12 +188,29 @@ 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 {
|
func (biz *MultiBiz) run(ctx context.Context, req *bo.WechatVoucherNotifyBo, mnd *bo.MultiNotifyDataBo, order *bo.OrderBo) error {
|
||||||
|
|
||||||
if req.PlainText.Status.IsUsed() {
|
if req.PlainText.Status.IsUsed() {
|
||||||
|
|
||||||
if order.Status.IsUse() {
|
if order.Status.IsUse() {
|
||||||
if err := biz.OrderRepo.MultiOverUsed(ctx, order.ID, req.PlainText.ConsumeInformation.ConsumeTime, "再次核销完成"); err != nil {
|
|
||||||
|
parts := strings.Split(order.Remark, "_")
|
||||||
|
l := len(parts)
|
||||||
|
|
||||||
|
remark := "核销完成_"
|
||||||
|
if l == 1 {
|
||||||
|
remark = "核销完成_2"
|
||||||
|
}
|
||||||
|
if l == 2 {
|
||||||
|
i, err := strconv.Atoi(parts[1])
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("订单再次核销完成修改发生错误 error: %v", err)
|
||||||
|
}
|
||||||
|
remark = fmt.Sprintf("核销完成_%d", i+1)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := biz.OrderRepo.MultiOverUsed(ctx, order.ID, req.PlainText.ConsumeInformation.ConsumeTime, remark); err != nil {
|
||||||
return fmt.Errorf("订单再次核销完成修改发生错误 error: %v", err)
|
return fmt.Errorf("订单再次核销完成修改发生错误 error: %v", err)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if err := biz.OrderRepo.MultiOverUsed(ctx, order.ID, req.PlainText.ConsumeInformation.ConsumeTime, "核销完成"); err != nil {
|
if err := biz.OrderRepo.MultiOverUsed(ctx, order.ID, req.PlainText.ConsumeInformation.ConsumeTime, "核销完成_1"); err != nil {
|
||||||
return fmt.Errorf("订单核销完成修改发生错误 error: %v", err)
|
return fmt.Errorf("订单核销完成修改发生错误 error: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue