|
@@ -51,6 +51,8 @@ class AsyncOrderStats implements ShouldQueue
|
|
|
$this->bookChargeStats();
|
|
|
//订单上报给渠道
|
|
|
$this->reportToChannel();
|
|
|
+
|
|
|
+ $this->fireOrderReport();
|
|
|
}
|
|
|
|
|
|
private function init()
|
|
@@ -133,4 +135,53 @@ class AsyncOrderStats implements ShouldQueue
|
|
|
]);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ private function fireOrderReport(){
|
|
|
+ if ($this->order_info->status != 'PAID') return;
|
|
|
+ $client = new Client();
|
|
|
+ $reportData = [
|
|
|
+ 'platform' => 'wangduyun',
|
|
|
+ 'order' => [
|
|
|
+ 'uid' => getProp($this->order_info, 'uid'),
|
|
|
+ 'order_no' => getProp($this->order_info, 'trade_no'),
|
|
|
+ 'price' => getProp($this->order_info, 'price'),
|
|
|
+ 'channel_id' => getProp($this->order_info, 'distribution_channel_id'),
|
|
|
+ 'pay_time' => getProp($this->order_info, 'pay_end_at'),
|
|
|
+ 'order_created_at' => $this->order_info->created_at->format('Y-m-d H:i:s'),
|
|
|
+ 'order_type'=> getProp($this->order_info, 'order_type'),
|
|
|
+ 'from_bid'=> getProp($this->order_info, 'from_bid'),
|
|
|
+ 'pay_type'=> getProp($this->order_info, 'pay_type')
|
|
|
+ ]
|
|
|
+ ];
|
|
|
+ $record = [
|
|
|
+ 'uid'=>$reportData['order']['uid'],
|
|
|
+ 'trade_no'=>$reportData['order']['order_no'],
|
|
|
+ 'price'=>$reportData['order']['price'],
|
|
|
+ 'distribution_channel_id'=>$reportData['order']['channel_id'],
|
|
|
+ 'pay_time'=>$reportData['order']['pay_time'],
|
|
|
+ 'msg'=>'',
|
|
|
+ 'status'=>0,
|
|
|
+ 'created_at'=>date('Y-m-d H:i:s'),
|
|
|
+ 'updated_at'=>date('Y-m-d H:i:s'),
|
|
|
+ ];
|
|
|
+ $host = 'https://firetrack.wd.amanbook.com';
|
|
|
+ try{
|
|
|
+ // 执行上报
|
|
|
+ $result = $client->post($host . '/api/reportOrder', [
|
|
|
+ 'headers' => [
|
|
|
+ 'x-code' => 'Mvnx1Yr3O8i!TS5u'
|
|
|
+ ],
|
|
|
+ 'json' => $reportData
|
|
|
+ ]);
|
|
|
+ $record['msg'] = $result->getBody()->getContents();
|
|
|
+ $record['status'] = 1;
|
|
|
+ }catch (\Exception $e){
|
|
|
+ $record['status'] = 2;
|
|
|
+ $record['msg'] = '';
|
|
|
+ }
|
|
|
+ try{
|
|
|
+ DB::table('fire_order_report_record')->insert($record);
|
|
|
+ }catch (\Exception $e){}
|
|
|
+ }
|
|
|
+
|
|
|
}
|