|
@@ -38,4 +38,26 @@ class Addr extends BaseController
|
|
|
$list=Db::name("city")->where(['province_code'=>$province_code])->select();
|
|
|
return app_show(0,"获取成功",$list);
|
|
|
}
|
|
|
+
|
|
|
+ public function all(){
|
|
|
+ $post=$this->request->post();
|
|
|
+ $city_code = isset($post['code'])&& $post['code']!="" ? $post['code']:"";
|
|
|
+ if($city_code==""){
|
|
|
+ return error_show(1002,"区级Code未选择");
|
|
|
+ }
|
|
|
+ $data=[];
|
|
|
+ $area =Db::name("area")->where(['area_code'=>$city_code])->field("name,area_code as code,city_code")->find();
|
|
|
+ if($area==false){
|
|
|
+ return error_show(1003,"未找到区级数据");
|
|
|
+ }
|
|
|
+ $data["area"]=$area;
|
|
|
+ $city=Db::name("city")->where(['city_code'=>$area['city_code']])->field("name,city_code as code,province_code")->find();
|
|
|
+ if($city==false){
|
|
|
+ $data["city"]=[];
|
|
|
+ }
|
|
|
+ $data['city']=$city??[];
|
|
|
+ $province=Db::name("province")->where(['province_code'=>$city['province_code']])->field("name,province_code as code")->find();
|
|
|
+ $data['province']=$province??[];
|
|
|
+ return app_show(0,"获取成功",$data);
|
|
|
+ }
|
|
|
}
|