获取城市数据完整列表

This commit is contained in:
evoxwht 2023-04-10 10:55:36 +08:00
parent 3ce0581e36
commit 15e214ff3a
4 changed files with 27 additions and 1 deletions

View File

@ -140,4 +140,16 @@ class SystemCity extends AuthController
return app('json')->fail(400186);
}
}
/**
* 获取城市数据完整列表
* @return \think\Response
* @author 吴汐
* @email 442384644@qq.com
* @date 2023/04/10
*/
public function fullList()
{
return app('json')->success($this->services->fullList());
}
}

View File

@ -77,6 +77,8 @@ Route::group('setting', function () {
Route::put('group_data/set_status/:id/:status', 'v1.setting.SystemGroupData/set_status')->option(['real_name' => '修改组合数据状态']);
//数据配置保存
Route::post('group_data/save_all', 'v1.setting.SystemGroupData/saveAll')->option(['real_name' => '提交数据配置']);
//获取城市数据完整列表
Route::get('city/full_list', 'v1.setting.SystemCity/fullList')->option(['real_name' => '获取城市数据完整列表']);
//获取城市数据列表
Route::get('city/list/:parent_id', 'v1.setting.SystemCity/index')->option(['real_name' => '获取城市数据列表']);
//添加城市数据表单

View File

@ -39,7 +39,7 @@ class SystemCityDao extends BaseDao
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getCityList(array $where,string $field = '*')
public function getCityList(array $where, string $field = '*')
{
return $this->search($where)->field($field)->select()->toArray();
}
@ -87,4 +87,15 @@ class SystemCityDao extends BaseDao
{
return $this->getModel()->with('children')->where('parent_id', 0)->order('id asc')->select()->toArray();
}
/**
* 获取城市数据完整列表
* @author 吴汐
* @email 442384644@qq.com
* @date 2023/04/10
*/
public function fullList()
{
return $this->getModel()->with('children')->order('id asc')->select()->toArray();
}
}

View File

@ -28,6 +28,7 @@ use crmeb\services\FormBuilder as Form;
* @method update($id, array $data, ?string $key = null) 修改数据
* @method value(array $where, ?string $field = '') 获取一条数据
* @method getShippingCity() 获取运费模板城市数据
* @method fullList() 获取城市数据完整列表
*/
class SystemCityServices extends BaseServices
{