作者 郭盛
1 个管道 的构建 通过 耗费 4 秒

修改数组返回自动匹配

... ... @@ -482,39 +482,30 @@ class Attestation extends Api
}
$where['status'] = ['eq',1];
$data = Db::name('government')
->field('id,company_name')
->where($where)
->select();
if(empty($data)){
$city = Db::name('government')
->field('id,company_name')
->where('province','Like',"$param[province]%")
->where('city',$param['city'])
->select();
if(empty($city)){
$province = Db::name('government')
->field('id,company_name')
->where('province','Like',"$param[province]%")
->select();
if(empty($province)){
$this->success('暂无机构');
}else{
foreach ($province as $v){
$res['id'] = $v['id'];
$res['institution'] = $v['company_name'];
}
$this->success('success',$res);
$this->success('success',$province);
}
}else{
foreach ($city as $v){
$res['id'] = $v['id'];
$res['institution'] = $v['company_name'];
}
$this->success('success',$res);
$this->success('success',$city);
}
}else{
foreach ($data as $v){
$res['id'] = $v['id'];
$res['institution'] = $v['company_name'];
}
$this->success('success',$res);
$this->success('success',$data);
}
}
... ...