通知查询检索调整

This commit is contained in:
李子铭 2025-03-17 15:20:18 +08:00
parent 87e3b7a4ca
commit eb10f82c4c
2 changed files with 21 additions and 11 deletions

View File

@ -79,9 +79,9 @@ func (v *Cmb) bizContent(_ context.Context, order *bo.OrderBo, orderNotify *bo.O
return string(bizJsonBytes), nil
}
func (v *Cmb) NotifyRequest(ctx context.Context, order *bo.OrderBo, req *bo.OrderNotifyBo) (*v1.CmbRequest, error) {
func (v *Cmb) NotifyRequest(ctx context.Context, order *bo.OrderBo, orderNotify *bo.OrderNotifyBo) (*v1.CmbRequest, error) {
bizContent, err := v.bizContent(ctx, order, req)
bizContent, err := v.bizContent(ctx, order, orderNotify)
if err != nil {
return nil, err
}

View File

@ -108,18 +108,28 @@ func (v *VoucherBiz) isCanNotice(ctx context.Context) error {
func (v *VoucherBiz) cmbOrderNotice(ctx context.Context, order *bo.OrderBo) error {
// 批量通知不做数据存储,量可能很大很大
// 批量通知不做数据存储,量会很大
if err := v.Query(ctx, order); err != nil {
return err
}
event, err := order.Status.GetOrderNotifyEvent()
status, err := v.WechatCpnRepo.Query(ctx, order)
if err != nil {
return err
}
req := &bo.OrderNotifyBo{
if order.Status == status {
log.Warnf("notice 券状态未改变:%s忽略不处理,orderNo:%s", order.Status.GetText(), order.OrderNo)
return nil
}
if err = v.UpdateOrderStatus(ctx, order.ID, status); err != nil {
return err
}
event, err := status.GetOrderNotifyEvent()
if err != nil {
return err
}
orderNotify := &bo.OrderNotifyBo{
OrderNo: order.OrderNo,
NotifyUrl: order.NotifyUrl,
Channel: order.Channel,
@ -127,7 +137,7 @@ func (v *VoucherBiz) cmbOrderNotice(ctx context.Context, order *bo.OrderBo) erro
Type: order.Type,
}
request, err := v.Cmb.NotifyRequest(ctx, order, req)
request, err := v.Cmb.NotifyRequest(ctx, order, orderNotify)
if err != nil {
return err
}
@ -138,7 +148,7 @@ func (v *VoucherBiz) cmbOrderNotice(ctx context.Context, order *bo.OrderBo) erro
}
if reply.RespCode != vo.CmbResponseStatusSuccess.GetValue() {
return fmt.Errorf(reply.RespMsg)
return errors.New(reply.RespMsg)
}
return nil