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