You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.2 KiB
48 lines
1.2 KiB
<?php
|
|
|
|
namespace App\Controller\v3;
|
|
|
|
use App\Controller\BaseController;
|
|
use App\Model\v3\Market;
|
|
use App\Service\v3\Interfaces\LocationServiceInterface;
|
|
use Hyperf\Di\Annotation\Inject;
|
|
|
|
/**
|
|
* 定位相关
|
|
* Class LocationController
|
|
* @package App\Controller\v3
|
|
*/
|
|
class LocationController extends BaseController
|
|
{
|
|
/**
|
|
* @Inject
|
|
* @var LocationServiceInterface
|
|
*/
|
|
protected $locationService;
|
|
|
|
/**
|
|
* 获取当前用户定位最近的市场
|
|
* 1.用户上报经纬度数据
|
|
* 2.如果经纬度不存在或无法获取到最近市场信息,则返回空数据
|
|
* 3.根据经纬度查询获取市场数据,id、名称、省份、城市、行政区、地址、经纬度
|
|
*/
|
|
public function getNearestMarket()
|
|
{
|
|
return $this->success(['market' => Market::query()->find(1)]);
|
|
}
|
|
|
|
public function getMarketListByLocation()
|
|
{
|
|
$cityIds = [2163,2189];
|
|
return $this->success($this->locationService->getMarketListByLocation($cityIds));
|
|
}
|
|
|
|
public function getMarketsInfo()
|
|
{
|
|
$ret = [];
|
|
$ret['service_time']='8:30-20:00';
|
|
$ret['markets_info']=$this->locationService->getMarketsInfo();
|
|
|
|
return $this->success($ret);
|
|
}
|
|
}
|