orderId. "产品订单自动收货队列开始执行\n"; ProductOrderLog::saveLog($this->orderId,'产品订单自动收货队列start'); $this->setRequest(); //判断是否已发货状态且到达自动收货时间 $ProductOrder = ProductOrder::findOne([ 'id' => $this->orderId, 'is_pay' => 1, 'is_send' => 1, // 已发货 'status' => 2 //待收货 ]); if (!$ProductOrder) { echo $this->orderId. "产品订单自动收货队列-订单不存在或已确认\n"; ProductOrderLog::saveLog($this->orderId,'订单不存在或已确认'); throw new \Exception('订单不存在'); } if ($ProductOrder->order_type === 5) { $client = new \GuzzleHttp\Client(); $response = $client->post( 'https://api.xiaokang88.com/open-api/client-confirm', [ 'json' => [ 'order_id' => $this->orderId, ] ]); $body = json_decode($response->getBody()->getContents(), true); if ($body['code'] != 0) { exit($body['message']); } } $ProductOrder->status = ProductOrderEnum::CONFIRM; $ProductOrder->received_time = time(); $ProductOrder->save(); ProductOrderLog::saveLog($this->orderId,'产品订单自动收货队列end'); echo $this->orderId. "产品订单自动收货队列执行成功\n"; } catch (\Exception $exception) { ProductOrderLog::saveLog($this->orderId,'产品订单自动收货队列异常:'.$exception->getMessage().'------'.$exception->getLine()); return; } } }