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.
50 lines
1.4 KiB
50 lines
1.4 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()
|
|
{
|
|
$lng = $this->request->input('lng',0);
|
|
$lat = $this->request->input('lat',0);
|
|
return $this->success($this->locationService->getNearestMarket($lng,$lat));
|
|
}
|
|
|
|
public function getMarketListByLocation()
|
|
{
|
|
$lng = $this->request->input('lng',0);
|
|
$lat = $this->request->input('lat',0);
|
|
return $this->success($this->locationService->getMarketListByLocation($lng,$lat));
|
|
}
|
|
|
|
public function getMarketsInfo()
|
|
{
|
|
$ret = [];
|
|
$ret['service_time']='8:30-20:00';
|
|
$ret['markets_info']=$this->locationService->getMarketsInfo();
|
|
|
|
return $this->success($ret);
|
|
}
|
|
}
|