46 lines
890 B
Go
46 lines
890 B
Go
package biz
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"voucher/internal/biz/bo"
|
|
"voucher/internal/biz/vo"
|
|
)
|
|
|
|
func (this *VoucherBiz) OrderRetry(ctx context.Context, outBizNos []string) error {
|
|
|
|
if len(outBizNos) > 0 {
|
|
|
|
for _, outBizNo := range outBizNos {
|
|
|
|
order, err := this.OrderRepo.GetByOutBizNo(ctx, vo.OrderTypeCmb, outBizNo)
|
|
if err != nil {
|
|
return fmt.Errorf(fmt.Sprintf("获取订单%s异常:%v", outBizNo, err))
|
|
}
|
|
|
|
if !order.Status.IsIng() {
|
|
return fmt.Errorf(fmt.Sprintf("订单%s状态异常:%s", order.OrderNo, order.Status))
|
|
}
|
|
|
|
if err4 := this.orderRetry(ctx, order); err4 != nil {
|
|
return err4
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
return this.OrderRepo.FindIngInBatches(ctx, func(ctx context.Context, rows []*bo.OrderBo) error {
|
|
|
|
for _, order := range rows {
|
|
|
|
if err4 := this.orderRetry(ctx, order); err4 != nil {
|
|
return err4
|
|
}
|
|
}
|
|
|
|
return nil
|
|
})
|
|
|
|
}
|