|
@@ -85,17 +85,22 @@ class ReportService
|
|
|
|
|
|
/**
|
|
|
* @param $order
|
|
|
- * @return ResponseInterface
|
|
|
+ * @return false|ResponseInterface
|
|
|
*/
|
|
|
public static function reportRecharge($order)
|
|
|
{
|
|
|
+ $channelId = getProp($order, 'distribution_channel_id');
|
|
|
+ if (empty($channelId)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
return self::report('/api/reportOrder', [
|
|
|
'platform' => 'zhuishuyun',
|
|
|
'order' => [
|
|
|
'uid' => getProp($order, 'uid'),
|
|
|
'order_no' => getProp($order, 'trade_no'),
|
|
|
'price' => getProp($order, 'price'),
|
|
|
- 'channel_id' => getProp($order, 'distribution_channel_id'),
|
|
|
+ 'channel_id' => $channelId,
|
|
|
'pay_time' => getProp($order, 'pay_end_at'),
|
|
|
'order_created_at' => $order->created_at->format('Y-m-d H:i:s')
|
|
|
]
|
|
@@ -110,20 +115,19 @@ class ReportService
|
|
|
*/
|
|
|
private static function report($uri, $data)
|
|
|
{
|
|
|
- myLog('report')->info($uri, $data);
|
|
|
-
|
|
|
-// $client = new Client(['timeout' => 3, 'verify' => false]);
|
|
|
-//
|
|
|
-// // 执行上报
|
|
|
-// $result = $client->post(env('REPORT_URI') . $uri, [
|
|
|
-// 'headers' => [
|
|
|
-// 'x-code' => 'Mvnx1Yr3O8i!TS5u'
|
|
|
-// ],
|
|
|
-// 'json' => $data
|
|
|
-// ]);
|
|
|
-// $contentJson = $result->getBody()->getContents();
|
|
|
-// $contentArr = json_decode($contentJson, true);
|
|
|
-//
|
|
|
-// return $contentArr;
|
|
|
+ $client = new Client(['timeout' => 3, 'verify' => false]);
|
|
|
+
|
|
|
+ // 执行上报
|
|
|
+ $result = $client->post(env('REPORT_URI') . $uri, [
|
|
|
+ 'headers' => [
|
|
|
+ 'x-code' => 'Mvnx1Yr3O8i!TS5u'
|
|
|
+ ],
|
|
|
+ 'json' => $data
|
|
|
+ ]);
|
|
|
+ $contentJson = $result->getBody()->getContents();
|
|
|
+ $contentArr = json_decode($contentJson, true);
|
|
|
+ myLog('report')->info($uri, compact('data', 'contentArr'));
|
|
|
+
|
|
|
+ return $contentArr;
|
|
|
}
|
|
|
}
|