From 15e214ff3ab6886329dcf87378a7e13ea0772fd1 Mon Sep 17 00:00:00 2001 From: evoxwht <442384644@qq.com> Date: Mon, 10 Apr 2023 10:55:36 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=9F=8E=E5=B8=82=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=AE=8C=E6=95=B4=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adminapi/controller/v1/setting/SystemCity.php | 12 ++++++++++++ crmeb/app/adminapi/route/setting.php | 2 ++ crmeb/app/dao/shipping/SystemCityDao.php | 13 ++++++++++++- crmeb/app/services/shipping/SystemCityServices.php | 1 + 4 files changed, 27 insertions(+), 1 deletion(-) 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 {