添加:代理信息分组查询接口

添加:获取全部下级接口
This commit is contained in:
wuhui_zzw 2024-03-20 15:27:08 +08:00
parent 5ae9a67e28
commit 5efcff9683
3 changed files with 47 additions and 1 deletions

View File

@ -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=区县运营商

View File

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

View File

@ -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' => '代理编辑',
]);