From 132b601f7453246f0301f7a4cd93db3f7159e8a8 Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Wed, 29 Apr 2020 15:12:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=B5=84=E6=BA=90=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E5=8A=9F=E8=83=BD=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/Controller/AjaxController.class.php | 11 ++++++++ .../TestResourceController.class.php | 7 +++++- .../Admin/Model/PromoteModel.class.php | 25 +++++++++++++++++++ .../View/TestResource/supportNumberList.html | 2 +- 4 files changed, 43 insertions(+), 2 deletions(-) diff --git a/Application/Admin/Controller/AjaxController.class.php b/Application/Admin/Controller/AjaxController.class.php index c438a2f3f..f579f16c6 100644 --- a/Application/Admin/Controller/AjaxController.class.php +++ b/Application/Admin/Controller/AjaxController.class.php @@ -587,4 +587,15 @@ class AjaxController extends ThinkController{ $result = M('promote', 'tab_')->field("id,account,nickname")->where(['parent_id'=>$pid])->select(); $this->ajaxReturn(['code'=>1, 'data'=>$result]); } + + public function getPromotersByLevelResource() + { + $level = I('level'); + if (!$level) { +// return $this->ajaxReturn(['code'=>1, 'msg'=>'获取成功', 'data'=>[]]); + $level = ''; + } + $this->ajaxReturn(['code'=>1, 'msg'=>'获取成功', 'data'=>(new PromoteModel)->getPromotersByLevelResource($level)]); + } + } \ No newline at end of file diff --git a/Application/Admin/Controller/TestResourceController.class.php b/Application/Admin/Controller/TestResourceController.class.php index 6a22b9c3d..b2ee6593b 100644 --- a/Application/Admin/Controller/TestResourceController.class.php +++ b/Application/Admin/Controller/TestResourceController.class.php @@ -78,7 +78,7 @@ class TestResourceController extends ThinkController if(!empty(I('user_account'))){ $map['tab_test_resource.user_account']=['like','%'.I('user_account').'%']; } - if(!empty(I('promote_id'))){ + if(!empty(I('promote_id')) || I('promote_id')=="0"){ $promote_id = I('promote_id'); @@ -90,6 +90,11 @@ class TestResourceController extends ThinkController $promnote_arr = implode(",",$promnote_arr); $map['tab_test_resource.promote_id']=['in',$promnote_arr]; + + if (!I("promote_level")) { + $map['tab_test_resource.promote_id']=I('promote_id'); + } + } //为数据权限添加 setPowerPromoteIds($map, 'tab_test_resource.promote_id'); diff --git a/Application/Admin/Model/PromoteModel.class.php b/Application/Admin/Model/PromoteModel.class.php index 6b80b7179..b5d1d781f 100644 --- a/Application/Admin/Model/PromoteModel.class.php +++ b/Application/Admin/Model/PromoteModel.class.php @@ -450,5 +450,30 @@ class PromoteModel extends Model{ } + public function getPromotersByLevelResource($level) + { + + if ($level) { + $where['level'] = $level; + } + + $userAuth = session('user_auth'); + setPowerPromoteIds($where,'id'); + + $offcialData = [0=>['id'=>0,'nickname'=>'官方渠道']]; + + $result = $this->field("*")->where($where)->select(); + foreach ($result as &$item) { + $item['nickname'] = $item['account'] . ($item['nickname'] ? "({$item['nickname']})" : ""); + } + + if ((in_array('0',explode(',',$where['id'][1]))||$userAuth['data_empower_type']==1)) { + $result = array_merge($offcialData,$result); +// dump($result);die(); + } + + return $result; + } + } \ No newline at end of file diff --git a/Application/Admin/View/TestResource/supportNumberList.html b/Application/Admin/View/TestResource/supportNumberList.html index 98ddc53c2..41934642b 100644 --- a/Application/Admin/View/TestResource/supportNumberList.html +++ b/Application/Admin/View/TestResource/supportNumberList.html @@ -243,7 +243,7 @@ var promote_id = "{:I('promote_id')}"; $("#promote_level").change(function(){ $.ajax({ - url:"{:U('Ajax/getPromotersByLevelOther')}", + url:"{:U('Ajax/getPromotersByLevelResource')}", type:"get", data:{level:$("#promote_level option:selected").val()}, dataType:'json',