handlePaidNotify(function ($message, $fail) use ($app) { $this->log->event( LogLabel::PAY_NOTIFY_WXMINI, $message ); // 查询订单 $orderMain = OrderMain::query() ->where(['global_order_id' => $message['out_trade_no'], 'type' => OrderMain::ORDER_TYPE_ONLINE, 'state' => OrderMain::ORDER_STATE_UNPAY]) ->where('time', '>=', date('Y-m-d H:i:s', (time()-900))) ->first(); if (empty($orderMain)) { // 去查一下微信订单 $wxOrder = $app->order->queryByOutTradeNumber($orderMain->global_order_id); $this->log->event( LogLabel::PAY_NOTIFY_WXMINI, $wxOrder ); // return true; } }); $response->send(); } public function wxminiOffline() { $config = config('wxpay'); $app = Factory::payment($config); $app['guzzle_handler'] = CoroutineHandler::class; // 通知回调,进行业务处理 $response = $app->handlePaidNotify(function ($message, $fail) use ($app) { $this->log->event( LogLabel::PAY_NOTIFY_WXMINI, $message ); // 查询订单 $orderMain = OrderMain::query() ->where(['global_order_id' => $message['out_trade_no'], 'type' => OrderMain::ORDER_TYPE_OFFLINE, 'state' => OrderMain::ORDER_STATE_UNPAY]) ->where('time', '>=', date('Y-m-d H:i:s', (time()-900))) ->first(); if (empty($orderMain)) { // 去查一下微信订单 $wxOrder = $app->order->queryByOutTradeNumber($orderMain->global_order_id); $this->log->event( LogLabel::PAY_NOTIFY_WXMINI, $wxOrder ); // return true; } }); $response->send(); } }