通知查询检索调整
This commit is contained in:
parent
418ab72562
commit
572f8db83b
|
|
@ -12,7 +12,7 @@ import (
|
|||
"voucher/internal/pkg/lock"
|
||||
)
|
||||
|
||||
func (v *VoucherBiz) OrderNotice(ctx context.Context) error {
|
||||
func (v *VoucherBiz) Notice(ctx context.Context) error {
|
||||
|
||||
if err := v.isCanNotice(ctx); err != nil {
|
||||
return err
|
||||
|
|
@ -44,12 +44,8 @@ func (v *VoucherBiz) ExecuteNotice(ctx context.Context) error {
|
|||
|
||||
for _, order := range rows {
|
||||
|
||||
if order.Type.IsCmb() {
|
||||
|
||||
if err := v.cmbOrderNotice(ctx, order); err != nil {
|
||||
log.Errorf("招行查询券订单状态发生错误,orderNo:%s,err:%v", order.OrderNo, err)
|
||||
}
|
||||
|
||||
if err := v.notice(ctx, order); err != nil {
|
||||
log.Errorf("招行查询券订单状态发生错误,orderNo:%s,err:%v", order.OrderNo, err)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -108,8 +104,7 @@ func (v *VoucherBiz) isCanNotice(ctx context.Context) error {
|
|||
})
|
||||
}
|
||||
|
||||
func (v *VoucherBiz) cmbOrderNotice(ctx context.Context, order *bo.OrderBo) error {
|
||||
|
||||
func (v *VoucherBiz) notice(ctx context.Context, order *bo.OrderBo) error {
|
||||
// 批量通知不做数据存储,量会很大
|
||||
|
||||
status, err := v.WechatCpnRepo.Query(ctx, order)
|
||||
|
|
@ -139,6 +134,11 @@ func (v *VoucherBiz) cmbOrderNotice(ctx context.Context, order *bo.OrderBo) erro
|
|||
Type: order.Type,
|
||||
}
|
||||
|
||||
return v.cmbNotice(ctx, order, orderNotify)
|
||||
}
|
||||
|
||||
func (v *VoucherBiz) cmbNotice(ctx context.Context, order *bo.OrderBo, orderNotify *bo.OrderNotifyBo) error {
|
||||
|
||||
request, err := v.Cmb.NotifyRequest(ctx, order, orderNotify)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
@ -36,7 +36,7 @@ func (cs *CronServer) Start(ctx context.Context) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
if err := cs.VoucherService.OrderNotice(ctx); err != nil {
|
||||
if err := cs.VoucherService.CronNotice(ctx); err != nil {
|
||||
log.Error("cron order notice Start err: %v", err)
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,11 +31,11 @@ func NewVoucherService(
|
|||
}
|
||||
}
|
||||
|
||||
func (s *VoucherService) OrderNotice(ctx context.Context) error {
|
||||
func (s *VoucherService) CronNotice(ctx context.Context) error {
|
||||
|
||||
start := time.Now()
|
||||
|
||||
if err := s.VoucherBiz.OrderNotice(ctx); err != nil {
|
||||
if err := s.VoucherBiz.Notice(ctx); err != nil {
|
||||
log.Error("订单定时通知,执行失败,err: %v", err)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue