WechatQuery
This commit is contained in:
parent
3362eec301
commit
994e47b4d0
|
|
@ -30,10 +30,6 @@ func (v *VoucherBiz) PushWechatQuery(ctx context.Context, productNo string) erro
|
|||
|
||||
func (v *VoucherBiz) WechatQuery(ctx context.Context, batchNo string) error {
|
||||
|
||||
if batchNo == "" {
|
||||
return fmt.Errorf("batchNo is empty")
|
||||
}
|
||||
|
||||
start := time.Now()
|
||||
log.Warnf("微信券查询处理开始:%s,batchNo:%s", start.String(), batchNo)
|
||||
fmt.Printf("微信券查询处理开始:%s,batchNo:%s", start.String(), batchNo)
|
||||
|
|
@ -56,14 +52,10 @@ 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
|
||||
return err
|
||||
}
|
||||
|
||||
func (v *VoucherBiz) wechatQuery(ctx context.Context, order *bo.OrderBo) error {
|
||||
|
|
|
|||
|
|
@ -30,14 +30,12 @@ func (v *VoucherBiz) PushWechatRetry(ctx context.Context, productNo string) erro
|
|||
|
||||
func (v *VoucherBiz) WechatRetry(ctx context.Context, batchNo string) error {
|
||||
|
||||
if batchNo == "" {
|
||||
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.FinFailByStockIdInBatches(ctx, batchNo, func(ctx context.Context, rows []*bo.OrderBo) error {
|
||||
err := v.OrderRepo.FinFailByStockIdInBatches(ctx, batchNo, func(ctx context.Context, rows []*bo.OrderBo) error {
|
||||
|
||||
if len(rows) == 0 {
|
||||
log.Infof("微信查询券订单状态,batchNo[%s],已处理[%d]单,无订单,结束执行", batchNo, num)
|
||||
|
|
@ -59,4 +57,8 @@ func (v *VoucherBiz) WechatRetry(ctx context.Context, batchNo string) error {
|
|||
return nil
|
||||
})
|
||||
|
||||
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 err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ func (s *VoucherService) GetConfig() *rdsmq.ConsumeConfig {
|
|||
func (s *VoucherService) Handle(ctx context.Context, batchNo string) error {
|
||||
|
||||
if batchNo == "" {
|
||||
s.logHelper.Errorf("RdsMQ keySend error: batchNo is empty")
|
||||
s.logHelper.Errorf("wechat query error: batchNo is empty")
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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) HandleWechat(ctx context.Context, batchNo string) error
|
|||
return nil
|
||||
}
|
||||
|
||||
start := time.Now()
|
||||
fmt.Printf("失败订单重试处理开始:%s,batchNo:%s", start.String(), batchNo)
|
||||
|
||||
if err := s.VoucherBiz.WechatRetry(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