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.

60 lines
1.6 KiB

  1. <?php
  2. namespace App\Controller\v3;
  3. use App\Controller\BaseController;
  4. use App\Service\v3\Interfaces\LocationServiceInterface;
  5. use Hyperf\Di\Annotation\Inject;
  6. /**
  7. * 定位相关
  8. * Class LocationController
  9. * @package App\Controller\v3
  10. */
  11. class LocationController extends BaseController
  12. {
  13. /**
  14. * @Inject
  15. * @var LocationServiceInterface
  16. */
  17. protected $locationService;
  18. /**
  19. * 获取当前用户定位最近的市场
  20. * 1.用户上报经纬度数据
  21. * 2.如果经纬度不存在或无法获取到最近市场信息,则返回空数据
  22. * 3.根据经纬度查询获取市场数据,id、名称、省份、城市、行政区、地址、经纬度
  23. */
  24. public function getNearestMarket()
  25. {
  26. return $this->success([
  27. 'market' => [
  28. 'id' => 1,
  29. 'name' => '海尔青啤',
  30. 'province_id' => 1,
  31. 'province_name' => '广西',
  32. 'city_id' => 2,
  33. 'city_name' => '南宁市',
  34. 'area_id' => 3,
  35. 'area_name' => '良庆区',
  36. 'address' => '海尔青啤广场',
  37. 'lng' => '108.383566',
  38. 'lat' => '22.759946',
  39. ]
  40. ]);
  41. }
  42. public function getMarketListByLocation()
  43. {
  44. $cityIds = [2163,2189];
  45. return $this->success($this->locationService->getMarketListByLocation($cityIds));
  46. }
  47. public function getMarketsInfo()
  48. {
  49. $ret = [];
  50. $ret['service_time']='8:30-20:00';
  51. $ret['markets_info']=$this->locationService->getMarketsInfo();
  52. return $this->success($ret);
  53. }
  54. }