退出登陆&&跟进数量
This commit is contained in:
parent
4aedaf2974
commit
a8a5656b0b
|
@ -142,18 +142,6 @@ class SpiderDy extends Command
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// echo "状态1\n";
|
|
||||||
// $this->poolUser(1);
|
|
||||||
// echo "状态2\n";
|
|
||||||
// $this->poolUser(2);
|
|
||||||
// echo "状态3\n";
|
|
||||||
// $this->poolUser(3);
|
|
||||||
// echo "状态4\n";
|
|
||||||
// $this->poolUser(4);
|
|
||||||
// echo "状态5\n";
|
|
||||||
// $this->poolUser(5);
|
|
||||||
// return 1;
|
|
||||||
|
|
||||||
// $this->checks($output);
|
// $this->checks($output);
|
||||||
// $output->writeln('CHECK spider:dy');
|
// $output->writeln('CHECK spider:dy');
|
||||||
|
|
||||||
|
@ -238,19 +226,15 @@ class SpiderDy extends Command
|
||||||
$order->is_check = 1;
|
$order->is_check = 1;
|
||||||
$order->check_sn = $json->check_sn;
|
$order->check_sn = $json->check_sn;
|
||||||
$back = $order->save();
|
$back = $order->save();
|
||||||
echo "订单在自己名下";
|
|
||||||
} else {
|
} else {
|
||||||
// echo "订单在自己名下2 $order_id";
|
|
||||||
$order = Orders::where('sn', $order_id)->find();
|
$order = Orders::where('sn', $order_id)->find();
|
||||||
// print_r($order->toArray());
|
// print_r($order->toArray());
|
||||||
if (!empty($order) && $order->admin_id == 0) {
|
if (!empty($order) && $order->admin_id == 0) {
|
||||||
echo '订单不在自己的名下,并且没有分人。';
|
|
||||||
$order->is_check = 1;
|
$order->is_check = 1;
|
||||||
$order->check_sn = $json->check_sn;
|
$order->check_sn = $json->check_sn;
|
||||||
$order->admin_id = $json->admin_id;
|
$order->admin_id = $json->admin_id;
|
||||||
$back = $order->save();
|
$back = $order->save();
|
||||||
} elseif (!empty($order) && $order->admin_id !== $json->admin_id) {
|
} elseif (!empty($order) && $order->admin_id !== $json->admin_id) {
|
||||||
echo '订单不在自己的名下,并且分人了。';
|
|
||||||
$item = new Orders();
|
$item = new Orders();
|
||||||
$item->os = 1;
|
$item->os = 1;
|
||||||
$item->sn = $order->sn;
|
$item->sn = $order->sn;
|
||||||
|
@ -339,7 +323,6 @@ class SpiderDy extends Command
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
case 5:
|
case 5:
|
||||||
// echo '==========pages='.$pages;
|
|
||||||
try {
|
try {
|
||||||
$dou = new Douyin($k);
|
$dou = new Douyin($k);
|
||||||
$list = $dou->get($page, $start, $end, '');
|
$list = $dou->get($page, $start, $end, '');
|
||||||
|
@ -487,18 +470,15 @@ class SpiderDy extends Command
|
||||||
{
|
{
|
||||||
$user = Admins::cache(true)->where('id', $admin_id)->find();
|
$user = Admins::cache(true)->where('id', $admin_id)->find();
|
||||||
if ((!config('app.debug', true) || config('app.debug', true) === 'false') && (time() * 1000 - $order->create_at) / 1000 < 2 * 24 * 3600) {
|
if ((!config('app.debug', true) || config('app.debug', true) === 'false') && (time() * 1000 - $order->create_at) / 1000 < 2 * 24 * 3600) {
|
||||||
echo "发送短信\n";
|
|
||||||
print_r([$order->mobile, 261607, ['title' => $order->product_name, 'mobile' => $user->mobile]]);
|
print_r([$order->mobile, 261607, ['title' => $order->product_name, 'mobile' => $user->mobile]]);
|
||||||
$has = Blacks::where('mobile', $order->mobile)->find();
|
$has = Blacks::where('mobile', $order->mobile)->find();
|
||||||
if (empty($has) && !empty($order->mobile)) {
|
if (empty($has) && !empty($order->mobile)) {
|
||||||
SMS::juhe_sms_send($order->mobile, 261607, ['title' => $order->product_name, 'mobile' => $user->mobile]);
|
SMS::juhe_sms_send($order->mobile, 261607, ['title' => $order->product_name, 'mobile' => $user->mobile]);
|
||||||
} else {
|
} else {
|
||||||
echo "黑名单不发送短信\n";
|
|
||||||
sleep(10);
|
sleep(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
echo "不发送短信\n";
|
|
||||||
print_r([$order->mobile, 261607, ['title' => $order->product_name, 'mobile' => $user->mobile]]);
|
print_r([$order->mobile, 261607, ['title' => $order->product_name, 'mobile' => $user->mobile]]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,18 +165,6 @@ class SpiderMt extends Command
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// echo "状态1\n";
|
|
||||||
// $this->poolUser(1);
|
|
||||||
// echo "状态2\n";
|
|
||||||
// $this->poolUser(2);
|
|
||||||
// echo "状态3\n";
|
|
||||||
// $this->poolUser(3);
|
|
||||||
// echo "状态4\n";
|
|
||||||
// $this->poolUser(4);
|
|
||||||
// echo "状态5\n";
|
|
||||||
// $this->poolUser(5);
|
|
||||||
// return 1;
|
|
||||||
|
|
||||||
// $this->checks($output);
|
// $this->checks($output);
|
||||||
// $output->writeln('CHECK spider:mt');
|
// $output->writeln('CHECK spider:mt');
|
||||||
|
|
||||||
|
@ -261,20 +249,16 @@ class SpiderMt extends Command
|
||||||
$order->is_check = 1;
|
$order->is_check = 1;
|
||||||
$order->check_sn = $json->check_sn;
|
$order->check_sn = $json->check_sn;
|
||||||
$back = $order->save();
|
$back = $order->save();
|
||||||
echo "订单在自己名下";
|
|
||||||
} else {
|
} else {
|
||||||
// echo "订单在自己名下2 $order_id";
|
|
||||||
$order = Orders::where('sn', $order_id)->find();
|
$order = Orders::where('sn', $order_id)->find();
|
||||||
// print_r($order->toArray());
|
// print_r($order->toArray());
|
||||||
if (!empty($order) && $order->admin_id == 0) {
|
if (!empty($order) && $order->admin_id == 0) {
|
||||||
echo '订单不在自己的名下,并且没有分人。';
|
|
||||||
$order->is_check = 1;
|
$order->is_check = 1;
|
||||||
$order->check_sn = $json->check_sn;
|
$order->check_sn = $json->check_sn;
|
||||||
$order->admin_id = $json->admin_id;
|
$order->admin_id = $json->admin_id;
|
||||||
$order->give_time = time();
|
$order->give_time = time();
|
||||||
$back = $order->save();
|
$back = $order->save();
|
||||||
} elseif (!empty($order) && $order->admin_id !== $json->admin_id) {
|
} elseif (!empty($order) && $order->admin_id !== $json->admin_id) {
|
||||||
echo '订单不在自己的名下,并且分人了。';
|
|
||||||
$item = new Orders();
|
$item = new Orders();
|
||||||
$item->os = 1;
|
$item->os = 1;
|
||||||
$item->sn = $order->sn;
|
$item->sn = $order->sn;
|
||||||
|
@ -377,7 +361,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();
|
||||||
|
@ -507,19 +491,16 @@ echo 'order:' . json_encode($list);
|
||||||
{
|
{
|
||||||
$user = Admins::cache(true)->where('id', $admin_id)->find();
|
$user = Admins::cache(true)->where('id', $admin_id)->find();
|
||||||
if ((!config('app.debug', true) || config('app.debug', true) === 'false') && (time() * 1000 - $order->create_at) / 1000 < 2 * 24 * 3600) {
|
if ((!config('app.debug', true) || config('app.debug', true) === 'false') && (time() * 1000 - $order->create_at) / 1000 < 2 * 24 * 3600) {
|
||||||
echo "发送短信\n";
|
|
||||||
print_r([$order->mobile, 261607, ['title' => $order->product_name, 'mobile' => $user->mobile]]);
|
print_r([$order->mobile, 261607, ['title' => $order->product_name, 'mobile' => $user->mobile]]);
|
||||||
$has = Blacks::where('mobile', $order->mobile)->find();
|
$has = Blacks::where('mobile', $order->mobile)->find();
|
||||||
if (empty($has) && !empty($order->mobile)) {
|
if (empty($has) && !empty($order->mobile)) {
|
||||||
SMS::juhe_sms_send($order->mobile, 261607, ['title' => $order->product_name, 'mobile' => $user->mobile]);
|
SMS::juhe_sms_send($order->mobile, 261607, ['title' => $order->product_name, 'mobile' => $user->mobile]);
|
||||||
} else {
|
} else {
|
||||||
echo "黑名单不发送短信\n";
|
|
||||||
sleep(10);
|
sleep(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
echo "不发送短信\n";
|
Log::info('不发送短信' . json_encode([$order->mobile, 261607, ['title' => $order->product_name, 'mobile' => $user->mobile]]));
|
||||||
print_r([$order->mobile, 261607, ['title' => $order->product_name, 'mobile' => $user->mobile]]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,12 +6,6 @@ use app\admin\controller\AdminController;
|
||||||
use app\model\Admins;
|
use app\model\Admins;
|
||||||
use app\model\Blacks;
|
use app\model\Blacks;
|
||||||
use app\model\Finances;
|
use app\model\Finances;
|
||||||
use app\model\Logs;
|
|
||||||
use app\model\Orders;
|
|
||||||
use app\server\Douyin;
|
|
||||||
use app\server\Meituan;
|
|
||||||
use app\server\Kuaishou;
|
|
||||||
use app\server\Orders as ServerOrders;
|
|
||||||
use app\server\SMS;
|
use app\server\SMS;
|
||||||
use app\server\Tongcheng;
|
use app\server\Tongcheng;
|
||||||
use stdClass;
|
use stdClass;
|
||||||
|
@ -295,18 +289,14 @@ class SpiderTc extends Command
|
||||||
$user = Admins::cache(true)->where('id', $admin_id)->find();
|
$user = Admins::cache(true)->where('id', $admin_id)->find();
|
||||||
$templateId = 261607;
|
$templateId = 261607;
|
||||||
if ((!config('app.debug', true) || config('app.debug', true) === 'false') && (time() * 1000 - $order->create_at) / 1000 < 2 * 24 * 3600) {
|
if ((!config('app.debug', true) || config('app.debug', true) === 'false') && (time() * 1000 - $order->create_at) / 1000 < 2 * 24 * 3600) {
|
||||||
echo "发送短信\n";
|
|
||||||
print_r([$order->mobile, $templateId, ['title' => $order->product_name, 'mobile' => $user->mobile]]);
|
print_r([$order->mobile, $templateId, ['title' => $order->product_name, 'mobile' => $user->mobile]]);
|
||||||
$has = Blacks::where('mobile', $order->mobile)->find();
|
$has = Blacks::where('mobile', $order->mobile)->find();
|
||||||
if (empty($has) && !empty($order->mobile)) {
|
if (empty($has) && !empty($order->mobile)) {
|
||||||
SMS::juhe_sms_send($order->mobile, $templateId, ['title' => $order->product_name, 'mobile' => $user->mobile]);
|
SMS::juhe_sms_send($order->mobile, $templateId, ['title' => $order->product_name, 'mobile' => $user->mobile]);
|
||||||
} else {
|
} else {
|
||||||
echo "黑名单不发送短信\n";
|
|
||||||
sleep(10);
|
sleep(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
echo "不发送短信\n";
|
|
||||||
print_r([$order->mobile, $templateId, ['title' => $order->product_name, 'mobile' => $user->mobile]]);
|
print_r([$order->mobile, $templateId, ['title' => $order->product_name, 'mobile' => $user->mobile]]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,6 @@ class Douyin
|
||||||
|
|
||||||
if ($list && $list->status_code == 0 && !empty($list->order_list)) {
|
if ($list && $list->status_code == 0 && !empty($list->order_list)) {
|
||||||
foreach ($list->order_list as $order) {
|
foreach ($list->order_list as $order) {
|
||||||
echo "抖音 订单号:{$order->order_info->order_id} \n\n";
|
|
||||||
if (empty($cert)) {
|
if (empty($cert)) {
|
||||||
$cert = $this->_cert($order->order_info->order_id);
|
$cert = $this->_cert($order->order_info->order_id);
|
||||||
if (empty($cert)) {
|
if (empty($cert)) {
|
||||||
|
@ -162,7 +161,7 @@ class Douyin
|
||||||
$this->totalPage = 1;
|
$this->totalPage = 1;
|
||||||
return $_list;
|
return $_list;
|
||||||
}
|
}
|
||||||
echo date('Y-m-d', $start) . '--' . date('Y-m-d', $end) . " 抖音 page:{$page} total_count:" . $list->data->pagination->total_count . " page_count:" . $list->data->pagination->page_count . " \n\n";
|
Log::info(date('Y-m-d', $start) . '--' . date('Y-m-d', $end) . " 抖音 page:{$page} total_count:" . $list->data->pagination->total_count . " page_count:" . $list->data->pagination->page_count );
|
||||||
|
|
||||||
foreach ($list->data->list as $order) {
|
foreach ($list->data->list as $order) {
|
||||||
Log::info("抖音 订单号:{$order->order_id} \n\n");
|
Log::info("抖音 订单号:{$order->order_id} \n\n");
|
||||||
|
@ -283,64 +282,10 @@ class Douyin
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*public function _killMiddleProcesses($pattern, $maxProcesses)
|
|
||||||
{
|
|
||||||
// 检查操作系统是否为 Linux
|
|
||||||
if (PHP_OS !== 'Linux') {
|
|
||||||
echo "当前系统不是 Linux,跳过执行。\n";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取当前进程的 PID
|
|
||||||
$currentPid = getmypid();
|
|
||||||
|
|
||||||
// 获取进程列表
|
|
||||||
$command = "ps aux | grep '$pattern' | grep -v grep | grep -v '$currentPid' | awk '{print $2,$10}'";
|
|
||||||
$output = [];
|
|
||||||
exec($command, $output);
|
|
||||||
|
|
||||||
$processCount = count($output);
|
|
||||||
|
|
||||||
// 如果进程数量超过最大值,则终止中间部分的 x-12 个进程
|
|
||||||
if ($processCount > $maxProcesses) {
|
|
||||||
$processesToKill = $processCount - $maxProcesses;
|
|
||||||
$processesKilled = 0;
|
|
||||||
|
|
||||||
// 找到运行时间最短的不包含自己的进程并终止它
|
|
||||||
foreach ($output as $line) {
|
|
||||||
list($pid, $runtime) = explode(' ', $line);
|
|
||||||
$runtimeParts = explode(':', $runtime);
|
|
||||||
$hours = intval($runtimeParts[0]);
|
|
||||||
$minutes = intval($runtimeParts[1]);
|
|
||||||
$totalMinutes = $hours * 60 + $minutes;
|
|
||||||
|
|
||||||
|
|
||||||
if ($pid !== $currentPid) {
|
|
||||||
exec("kill -9 $pid");
|
|
||||||
$processesKilled++;
|
|
||||||
|
|
||||||
echo "Killed process with PID: $pid\n";
|
|
||||||
|
|
||||||
if ($processesKilled >= $processesToKill) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($processesKilled === 0) {
|
|
||||||
echo "No processes to kill.\n";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
echo "Process count is not over the limit.\n";
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
public function _killMiddleProcesses($pattern, $maxProcesses)
|
public function _killMiddleProcesses($pattern, $maxProcesses)
|
||||||
{
|
{
|
||||||
// 检查操作系统是否为 Linux
|
// 检查操作系统是否为 Linux
|
||||||
if (PHP_OS !== 'Linux') {
|
if (PHP_OS !== 'Linux') {
|
||||||
echo "当前系统不是 Linux,跳过执行。\n";
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,14 +336,14 @@ class Douyin
|
||||||
exec("kill -9 {$process['pid']}");
|
exec("kill -9 {$process['pid']}");
|
||||||
$processesKilled++;
|
$processesKilled++;
|
||||||
|
|
||||||
echo "Killed process with PID: {$process['pid']}\n";
|
Log::info("Killed process with PID: {$process['pid']}\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($processesKilled === 0) {
|
if ($processesKilled === 0) {
|
||||||
echo "No processes to kill.\n";
|
Log::info( "No processes to kill.\n");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
echo "Process count is not over the limit.\n";
|
Log::info( "Process count is not over the limit.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -79,10 +79,10 @@ class Meituan {
|
||||||
$_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) {
|
||||||
echo "美团 订单号:{$order->orderId} \n\n";
|
Log::info("美团 订单号:{$order->orderId} \n\n");
|
||||||
|
|
||||||
if(in_array($order->orderId, ['',''])) {
|
if(in_array($order->orderId, ['',''])) {
|
||||||
echo "异常订单:". $order->orderId;
|
Log::info( "异常订单:". $order->orderId);
|
||||||
sleep(100);
|
sleep(100);
|
||||||
}
|
}
|
||||||
$item = new Orders();
|
$item = new Orders();
|
||||||
|
@ -143,10 +143,6 @@ 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);
|
||||||
|
|
|
@ -138,7 +138,6 @@ class Tongcheng {
|
||||||
{
|
{
|
||||||
// 检查操作系统是否为 Linux
|
// 检查操作系统是否为 Linux
|
||||||
if (PHP_OS !== 'Linux') {
|
if (PHP_OS !== 'Linux') {
|
||||||
echo "当前系统不是 Linux,跳过执行。\n";
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,14 +188,14 @@ class Tongcheng {
|
||||||
exec("kill -9 {$process['pid']}");
|
exec("kill -9 {$process['pid']}");
|
||||||
$processesKilled++;
|
$processesKilled++;
|
||||||
|
|
||||||
echo "Killed process with PID: {$process['pid']}\n";
|
Log::info("Killed process with PID: {$process['pid']}\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($processesKilled === 0) {
|
if ($processesKilled === 0) {
|
||||||
echo "No processes to kill.\n";
|
Log::info("No processes to kill.\n");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
echo "Process count is not over the limit.\n";
|
Log::info("Process count is not over the limit.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue