log
This commit is contained in:
parent
abc720f88b
commit
5c2253cf92
|
|
@ -138,7 +138,7 @@ func (v *VoucherBiz) ExecuteNotice(ctx context.Context, req *bo.FindInBatchesUse
|
|||
for _, order := range rows {
|
||||
|
||||
num += 1
|
||||
if err := v.orderNotice(ctx, order, ¬ifyNum); err != nil {
|
||||
if err := v.notice(ctx, order, ¬ifyNum); err != nil {
|
||||
log.Errorf("订单定时通知,err:%v", err)
|
||||
}
|
||||
|
||||
|
|
@ -158,7 +158,8 @@ func (v *VoucherBiz) ExecuteNotice(ctx context.Context, req *bo.FindInBatchesUse
|
|||
return err
|
||||
}
|
||||
|
||||
func (v *VoucherBiz) orderNotice(ctx context.Context, order *bo.OrderBo, notifyNum *int) (respErr error) {
|
||||
func (v *VoucherBiz) notice(ctx context.Context, order *bo.OrderBo, notifyNum *int) (respErr error) {
|
||||
// 批量通知不做数据存储,量会很大
|
||||
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
|
|
@ -167,15 +168,9 @@ func (v *VoucherBiz) orderNotice(ctx context.Context, order *bo.OrderBo, notifyN
|
|||
}()
|
||||
|
||||
if order == nil {
|
||||
return fmt.Errorf("订单对象为 nil")
|
||||
return fmt.Errorf("order is nil")
|
||||
}
|
||||
|
||||
return v.notice(ctx, order, notifyNum)
|
||||
}
|
||||
|
||||
func (v *VoucherBiz) notice(ctx context.Context, order *bo.OrderBo, notifyNum *int) error {
|
||||
// 批量通知不做数据存储,量会很大
|
||||
|
||||
status, err := v.WechatCpnRepo.Query(ctx, order)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
@ -198,14 +193,20 @@ func (v *VoucherBiz) notice(ctx context.Context, order *bo.OrderBo, notifyNum *i
|
|||
Type: order.Type,
|
||||
}
|
||||
|
||||
if err = v.request(ctx, order, notify, notifyNum); err != nil {
|
||||
if err = v.request(ctx, order, notify); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return v.UpdateOrderStatus(ctx, order.ID, status)
|
||||
if err = v.UpdateOrderStatus(ctx, order.ID, status); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
func (v *VoucherBiz) request(ctx context.Context, order *bo.OrderBo, notify *bo.OrderNotifyBo, notifyNum *int) (respErr error) {
|
||||
*notifyNum += 1
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v *VoucherBiz) request(ctx context.Context, order *bo.OrderBo, notify *bo.OrderNotifyBo) (respErr error) {
|
||||
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
|
|
@ -213,6 +214,10 @@ func (v *VoucherBiz) request(ctx context.Context, order *bo.OrderBo, notify *bo.
|
|||
}
|
||||
}()
|
||||
|
||||
if notify == nil {
|
||||
return fmt.Errorf("notify is nil")
|
||||
}
|
||||
|
||||
if !notify.Event.CanNotify() {
|
||||
return nil // 不可通知,忽略
|
||||
}
|
||||
|
|
@ -230,7 +235,5 @@ func (v *VoucherBiz) request(ctx context.Context, order *bo.OrderBo, notify *bo.
|
|||
return fmt.Errorf("orderNo:%s,outBizNo:%s,stockId:%s,err:%s", order.OrderNo, order.OutBizNo, order.BatchNo, err.Error())
|
||||
}
|
||||
|
||||
*notifyNum += 1
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue