feat : site
This commit is contained in:
@@ -22,4 +22,9 @@ class SystemController extends AbstractController
|
||||
{
|
||||
return (new SiteListService)->handle();
|
||||
}
|
||||
|
||||
public function getCityList()
|
||||
{
|
||||
return (new SiteListService)->handle();
|
||||
}
|
||||
}
|
||||
|
||||
19
app/Service/Api/System/CityListService.php
Normal file
19
app/Service/Api/System/CityListService.php
Normal 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
|
||||
}
|
||||
}
|
||||
@@ -42,6 +42,9 @@ class SiteListService extends BaseService
|
||||
if (empty($list['data'])) return $this->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']]
|
||||
|
||||
Reference in New Issue
Block a user