$data['number'], ]; $res = $pay->wechat->query($order); if ($res['trade_state'] == 'SUCCESS' && $res['trade_state_desc'] == '支付成功') { PayNotifyLogic::handle('cashierclass', $res['out_trade_no'], $res); }else{ throw new BusinessException('订单支付中', 200); } } // 消费失败时 public function onConsumeFailure(\Throwable $exception, $package) { // 直接更改消息队列数据结构,将最大重试次数max_attempts字段设置为0,即不再重试。 if($package['attempts'] ==$exception['max_attempts']){ $data = [ 'number' => $package['data']['number'], 'paid' => 0, ]; $find=Cashierclass::where($data)->find(); if($find){ $order = Cashierclass::update($data); if($order){ PushService::push('store_merchant_' . $order['merchant'], $order['merchant'], ['type'=>'cash_register','msg'=>'支付超时,订单已被取消,请重新提交订单']); } } } return $package; } }