Store.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace app\api\controller\store;
  3. use app\api\controller\Controller;
  4. use app\api\model\store\Store as StoreModel;
  5. use app\common\library\easywechat\AppMp;
  6. /**
  7. * 门店列表
  8. */
  9. class Store extends Controller
  10. {
  11. /**
  12. * 门店列表
  13. */
  14. public function lists($longitude = '', $latitude = '', $url = '', $shop_supplier_id = 0)
  15. {
  16. $model = new StoreModel;
  17. $list = $model->getList(true, $longitude, $latitude, false, $shop_supplier_id);
  18. $signPackage = '';
  19. if($url != ''){
  20. $app = AppMp::getApp($this->app_id);
  21. $app->jssdk->setUrl($url);
  22. $signPackage = $app->jssdk->buildConfig(array('getLocation', 'openLocation'), false);
  23. }
  24. return $this->renderSuccess('', compact('list', 'signPackage'));
  25. }
  26. /**
  27. * 选择门店列表
  28. */
  29. public function choiceLists($longitude = '', $latitude = '', $url = '', $shop_supplier_id = 0)
  30. {
  31. $model = new StoreModel;
  32. $list = $model->getChoiceLists(true, $longitude, $latitude, false, $shop_supplier_id);
  33. $signPackage = '';
  34. if($url != ''){
  35. $app = AppMp::getApp($this->app_id);
  36. $app->jssdk->setUrl($url);
  37. $signPackage = $app->jssdk->buildConfig(array('getLocation', 'openLocation'), false);
  38. }
  39. return $this->renderSuccess('', compact('list', 'signPackage'));
  40. }
  41. /**
  42. * 门店详情
  43. */
  44. public function detail($store_id)
  45. {
  46. $detail = StoreModel::detail($store_id);
  47. return $this->renderSuccess('', compact('detail'));
  48. }
  49. }