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.

47 lines
1.2 KiB

5 years ago
  1. <?php
  2. namespace App\Controller\v3;
  3. use App\Controller\BaseController;
  4. use App\Model\v3\Market;
  5. use App\Service\v3\Interfaces\LocationServiceInterface;
  6. use Hyperf\Di\Annotation\Inject;
  7. /**
  8. * 定位相关
  9. * Class LocationController
  10. * @package App\Controller\v3
  11. */
  12. class LocationController extends BaseController
  13. {
  14. /**
  15. * @Inject
  16. * @var LocationServiceInterface
  17. */
  18. protected $locationService;
  19. /**
  20. * 获取当前用户定位最近的市场
  21. * 1.用户上报经纬度数据
  22. * 2.如果经纬度不存在或无法获取到最近市场信息,则返回空数据
  23. * 3.根据经纬度查询获取市场数据,id、名称、省份、城市、行政区、地址、经纬度
  24. */
  25. public function getNearestMarket()
  26. {
  27. return $this->success(['market' => Market::query()->find(1)]);
  28. }
  29. public function getMarketListByLocation()
  30. {
  31. $cityIds = [2163,2189];
  32. return $this->success($this->locationService->getMarketListByLocation($cityIds));
  33. }
  34. public function getMarketsInfo()
  35. {
  36. $ret = [];
  37. $ret['service_time']='8:30-20:00';
  38. $ret['markets_info']=$this->locationService->getMarketsInfo();
  39. return $this->success($ret);
  40. }
  41. }