From 2acaacb420a5e0dd056f54949f688ed3c1005c0f Mon Sep 17 00:00:00 2001 From: jianghanbo Date: Mon, 12 Aug 2024 11:13:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E7=BA=BF=E8=B7=AF=E5=88=86?= =?UTF-8?q?=E9=85=8D=E5=AE=A2=E6=9C=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/app/command/SpiderDy.php | 12 +++++++----- service/app/command/SpiderMt.php | 16 +++++++++------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/service/app/command/SpiderDy.php b/service/app/command/SpiderDy.php index 0564db54..d609f726 100644 --- a/service/app/command/SpiderDy.php +++ b/service/app/command/SpiderDy.php @@ -2,6 +2,7 @@ namespace app\command; +use app\admin\controller\AdminController; use app\model\Admins; use app\model\Blacks; use app\model\Finances; @@ -41,10 +42,10 @@ class SpiderDy extends Command ); } - protected function users() + protected function users($routeType) { if (count($this->_users) > 0) return $this->_users; - $users = Admins::where('status', 1)->where('is_order', 1)->select(); + $users = Admins::where('status', 1)->where('is_order', 1)->where('route_type', $routeType)->select(); $us = []; foreach ($users as $u) { $ru = Redis::get('CRM:USER:ONLINE:' . $u->id); @@ -60,11 +61,12 @@ class SpiderDy extends Command protected $_redis_pool = []; - protected function poolUser($status = 0) + protected function poolUser($status = 0, $categoryDesc = '') { if (empty($this->_redis_pool[$status])) { $this->_redis_pool[$status] = Redis::hGetAll('CRM:Pool:' . $status); - $users = $this->users(); + $routeType = AdminController::ROUTE_LISTS[mb_substr($categoryDesc, 0, 2)] ?? 10; + $users = $this->users($routeType); $_users = []; if (empty($this->_redis_pool[$status])) { foreach ($users as $user) { @@ -356,7 +358,7 @@ class SpiderDy extends Command if (!empty($oldMobile)) { $admin_id = $oldMobile->admin_id; } else { - $admin_id = $this->poolUser($order->orderStatus); + $admin_id = $this->poolUser($order->orderStatus, $order->category_desc); } if (empty($admin_id)) return null; diff --git a/service/app/command/SpiderMt.php b/service/app/command/SpiderMt.php index f818a5d5..41d43598 100644 --- a/service/app/command/SpiderMt.php +++ b/service/app/command/SpiderMt.php @@ -2,6 +2,7 @@ namespace app\command; +use app\admin\controller\AdminController; use app\model\Admins; use app\model\Blacks; use app\model\Finances; @@ -42,10 +43,10 @@ class SpiderMt extends Command ); } - protected function users() + protected function users($routeType) { if (count($this->_users) > 0) return $this->_users; - $users = Admins::where('status', 1)->where('is_order', 1)->select(); + $users = Admins::where('status', 1)->where('is_order', 1)->where('route_type', $routeType)->select(); $us = []; foreach ($users as $u) { $ru = Redis::get('CRM:USER:ONLINE:' . $u->id); @@ -84,11 +85,12 @@ class SpiderMt extends Command protected $_redis_pool = []; - protected function poolUser($status = 0) + protected function poolUser($status = 0, $categoryDesc = '') { if (empty($this->_redis_pool[$status])) { $this->_redis_pool[$status] = Redis::hGetAll('CRM:Pool:' . $status); - $users = $this->users(); + $routeType = AdminController::ROUTE_LISTS[mb_substr($categoryDesc, 0, 2)] ?? 10; + $users = $this->users($routeType); $_users = []; if (empty($this->_redis_pool[$status])) { foreach ($users as $user) { @@ -181,7 +183,7 @@ class SpiderMt extends Command // return 1; // sleep(5); - + // $time = strtotime(date('Y-m-d')); // for ($i = 0; $i <= $d; $i++) { // $day = $time - $i * 24 * 3600; @@ -192,7 +194,7 @@ class SpiderMt extends Command // } $start = date('Y-m-d 00:00:00', strtotime("-{$d} days")); - $end = date('Y-m-d 23:59:59'); + $end = date('Y-m-d 23:59:59'); $this->orders($start, $end, false); if (date('H') >= 1 && date('H') <= 7) { @@ -386,7 +388,7 @@ class SpiderMt extends Command if (!empty($oldMobile)) { $admin_id = $oldMobile->admin_id; } else { - $admin_id = $this->poolUser($order->orderStatus); + $admin_id = $this->poolUser($order->orderStatus, $order->category_desc); } if (empty($admin_id)) return null;