You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
781 B
43 lines
781 B
<?php
|
|
|
|
namespace app\base\model\district;
|
|
|
|
use app\base\model\Base;
|
|
use think\model\concern\SoftDelete;
|
|
|
|
|
|
class District extends Base
|
|
{
|
|
|
|
use SoftDelete;
|
|
|
|
// 设置当前模型对应的完整数据表名称
|
|
protected $table = 'base_district';
|
|
|
|
/**
|
|
* 获取全部省市区三级行政区划
|
|
* @date 2021-02-05
|
|
*/
|
|
public function listDistrict()
|
|
{
|
|
// 查询三级行政区划
|
|
$district_list = $this->field('id,pid,name')->select()->toArray();
|
|
|
|
return $district_list;
|
|
}
|
|
|
|
/**
|
|
* 获取全部名称
|
|
* @date 2021-03-01
|
|
*/
|
|
public function getDistrictName($id)
|
|
{
|
|
$district_name = $this->getOneData([
|
|
['id', '=', $id]
|
|
], 'name');
|
|
|
|
return $district_name;
|
|
}
|
|
|
|
}
|