From aa78a4870336fbbbedf24546a1eaebbcf86cfd9b Mon Sep 17 00:00:00 2001 From: evoxwht <442384644@qq.com> Date: Mon, 10 Apr 2023 11:04:49 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=9F=8E=E5=B8=82?= =?UTF-8?q?=E6=95=B0=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 --- crmeb/app/adminapi/controller/v1/setting/SystemCity.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crmeb/app/adminapi/controller/v1/setting/SystemCity.php b/crmeb/app/adminapi/controller/v1/setting/SystemCity.php index cf67a54ec..d698cae59 100644 --- a/crmeb/app/adminapi/controller/v1/setting/SystemCity.php +++ b/crmeb/app/adminapi/controller/v1/setting/SystemCity.php @@ -150,6 +150,6 @@ class SystemCity extends AuthController */ public function fullList() { - return app('json')->success($this->services->fullList()); + return app('json')->success($this->services->fullList('parent_id,city_id,id,name,name as label,city_id as value')); } } From d6db8fabdd1d97ea5a17a2d65ba156793d76513b Mon Sep 17 00:00:00 2001 From: evoxwht <442384644@qq.com> Date: Mon, 10 Apr 2023 11:08:12 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=9F=8E=E5=B8=82?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=AE=8C=E6=95=B4=E5=88=97=E8=A1=A8=E5=8A=A0?= =?UTF-8?q?=E5=85=A5=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/adminapi/controller/v1/setting/SystemCity.php | 5 +++-- crmeb/app/services/shipping/SystemCityServices.php | 11 ++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/crmeb/app/adminapi/controller/v1/setting/SystemCity.php b/crmeb/app/adminapi/controller/v1/setting/SystemCity.php index d698cae59..2d83f000f 100644 --- a/crmeb/app/adminapi/controller/v1/setting/SystemCity.php +++ b/crmeb/app/adminapi/controller/v1/setting/SystemCity.php @@ -133,8 +133,9 @@ class SystemCity extends AuthController */ public function clean_cache() { - $res = CacheService::delete('CITY_LIST'); - if ($res) { + $res1 = CacheService::delete('CITY_LIST'); + $res2 = CacheService::delete('CITY_FULL_LIST'); + if ($res1 && $res2) { return app('json')->success(400185); } else { return app('json')->fail(400186); diff --git a/crmeb/app/services/shipping/SystemCityServices.php b/crmeb/app/services/shipping/SystemCityServices.php index c949d3c28..954da63ec 100644 --- a/crmeb/app/services/shipping/SystemCityServices.php +++ b/crmeb/app/services/shipping/SystemCityServices.php @@ -28,7 +28,6 @@ use crmeb\services\FormBuilder as Form; * @method update($id, array $data, ?string $key = null) 修改数据 * @method value(array $where, ?string $field = '') 获取一条数据 * @method getShippingCity() 获取运费模板城市数据 - * @method fullList(?$field = '') 获取城市数据完整列表 */ class SystemCityServices extends BaseServices { @@ -153,4 +152,14 @@ class SystemCityServices extends BaseServices }, 0); } + /** + * 获取城市数据 + * @return mixed + */ + public function fullList($field = '*') + { + return CacheService::remember('CITY_FULL_LIST', function () use ($field) { + return $this->dao->fullList($field); + }, 0); + } }