From 5efcff96838ef3937cdf64e52b9ab237906e49cb Mon Sep 17 00:00:00 2001 From: wuhui_zzw <1760308791@qq.com> Date: Wed, 20 Mar 2024 15:27:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=EF=BC=9A=E4=BB=A3=E7=90=86?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=88=86=E7=BB=84=E6=9F=A5=E8=AF=A2=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=20=E6=B7=BB=E5=8A=A0=EF=BC=9A=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=85=A8=E9=83=A8=E4=B8=8B=E7=BA=A7=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/dao/marketing/AgentDao.php | 3 +- app/controller/admin/marketing/Agent.php | 39 ++++++++++++++++++++++++ route/admin/marketing.php | 6 ++++ 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/app/common/dao/marketing/AgentDao.php b/app/common/dao/marketing/AgentDao.php index addfade..b1f063e 100644 --- a/app/common/dao/marketing/AgentDao.php +++ b/app/common/dao/marketing/AgentDao.php @@ -36,7 +36,8 @@ class AgentDao extends BaseDao{ $query->where('contact_phone', $params['contact_phone']); }) ->when(isset($params['agent_type']) && $params['agent_type'] !== '',function($query) use ($params){ - $query->where('agent_type', (int)$params['agent_type']); + if(is_array($params['agent_type'])) $query->whereIn('agent_type', (array)$params['agent_type']); + else $query->where('agent_type', (int)$params['agent_type']); }) ->when(isset($params['is_invite_supplier']) && $params['is_invite_supplier'] !== '',function($query) use ($params){ // 仅获取拥有【供应商】邀请权限的代理人员 类型:1=发起人,2=省公司,3=省合伙人(外勤),4=省合伙人(内勤),5=区县运营商 diff --git a/app/controller/admin/marketing/Agent.php b/app/controller/admin/marketing/Agent.php index 5991e56..86576db 100644 --- a/app/controller/admin/marketing/Agent.php +++ b/app/controller/admin/marketing/Agent.php @@ -25,6 +25,45 @@ class Agent extends BaseController{ return app('json')->success($data); } + /** + * Common: 代理列表 - 新 + * Author: wu-hui + * Time: 2024/03/20 14:32 + * @return mixed + */ + public function newAgentList(){ + [$page, $limit] = $this->getPage(); + $params = $this->request->params(['uid','agent_type','contact_name','contact_phone','is_invite_supplier','group_key']); + // group_key: 1=总部、2=省公司运营中心、3=区县运营中心、4=烟酒馆运营中心、5=联盟商家 + // agent_type: + // 总部:1=总部发起人,9=总部外勤,10=总部内勤 + // 省公司运营中心:2=省公司发起人,3=省合伙人(外勤),4=省合伙人(内勤) + // 区县运营中心:5=区县运营商,6=区县合伙人 + // 烟酒馆运营中心:11=烟酒店代销商 + // 联盟商家:7=餐厅,8=配送商 + switch((int)$params['group_key']){ + case 1: $params['agent_type'] = 1;break; + case 2: $params['agent_type'] = 2;break; + case 3: $params['agent_type'] = 5;break; + case 4: $params['agent_type'] = 11;break; + case 5: $params['agent_type'] = [7,8];break; + } + $data = app()->make(AgentRepository::class)->getList((array)$params,(int)$page,(int)$limit); + + return app('json')->success($data); + } + /** + * Common: 获取全部下级 + * Author: wu-hui + * Time: 2024/03/20 14:53 + * @return mixed + */ + public function childrenList(){ + $params = $this->request->params(['pid']); + $list = app()->make(AgentRepository::class)->getSearchModel((array)$params)->select()->toArray(); + + return app('json')->success($list); + } /** * Common: 编辑信息 * Author: wu-hui diff --git a/route/admin/marketing.php b/route/admin/marketing.php index a4f3e5b..a6e88c5 100644 --- a/route/admin/marketing.php +++ b/route/admin/marketing.php @@ -469,6 +469,12 @@ Route::group(function () { Route::get('list','/agentList')->name('systemMarketingAgentList')->option([ '_alias' => '代理列表', ]); + Route::get('new_list','/newAgentList')->name('systemMarketingNewAgentList')->option([ + '_alias' => '代理列表(新)', + ]); + Route::get('children_list','/childrenList')->name('systemMarketingChildrenList')->option([ + '_alias' => '下级代理列表(新)', + ]); Route::post('edit_info','/editInfo')->name('systemMarketingAgentEditInfo')->option([ '_alias' => '代理编辑', ]);