add 省市区县镇村地区接口
This commit is contained in:
parent
d28f12e0cf
commit
4e9a867432
|
@ -0,0 +1,46 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\adminapi\controller;
|
||||||
|
|
||||||
|
use think\facade\Db;
|
||||||
|
|
||||||
|
class CommonController extends BaseAdminController
|
||||||
|
{
|
||||||
|
public array $notNeedLogin = ['city', 'area', 'street','village','brigade'];
|
||||||
|
|
||||||
|
//**省列表 */
|
||||||
|
public function province()
|
||||||
|
{
|
||||||
|
$data = Db::name('geo_province')->where(['switch' => 1])->select();
|
||||||
|
return $this->data($data->toArray());
|
||||||
|
} //**市列表 */
|
||||||
|
public function city($city)
|
||||||
|
{
|
||||||
|
$data = Db::name('geo_city')->where(['province_code' => $city])->select();
|
||||||
|
return $this->data($data->toArray());
|
||||||
|
}
|
||||||
|
//**区域列表 */
|
||||||
|
public function area($area)
|
||||||
|
{
|
||||||
|
$data = Db::name('geo_area')->where(['city_code' => $area])->select();
|
||||||
|
return $this->data($data->toArray());
|
||||||
|
}
|
||||||
|
//**街道列表 */
|
||||||
|
public function street($street)
|
||||||
|
{
|
||||||
|
$data = Db::name('geo_street')->where(['area_code' => $street])->select();
|
||||||
|
return $this->data($data->toArray());
|
||||||
|
}
|
||||||
|
//**村列表 */
|
||||||
|
public function village($village)
|
||||||
|
{
|
||||||
|
$data = Db::name('geo_village')->where(['street_code' => $village])->select();
|
||||||
|
return $this->data($data->toArray());
|
||||||
|
}
|
||||||
|
//**小队列表 */
|
||||||
|
public function brigade()
|
||||||
|
{
|
||||||
|
$data = Db::name('geo_brigade')->select();
|
||||||
|
return $this->data($data->toArray());
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue