This commit is contained in:
mkm 2023-08-17 10:39:05 +08:00
parent b1f54af78d
commit d320eeaba7

View File

@ -46,9 +46,9 @@ class CompanyController extends BaseAdminController
return $this->dataLists(new CompanyLists());
}
public function list_two(){
public function list_two()
{
return $this->success('ok', (new CompanyLists())->list_two());
}
/**
@ -234,4 +234,47 @@ class CompanyController extends BaseAdminController
$data['lists'] = $result;
return $this->success('success', $data);
}
public function responsible_area()
{
$parmas = $this->request->param();
if (!isset($parmas['key']) && isset($parmas['key']) == '' || !isset($parmas['value']) && isset($parmas['value']) == '') {
return $this->fail('参数错误');
}
if ($parmas['key'] == 'city') {
$where[] = ['area', '=', 0];
}
$where[] = [$parmas['key'], '=', $parmas['value']];
switch ($parmas['key']) {
case 'city':
$where[] = ['area', '=', 0];
break;
case 'area':
$where[] = ['street', '=', 0];
break;
case 'street':
$where[] = ['village', '=', 0];
break;
case 'village':
$where[] = ['brigade', '=', 0];
break;
}
$res = Company::where($where)->column('responsible_area');
foreach($res as $k=>$v){
$res[$k] = explode(',',$v);
}
$data=[];
foreach($res as $k=>$v){
foreach($v as $kk=>$vv){
if($vv != ''){
$data[] = $vv;
}
}
}
return $this->success('success', $data);
}
}