2023-12-14 14:10:40 +08:00
|
|
|
<?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)
|
|
|
|
{
|
2023-12-15 17:49:05 +08:00
|
|
|
$data = Db::name('geo_county')->where(['city_code' => $area])->select();
|
2023-12-14 14:10:40 +08:00
|
|
|
return $this->data($data->toArray());
|
|
|
|
}
|
|
|
|
//**街道列表 */
|
|
|
|
public function street($street)
|
|
|
|
{
|
2023-12-15 17:49:05 +08:00
|
|
|
$data = Db::name('geo_town')->where(['county_code' => $street])->select();
|
2023-12-14 14:10:40 +08:00
|
|
|
return $this->data($data->toArray());
|
|
|
|
}
|
|
|
|
//**村列表 */
|
|
|
|
public function village($village)
|
|
|
|
{
|
2023-12-15 17:49:05 +08:00
|
|
|
$data = Db::name('geo_village')->where(['town_code' => $village])->select();
|
2023-12-14 14:10:40 +08:00
|
|
|
return $this->data($data->toArray());
|
|
|
|
}
|
|
|
|
//**小队列表 */
|
|
|
|
public function brigade()
|
|
|
|
{
|
2023-12-15 17:49:05 +08:00
|
|
|
$data = Db::name('geo_group')->select();
|
2023-12-14 14:10:40 +08:00
|
|
|
return $this->data($data->toArray());
|
|
|
|
}
|
|
|
|
}
|