order = $order; $this->goodsService = app('Service\GoodsService'); } /** * Execute the job. * * @return void */ public function handle() { $goodInfo = $this->goodsService->detail($this->order->goods_id); // 判断是否有配置支付回调 if(empty($goodInfo->api_hook)){ return; } $postdata = [ 'title' => $this->order->title, 'order_sn' => $this->order->order_sn, 'email' => $this->order->email, 'actual_price' => $this->order->actual_price, 'order_info' => $this->order->info, 'good_id' => $goodInfo->id, 'gd_name' => $goodInfo->gd_name ]; $opts = [ 'http' => [ 'method' => 'POST', 'header' => 'Content-type: application/json', 'content' => json_encode($postdata,JSON_UNESCAPED_UNICODE) ] ]; $context = stream_context_create($opts); file_get_contents($goodInfo->api_hook, false, $context); } }