WechatQuery
This commit is contained in:
parent
15de8ab277
commit
3362eec301
|
|
@ -34,15 +34,12 @@ func (v *VoucherBiz) WechatQuery(ctx context.Context, batchNo string) error {
|
|||
return fmt.Errorf("batchNo is empty")
|
||||
}
|
||||
|
||||
log.Infof("微信查询券订单状态,batchNo:%s", batchNo)
|
||||
start := time.Now()
|
||||
log.Warnf("微信券查询处理开始:%s,batchNo:%s", start.String(), batchNo)
|
||||
fmt.Printf("微信券查询处理开始:%s,batchNo:%s", start.String(), batchNo)
|
||||
|
||||
num := 0
|
||||
return v.OrderRepo.FinByStockIdInBatches(ctx, batchNo, func(ctx context.Context, rows []*bo.OrderBo) error {
|
||||
|
||||
if len(rows) == 0 {
|
||||
log.Infof("微信查询券订单状态,batchNo[%s],已处理[%d]单,无订单,结束执行", batchNo, num)
|
||||
return nil
|
||||
}
|
||||
err := v.OrderRepo.FinByStockIdInBatches(ctx, batchNo, func(ctx context.Context, rows []*bo.OrderBo) error {
|
||||
|
||||
for _, order := range rows {
|
||||
|
||||
|
|
@ -59,6 +56,14 @@ func (v *VoucherBiz) WechatQuery(ctx context.Context, batchNo string) error {
|
|||
return nil
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
log.Warnf("微信券查询处理耗时:%s,batchNo:%s,处理%d单", time.Now().Sub(start).String(), batchNo, num)
|
||||
fmt.Printf("微信券查询处理耗时:%s,batchNo:%s,处理%d单", time.Now().Sub(start).String(), batchNo, num)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v *VoucherBiz) wechatQuery(ctx context.Context, order *bo.OrderBo) error {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
"time"
|
||||
"voucher/internal/pkg/rdsmq"
|
||||
)
|
||||
|
||||
|
|
@ -38,15 +37,9 @@ func (s *VoucherService) Handle(ctx context.Context, batchNo string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
start := time.Now()
|
||||
fmt.Printf("微信券查询处理开始:%s,batchNo:%s", start.String(), batchNo)
|
||||
|
||||
if err := s.VoucherBiz.WechatQuery(ctx, batchNo); err != nil {
|
||||
s.logHelper.Error(err)
|
||||
}
|
||||
|
||||
log.Warnf("微信券查询处理耗时:%s,batchNo:%s", time.Now().Sub(start).String(), batchNo)
|
||||
fmt.Printf("微信券查询处理耗时:%s,batchNo:%s", time.Now().Sub(start).String(), batchNo)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue