123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <?php
- namespace App\Service\Order;
- use App\Log;
- use App\Service\HttpService;
- use App\Support\EmailQueue;
- class ChuMoService
- {
- public static function getSpecialOrderShareInProportion($playletName) {
- return $playletName == '龙王殿' ? [1 => 0.85, 2 => 0.85] : null;
- }
- public static function orderList($params, $retry = 0) {
- try {
- $url = config('chumo.request_url') . 'orderList';
- $response = HttpService::httpPost($url, json_encode($params), true);
- if($response === false && $retry <5) { // 发起重试
- $retry++;
- sleep(1);
- return ChuMoService::orderList($params, $retry);
- }
- $responseData = json_decode($response, 1);
- Log::logInfo('触摸订单', [
- 'params' => $params,
- 'response' => $responseData
- ], 'ChuMoOrderList');
- if((isset($responseData['code']) && $responseData['code'] != 200) || !isset($responseData['data'])) {
- $errMsg = $responseData['msg'] ?? '';
- EmailQueue::rPush('获取触摸平台下的订单信息返回错误', $errMsg, ['song.shen@kuxuan-inc.com'],
- '猎羽');
- Log::logError('获取触摸平台下的订单信息返回错误', ['response' => $responseData], 'ChuMoApi');
- return [[], 0];
- }
- $data = $responseData['data'] ?? [];
- $count= $responseData['total'] ?? 0;
- return [$data, $count];
- } catch (\Exception $e) {
- EmailQueue::rPush('获取触摸平台下的订单信息返回错误', '', ['song.shen@kuxuan-inc.com'], '猎羽');
- Log::logError('获取触摸平台下的订单信息返回错误', [
- 'line' => $e->getLine(),
- 'msg' => $e->getMessage()
- ], 'ChuMoApi-Exception');
- return [[], 0];
- }
- }
-
- public static function appList($params, $retry = 0) {
- try {
- $url = config('chumo.request_url') . 'channelList';
- $url = $url . '?' . http_build_query($params);
- $response = HttpService::httpGet($url);
- if($response === false && $retry <5) { // 发起重试
- $retry++;
- sleep(1);
- return ChuMoService::appList($params, $retry);
- }
- $responseData = json_decode($response, 1);
- Log::logInfo('应用列表', [$responseData], 'ChuMoAppList');
- if(isset($responseData['code']) && $responseData['code'] != 200) {
- EmailQueue::rPush('获取触摸平台下的渠道信息返回错误', $responseData['msg'], ['song.shen@kuxuan-inc.com'],
- '猎羽');
- Log::logError('获取触摸平台下的渠道信息返回错误', ['response' => $responseData], 'ChuMoApi');
- return [[], 0];
- }
- $data = $responseData['data'] ?? [];
- $count = $responseData['total'] ?? 0;
- return [$data, $count];
- } catch (\Exception $e) {
- EmailQueue::rPush('获取触摸平台下的渠道信息返回错误', '', ['song.shen@kuxuan-inc.com'], '猎羽');
- Log::logError('获取触摸平台下的渠道信息返回错误', [
- 'line' => $e->getLine(),
- 'msg' => $e->getMessage()
- ], 'ChuMoApi-Exception');
- }
- return [[], 0];
- }
- }
|