美团新国旅
This commit is contained in:
parent
8612a7bab6
commit
d28667b6b7
|
@ -29,7 +29,7 @@ class OrderController extends base
|
|||
if(!$request->admin->is_super) {
|
||||
$where = [['admin_id','=', $request->admin->id]];
|
||||
} else {
|
||||
$where = [['admin_id', '!=', 0]];
|
||||
$where = [['admin_id', '>', 0]];
|
||||
}
|
||||
|
||||
if($sn) {
|
||||
|
@ -169,6 +169,8 @@ class OrderController extends base
|
|||
$statss = Orders::DouyinStatus;
|
||||
}elseif($key ==6) {
|
||||
$statss = Orders::TongchengStatus;
|
||||
}elseif($key ==6) {
|
||||
$statss = Orders::OrderStatus;
|
||||
}
|
||||
|
||||
$_ch = [];
|
||||
|
|
|
@ -334,7 +334,7 @@ class SpiderMt extends Command
|
|||
{
|
||||
|
||||
foreach (Orders::OSS as $k => $os) {
|
||||
$pages = 6;
|
||||
$pages = 10;
|
||||
$page = 1;
|
||||
|
||||
while (true) {
|
||||
|
@ -343,15 +343,11 @@ class SpiderMt extends Command
|
|||
|
||||
switch ($k) {
|
||||
case 1:
|
||||
case 7:
|
||||
try {
|
||||
$mei = new Meituan();
|
||||
$mei = new Meituan($k);
|
||||
$list = $mei->get($page, $start, $end);
|
||||
// $pages = $mei->totalPage;
|
||||
|
||||
if ($mei->totalPage === 1) {
|
||||
$pages = 1;
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
Log::error(dirname(__FILE__) . __LINE__ . $e);
|
||||
}
|
||||
|
@ -381,7 +377,7 @@ class SpiderMt extends Command
|
|||
# code...
|
||||
break;
|
||||
}
|
||||
|
||||
echo 'order:' . json_encode($list);
|
||||
foreach ($list as $order) {
|
||||
|
||||
$item = Orders::where('os', $order->os)->where('sn', $order->sn)->find();
|
||||
|
@ -408,9 +404,7 @@ class SpiderMt extends Command
|
|||
$order->give_time = time();
|
||||
|
||||
//判断是否需要发短信
|
||||
if (($order->os == 1 && array_key_exists($order->order_status, [1 => 1, 3 => 3])) ||
|
||||
($order->os == 2 && array_key_exists($order->order_status, [2 => 2, 3 => 3, 4 => 4])) ||
|
||||
($order->os == 3 && $order->order_status == 1)) {
|
||||
if ((in_array($order->os, [1, 7]) && array_key_exists($order->order_status, [1 => 1, 3 => 3]))) {
|
||||
if ($admin_id > 0) {
|
||||
$this->sms($admin_id, $order);
|
||||
}
|
||||
|
@ -438,6 +432,10 @@ class SpiderMt extends Command
|
|||
}
|
||||
}
|
||||
|
||||
// 数据小于50, 结束
|
||||
if (count($list) < 50) {
|
||||
break;
|
||||
}
|
||||
$page++;
|
||||
}
|
||||
}
|
||||
|
@ -464,7 +462,8 @@ class SpiderMt extends Command
|
|||
$it = null;
|
||||
switch ($item->os) {
|
||||
case 1:
|
||||
$m = new Meituan();
|
||||
case 7:
|
||||
$m = new Meituan($item->os);
|
||||
$it = $m->get(1, null, null, $item->sn);
|
||||
break;
|
||||
/* case 2:
|
||||
|
|
|
@ -30,7 +30,7 @@ class Orders extends base
|
|||
];
|
||||
|
||||
const StatusName = ['待跟进', '跟进中', '已核销', '核销失败', '放弃跟单'];
|
||||
const OSS = [1 => '美团', 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' => '下单时间'];
|
||||
|
||||
|
|
|
@ -10,9 +10,11 @@ class Meituan {
|
|||
private $cookie = '';
|
||||
private $gate = 'https://lvyou.meituan.com';
|
||||
public $totalPage = 6;
|
||||
public $os;
|
||||
|
||||
public function __construct()
|
||||
public function __construct($os = 1)
|
||||
{
|
||||
$this->os = $os;
|
||||
$this->cookie = $this->_cookie();
|
||||
}
|
||||
|
||||
|
@ -51,7 +53,7 @@ class Meituan {
|
|||
|
||||
$params = [
|
||||
'page' => $page,
|
||||
'count' => 20,
|
||||
'count' => 50,
|
||||
'orderId' => $orderId,
|
||||
'productId' => '',
|
||||
'orderTimeTo' => $end ?? '',
|
||||
|
@ -74,10 +76,6 @@ class Meituan {
|
|||
}
|
||||
}
|
||||
|
||||
if($list && $list->code == 0) {
|
||||
$this->totalPage = $list->data->totalPage;
|
||||
}
|
||||
|
||||
$_list = [];
|
||||
if($list && $list->code == 0 && $list->data && is_array($list->data->orderList)) {
|
||||
foreach($list->data->orderList as $order) {
|
||||
|
@ -88,7 +86,7 @@ class Meituan {
|
|||
sleep(100);
|
||||
}
|
||||
$item = new Orders();
|
||||
$item->os = 1;
|
||||
$item->os = $this->os;
|
||||
$item->sn = $order->orderId;
|
||||
$item->product_id = $order->productId;
|
||||
$item->product_name = $order->productName;
|
||||
|
@ -114,8 +112,9 @@ class Meituan {
|
|||
}
|
||||
|
||||
public function _cookie($data = '') {
|
||||
if($data) Redis::set('Meituan:cookie', $data);
|
||||
return Redis::get('Meituan:cookie');
|
||||
$key = sprintf('Meituan:cookie-%s', $this->os);
|
||||
if($data) Redis::set($key, $data);
|
||||
return Redis::get($key);
|
||||
}
|
||||
|
||||
public function _curl($url, $params, $method = 'GET') {
|
||||
|
@ -144,6 +143,10 @@ class Meituan {
|
|||
|
||||
curl_setopt($ch, CURLOPT_COOKIE, $this->_cookie());
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
if ($this->os == 7) {
|
||||
echo $this->os . $http;
|
||||
echo $this->_cookie();
|
||||
}
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
|
||||
if($method == 'POST') {
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
|
|
|
@ -92,7 +92,8 @@ class Orders {
|
|||
|
||||
switch ($order->os) {
|
||||
case 1:
|
||||
$mt = new Meituan();
|
||||
case 7:
|
||||
$mt = new Meituan($order->os);
|
||||
$it = $mt->get(1, null, null, $order->sn);
|
||||
|
||||
if ($it) {
|
||||
|
@ -173,7 +174,8 @@ class Orders {
|
|||
$got = null;
|
||||
switch ($order->os) {
|
||||
case 1:
|
||||
$mt = new Meituan();
|
||||
case 7:
|
||||
$mt = new Meituan($order->os);
|
||||
$it = $mt->get(1, null, null, $order->sn);
|
||||
|
||||
if ($it) {
|
||||
|
|
Loading…
Reference in New Issue