From e92a1cd8c0634112042eeec65948d75319d4734c Mon Sep 17 00:00:00 2001 From: ctexthuang Date: Fri, 28 Feb 2025 18:00:31 +0800 Subject: [PATCH] feat : site --- app/Controller/Api/SystemController.php | 5 +++++ app/Service/Api/System/CityListService.php | 19 +++++++++++++++++++ app/Service/Api/System/SiteListService.php | 3 +++ 3 files changed, 27 insertions(+) create mode 100644 app/Service/Api/System/CityListService.php diff --git a/app/Controller/Api/SystemController.php b/app/Controller/Api/SystemController.php index 4f08d03..cc397a6 100644 --- a/app/Controller/Api/SystemController.php +++ b/app/Controller/Api/SystemController.php @@ -22,4 +22,9 @@ class SystemController extends AbstractController { return (new SiteListService)->handle(); } + + public function getCityList() + { + return (new SiteListService)->handle(); + } } diff --git a/app/Service/Api/System/CityListService.php b/app/Service/Api/System/CityListService.php new file mode 100644 index 0000000..e3b8dc0 --- /dev/null +++ b/app/Service/Api/System/CityListService.php @@ -0,0 +1,19 @@ +return->success('success', ['list' => $list]); foreach ($list['data'] as &$item) { + $item['gap'] = 0; + if (empty($this->request->input('lng')) || empty($this->request->input('lat'))) continue; + $item['gap'] = SystemUtil::calculateDistance( ['lng' => $this->request->input('lng'),'lat' => $this->request->input('lat')], ['lng' => $item['lng'], 'lat' => $item['lat']]