Store.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. use app\common\model\supplier\Supplier;
  7. /**
  8. * 门店列表
  9. */
  10. class Store extends Controller
  11. {
  12. /**
  13. * 门店列表
  14. */
  15. public function lists($longitude = '', $latitude = '', $url = '', $shop_supplier_id = 0)
  16. {
  17. $model = new StoreModel;
  18. $list = $model->getList(true, $longitude, $latitude, false, $shop_supplier_id);
  19. $signPackage = '';
  20. if($url != ''){
  21. $app = AppMp::getApp($this->app_id);
  22. $app->jssdk->setUrl($url);
  23. $signPackage = $app->jssdk->buildConfig(array('getLocation', 'openLocation'), false);
  24. }
  25. return $this->renderSuccess('', compact('list', 'signPackage'));
  26. }
  27. /**
  28. * 选择门店列表
  29. */
  30. public function choiceLists($longitude = '', $latitude = '', $url = '', $shop_supplier_id = 0)
  31. {
  32. $model = new StoreModel;
  33. $list = $model->getChoiceLists(true, $longitude, $latitude, false, $shop_supplier_id);
  34. return $this->renderSuccess('', compact('list'));
  35. }
  36. /**
  37. * 门店详情
  38. */
  39. public function detail($store_id)
  40. {
  41. $detail = StoreModel::detail($store_id);
  42. if($detail['shop_supplier_id']){
  43. $detail['dyLink'] = Supplier::getDyLink($detail['shop_supplier_id'], $this->app_id);
  44. }
  45. return $this->renderSuccess('', compact('detail'));
  46. }
  47. }