根据线路分配客服

This commit is contained in:
jianghanbo 2024-08-12 11:13:05 +08:00
parent 9fe2effc94
commit 2acaacb420
2 changed files with 16 additions and 12 deletions

View File

@ -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;

View File

@ -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) {
@ -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;