增加机器人提醒
This commit is contained in:
parent
de34ad7475
commit
b8dd11b49e
|
@ -8,7 +8,7 @@ use app\model\Follows;
|
|||
use app\model\Orders;
|
||||
use app\model\Logs;
|
||||
use app\model\ThirdMobileLogs;
|
||||
use app\server\AliCloudApiService;
|
||||
use app\server\ThirdApiService;
|
||||
use app\server\Orders as ServerOrders;
|
||||
use stdClass;
|
||||
use support\Log;
|
||||
|
@ -143,7 +143,7 @@ class OrderController extends base
|
|||
// 防止重复查询第三方接口
|
||||
$mobileInfo = $localMobiles[$value['mobile']];
|
||||
} else {
|
||||
$mobileInfo = (new AliCloudApiService())->getMobileArea($value['mobile']);
|
||||
$mobileInfo = (new ThirdApiService())->getMobileArea($value['mobile']);
|
||||
$localMobiles[$value['mobile']] = $mobileInfo;
|
||||
}
|
||||
} catch (\Exception $exception) {
|
||||
|
|
|
@ -30,7 +30,7 @@ class Orders extends base
|
|||
];
|
||||
|
||||
const StatusName = ['待跟进', '跟进中', '已核销', '核销失败', '放弃跟单'];
|
||||
const OSS = [1 => '美团', '7' => '美团(新国旅)', 2 => '快手', 3 => '抖音(甄选)', '5' => '抖音(新国旅)', '6' => '同程', 4 => '全平台'];
|
||||
const OSS = [1 => '美团(甄选)', '7' => '美团(新国旅)', 2 => '快手', 3 => '抖音(甄选)', '5' => '抖音(新国旅)', '6' => '同程', 4 => '全平台'];
|
||||
|
||||
const timeType = ['create_time' => '添加记录时间', 'update_time' => '修改记录时间', 'last_follow' => '最后跟进时间', 'next_follow' => '下次跟进时间', 'travel_date' => '出行时间', 'create_at' => '下单时间'];
|
||||
|
||||
|
|
|
@ -516,10 +516,6 @@ class Douyin
|
|||
}
|
||||
$body = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
if ($this->os == 5) {
|
||||
Log::info("抖音 os:{$this->os} \n\n");
|
||||
Log::info( "抖音 body:{$body} \n\n");
|
||||
}
|
||||
if (!in_array($method, ['GET', 'POST'])) {
|
||||
$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
|
||||
$header = substr($body, 0, $header_size);
|
||||
|
@ -532,6 +528,13 @@ class Douyin
|
|||
}
|
||||
return null;
|
||||
}
|
||||
return json_decode($body);
|
||||
|
||||
$res = json_decode($body);
|
||||
if (!isset($res['status_code']) || $res['status_code'] != 0) {
|
||||
Log::info("抖音 os:{$this->os} \n\n");
|
||||
Log::info( "抖音 body:{$body} \n\n");
|
||||
(new ThirdApiService())->weComNotice($this->os);
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
}
|
|
@ -150,12 +150,14 @@ class Meituan {
|
|||
}
|
||||
|
||||
$body = curl_exec($ch);
|
||||
if ($this->os == 7) {
|
||||
curl_close($ch);
|
||||
$res = json_decode($body);
|
||||
if (!isset($res['code']) || $res['code'] != 0) {
|
||||
Log::info('os:' . $this->os);
|
||||
Log::info('http:' . $http);
|
||||
Log::info('body:' . $body);
|
||||
(new ThirdApiService())->weComNotice($this->os);
|
||||
}
|
||||
curl_close($ch);
|
||||
return json_decode($body);
|
||||
return $res;
|
||||
}
|
||||
}
|
|
@ -1,13 +1,16 @@
|
|||
<?php
|
||||
namespace app\server;
|
||||
|
||||
use app\model\Orders;
|
||||
use app\model\ThirdMobileLogs;
|
||||
use support\Log;
|
||||
|
||||
/**
|
||||
* 阿里云市场相关接口
|
||||
*/
|
||||
class AliCloudApiService {
|
||||
class ThirdApiService {
|
||||
private $notice = '%s token已过期,请及时更换';
|
||||
|
||||
/**
|
||||
* @param $mobile
|
||||
* @return array|mixed
|
||||
|
@ -64,4 +67,23 @@ class AliCloudApiService {
|
|||
list($header, $body) = explode("\r\n\r\n", curl_exec($curl), 2);
|
||||
return json_decode($body, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送企微提醒
|
||||
* @param $message
|
||||
* @return mixed
|
||||
*/
|
||||
public function weComNotice($os) {
|
||||
$url = 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=e138b55c-2886-4729-922e-9a8c753f75ee';
|
||||
$method = 'post';
|
||||
$message = sprintf($this->notice, Orders::OSS[$os] ?? '');
|
||||
$bodys = [
|
||||
'msgtype' => 'text',
|
||||
'text' => [
|
||||
'content' => $message
|
||||
]
|
||||
];
|
||||
|
||||
return $this->curlRequest($url, $method, [], $bodys);
|
||||
}
|
||||
}
|
|
@ -106,7 +106,7 @@ class Tongcheng {
|
|||
if (empty($list) || $list->code != 1000) {
|
||||
$this->_getRetriesLock();
|
||||
$list = $this->_curl("/merchant/api/market-live/wxVideoV2/supplierOrderByPage", $params, 'POST');
|
||||
if (empty($list) || $list->status_code != 0) {
|
||||
if (empty($list) || $list->code != 1000) {
|
||||
Log::error('===查询时间:' . $start . '--' . $end . '====certificate_list: ' . json_encode($list));
|
||||
throw new Exception("同程拉单失败,Err:" . json_encode($list));
|
||||
}
|
||||
|
@ -268,6 +268,12 @@ class Tongcheng {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
return json_decode($body);
|
||||
|
||||
$res = json_decode($body);
|
||||
if (!isset($res['code']) || $res['code'] != 1000) {
|
||||
Log::info( "同城 body:{$body} \n\n");
|
||||
(new ThirdApiService())->weComNotice($this->os);
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue