From 7abcd38f36857dab8b7c590db118c86437d95364 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Wed, 16 Dec 2020 18:00:17 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E6=8E=A8=E5=B9=BF?= =?UTF-8?q?=E5=85=AC=E5=8F=B8bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Common/extend.php | 18 ++++++++++++++---- .../PromoteCompanyController.class.php | 2 ++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Application/Admin/Common/extend.php b/Application/Admin/Common/extend.php index d9d631072..fe23ce412 100644 --- a/Application/Admin/Common/extend.php +++ b/Application/Admin/Common/extend.php @@ -3021,14 +3021,23 @@ function getMarketAuthPromoteId() { $map['level'] = 1; if (isMarketLeader()) { - $map['admin_id'] = ['gt', 0]; + //搜索所有市场部管理员id + $mid = M("AuthGroup")->where("title like '%市场%'")->getField("id",true); + $mid = implode(",",$mid); + + $admin_id = M("AuthGroupAccess")->where("group_id in ({$mid})")->getField("uid",true); + $admin_id = implode(",",$admin_id); + + $map['admin_id'] = ['in', $admin_id]; }elseif(isMarketAdmin()){ $userAuth = session('user_auth'); $adminId = $userAuth['uid']; $map['admin_id'] = $adminId; + }else{ return false; } + // dd($map['admin_id']); $dbres = M("Promote","tab_")->where($map)->getField("id",true); if(empty($dbres)){ return -1; @@ -3039,12 +3048,13 @@ function getMarketAuthPromoteId() function throwPromoteIdToCompanyId($p_ids) { - $map["id"]=["in","{$p_ids}"]; - $dbres = M("Promote","tab_")->where($map)->group("company_id")->getField("company_id",true); + // $map["id"]=["in",$p_ids]; + $dbres = M("Promote","tab_")->where("id in ({$p_ids})")->field("count(*) count,company_id")->group("company_id")->select(); + // echo($dbres); if(empty($dbres)){ return -1; }else{ - return implode(",",$dbres); + return implode(",",array_column($dbres,"company_id")); } } diff --git a/Application/Admin/Controller/PromoteCompanyController.class.php b/Application/Admin/Controller/PromoteCompanyController.class.php index eaf5f5484..4690b4aa0 100644 --- a/Application/Admin/Controller/PromoteCompanyController.class.php +++ b/Application/Admin/Controller/PromoteCompanyController.class.php @@ -50,9 +50,11 @@ class PromoteCompanyController extends ThinkController //市场部权限begin $pro_id = getMarketAuthPromoteId(); + // dd($pro_id); if($pro_id){ $promotemap["_string"] .=" AND p.id in ({$pro_id})"; $c_id = throwPromoteIdToCompanyId($pro_id); + // dd($c_id); $map["_string"] .=" AND id in ({$c_id})"; } From 96ead18ff6da5d07457239b5f9c02f8348dac45a Mon Sep 17 00:00:00 2001 From: chenzhi Date: Wed, 16 Dec 2020 18:02:26 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Common/extend.php | 3 +-- .../Admin/Controller/PromoteCompanyController.class.php | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/Application/Admin/Common/extend.php b/Application/Admin/Common/extend.php index fe23ce412..62701f740 100644 --- a/Application/Admin/Common/extend.php +++ b/Application/Admin/Common/extend.php @@ -3024,7 +3024,7 @@ function getMarketAuthPromoteId() //搜索所有市场部管理员id $mid = M("AuthGroup")->where("title like '%市场%'")->getField("id",true); $mid = implode(",",$mid); - + $admin_id = M("AuthGroupAccess")->where("group_id in ({$mid})")->getField("uid",true); $admin_id = implode(",",$admin_id); @@ -3037,7 +3037,6 @@ function getMarketAuthPromoteId() }else{ return false; } - // dd($map['admin_id']); $dbres = M("Promote","tab_")->where($map)->getField("id",true); if(empty($dbres)){ return -1; diff --git a/Application/Admin/Controller/PromoteCompanyController.class.php b/Application/Admin/Controller/PromoteCompanyController.class.php index 4690b4aa0..eaf5f5484 100644 --- a/Application/Admin/Controller/PromoteCompanyController.class.php +++ b/Application/Admin/Controller/PromoteCompanyController.class.php @@ -50,11 +50,9 @@ class PromoteCompanyController extends ThinkController //市场部权限begin $pro_id = getMarketAuthPromoteId(); - // dd($pro_id); if($pro_id){ $promotemap["_string"] .=" AND p.id in ({$pro_id})"; $c_id = throwPromoteIdToCompanyId($pro_id); - // dd($c_id); $map["_string"] .=" AND id in ({$c_id})"; } From 78451f0551cdc2f7f8d30c5c5599e60263c952ed Mon Sep 17 00:00:00 2001 From: chenzhi Date: Wed, 16 Dec 2020 18:03:23 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=B6=88=E9=99=A4=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Common/extend.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/Application/Admin/Common/extend.php b/Application/Admin/Common/extend.php index 62701f740..2be802ac6 100644 --- a/Application/Admin/Common/extend.php +++ b/Application/Admin/Common/extend.php @@ -3047,9 +3047,7 @@ function getMarketAuthPromoteId() function throwPromoteIdToCompanyId($p_ids) { - // $map["id"]=["in",$p_ids]; $dbres = M("Promote","tab_")->where("id in ({$p_ids})")->field("count(*) count,company_id")->group("company_id")->select(); - // echo($dbres); if(empty($dbres)){ return -1; }else{