From 22619dff0ce4982e7baace7dabfdcd2b91268d20 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Mon, 26 Jul 2021 17:33:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=B8=B8=E6=88=8F=E6=AF=94?= =?UTF-8?q?=E4=BE=8B=E7=94=B3=E8=AF=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CompanyGameRatioController.class.php | 40 +++++++++++++------ .../Controller/OldCountController.class.php | 2 + Application/Admin/Event/MarketEvent.class.php | 7 ++++ 3 files changed, 37 insertions(+), 12 deletions(-) diff --git a/Application/Admin/Controller/CompanyGameRatioController.class.php b/Application/Admin/Controller/CompanyGameRatioController.class.php index 20db93a21..e19b6002e 100644 --- a/Application/Admin/Controller/CompanyGameRatioController.class.php +++ b/Application/Admin/Controller/CompanyGameRatioController.class.php @@ -6,6 +6,7 @@ class CompanyGameRatioController extends AdminController { public $admininfo; public $DBModel; + public $MarketEvent; public $OpAuthList=[]; public $Status = [ "-2"=>"管理员拒绝", @@ -24,6 +25,7 @@ class CompanyGameRatioController extends AdminController { $this->admininfo = $_SESSION['onethink_admin']['user_auth']; $this->DBModel = M("company_game_ratio","tab_"); + $this->MarketEvent = A("Market","Event"); parent::_initialize(); } @@ -78,18 +80,16 @@ class CompanyGameRatioController extends AdminController } } } - - $isMarketAdmin = isMarketAdmin(); - if($isMarketAdmin) { - $userAuth = session('user_auth'); - $adminId = $userAuth['uid']; - $companyIds = M('promote', 'tab_')->where(['admin_id' => $adminId, 'level' => 1])->getField('company_id', true); - $companyIds = array_unique($companyIds); - $marketCondition = ''; - if (count($companyIds) > 0) { - $marketCondition = 'm.company_id in(' . implode(',', $companyIds) . ')'; - } else { - $marketCondition = '1<>1'; + $gid = session('user_group_id'); + $markerGroup = $this->MarketEvent->isMarketAdminGroup($gid); + if($markerGroup){ + $companyIds = $this->MarketEvent->getAdminCompanyId(); + //取消0 + $companyIds = implode(",",array_diff(explode(",",$companyIds),[0])); + $marketCondition = 'm.company_id in(' . $companyIds . ')'; + if($markerGroup['department_level'] == $this->MarketEvent->getConfig("DirectorLevel")){ + //总监 + $marketCondition .= " OR (m.company_id = 0 AND m.company_belong != 0 )"; } $where['_string'] = isset($where['_string']) ? $where['_string'] . ' and ' . $marketCondition : $marketCondition; } @@ -265,6 +265,22 @@ class CompanyGameRatioController extends AdminController } } + + $gid = session('user_group_id'); + $markerGroup = $this->MarketEvent->isMarketAdminGroup($gid); + if($markerGroup){ + $companyIds = $this->MarketEvent->getAdminCompanyId(); + //取消0 + $companyIds = implode(",",array_diff(explode(",",$companyIds),[0])); + $marketCondition = 'm.company_id in(' . $companyIds . ')'; + if($markerGroup['department_level'] == $this->MarketEvent->getConfig("DirectorLevel")){ + //总监 + $marketCondition .= " OR (m.company_id = 0 AND m.company_belong != 0 )"; + } + $where['_string'] = isset($where['_string']) ? $where['_string'] . ' and ' . $marketCondition : $marketCondition; + } + + if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) { $time_start = strtotime($_REQUEST['time_start']); $time_end = strtotime($_REQUEST['time_end'])+ 86399; diff --git a/Application/Admin/Controller/OldCountController.class.php b/Application/Admin/Controller/OldCountController.class.php index 3b4dfcd1b..770c0875e 100644 --- a/Application/Admin/Controller/OldCountController.class.php +++ b/Application/Admin/Controller/OldCountController.class.php @@ -58,6 +58,7 @@ class OldCountController extends \Think\Controller // 'id'=>1, // 'name'=>'市场一部', // 'group_ids'=>'11,12,14,21,25', + // 'leader_group'=>'14', // 'create_time'=>time(), // 'update_time'=>time() // ]); @@ -65,6 +66,7 @@ class OldCountController extends \Think\Controller // 'id'=>2, // 'name'=>'市场二部', // 'group_ids'=>'26,27,28,29,30', + // 'leader_group'=>'28', // 'create_time'=>time(), // 'update_time'=>time() // ]); diff --git a/Application/Admin/Event/MarketEvent.class.php b/Application/Admin/Event/MarketEvent.class.php index a37235944..23a888829 100644 --- a/Application/Admin/Event/MarketEvent.class.php +++ b/Application/Admin/Event/MarketEvent.class.php @@ -99,6 +99,13 @@ class MarketEvent extends Controller $gid = M("auth_group_access")->where("uid = '{$uid}'")->getField('group_id'); return M('department','sys_')->where("id = '{$department_id}' and leader_group = '$gid'")->field("id")->find(); } + + public function isMarketLeder($uid) + { + $gid = M("auth_group_access")->where("uid = '{$uid}'")->getField('group_id'); + return M("auth_group")->where("id = '{$gid}' and department_level = '{$this->DirectorLevel}'")->field("id")->find(); + } + /** * 添加部门总监的会长权限 * $uid,$promote_id