feat : site

This commit is contained in:
2025-02-28 18:00:31 +08:00
parent 3b9a85946d
commit e92a1cd8c0
3 changed files with 27 additions and 0 deletions

View File

@@ -22,4 +22,9 @@ class SystemController extends AbstractController
{ {
return (new SiteListService)->handle(); return (new SiteListService)->handle();
} }
public function getCityList()
{
return (new SiteListService)->handle();
}
} }

View File

@@ -0,0 +1,19 @@
<?php
/**
* This service file is part of item.
*
* @author ctexthuang
* @contact ctexthuang@qq.com
*/
declare(strict_types=1);
namespace App\Service\Api\System;
class CityListService extends
{
public function handle()
{
//todo Write logic
}
}

View File

@@ -42,6 +42,9 @@ class SiteListService extends BaseService
if (empty($list['data'])) return $this->return->success('success', ['list' => $list]); if (empty($list['data'])) return $this->return->success('success', ['list' => $list]);
foreach ($list['data'] as &$item) { foreach ($list['data'] as &$item) {
$item['gap'] = 0;
if (empty($this->request->input('lng')) || empty($this->request->input('lat'))) continue;
$item['gap'] = SystemUtil::calculateDistance( $item['gap'] = SystemUtil::calculateDistance(
['lng' => $this->request->input('lng'),'lat' => $this->request->input('lat')], ['lng' => $this->request->input('lng'),'lat' => $this->request->input('lat')],
['lng' => $item['lng'], 'lat' => $item['lat']] ['lng' => $item['lng'], 'lat' => $item['lat']]