diff --git a/crmeb/app/adminapi/controller/v1/setting/SystemCity.php b/crmeb/app/adminapi/controller/v1/setting/SystemCity.php index ab59da463..cf67a54ec 100644 --- a/crmeb/app/adminapi/controller/v1/setting/SystemCity.php +++ b/crmeb/app/adminapi/controller/v1/setting/SystemCity.php @@ -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()); + } } diff --git a/crmeb/app/adminapi/route/setting.php b/crmeb/app/adminapi/route/setting.php index f9f753b50..b50ac455a 100644 --- a/crmeb/app/adminapi/route/setting.php +++ b/crmeb/app/adminapi/route/setting.php @@ -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' => '获取城市数据列表']); //添加城市数据表单 diff --git a/crmeb/app/dao/shipping/SystemCityDao.php b/crmeb/app/dao/shipping/SystemCityDao.php index 424e61496..2f2115e05 100644 --- a/crmeb/app/dao/shipping/SystemCityDao.php +++ b/crmeb/app/dao/shipping/SystemCityDao.php @@ -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(); + } } diff --git a/crmeb/app/services/shipping/SystemCityServices.php b/crmeb/app/services/shipping/SystemCityServices.php index c65c27d84..0d1f90ff3 100644 --- a/crmeb/app/services/shipping/SystemCityServices.php +++ b/crmeb/app/services/shipping/SystemCityServices.php @@ -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 {