Store.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. /**
  3. * Index.php
  4. * Niushop商城系统 - 团队十年电商经验汇集巨献!
  5. * =========================================================
  6. * Copy right 2015-2025 山西牛酷信息科技有限公司, 保留所有权利。
  7. * ----------------------------------------------
  8. * 官方网址: http://www.niushop.com.cn
  9. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用。
  10. * 任何企业和个人不允许对程序代码以任何形式任何目的再发布。
  11. * =========================================================
  12. * @author : niuteam
  13. * @date : 2015.1.17
  14. * @version : v1.0.0.0
  15. */
  16. namespace app\api\controller;
  17. use app\model\store\Store as StoreModel;
  18. /**
  19. * 门店
  20. * @author Administrator
  21. *
  22. */
  23. class Store extends BaseApi
  24. {
  25. /**
  26. * 列表信息
  27. */
  28. public function page()
  29. {
  30. $page = isset($this->params['page']) ? $this->params['page'] : 1;
  31. $page_size = isset($this->params['page_size']) ? $this->params['page_size'] : PAGE_LIST_ROWS;
  32. $site_id = isset($this->params['site_id']) ? $this->params['site_id'] : 0;
  33. if (empty($site_id)) {
  34. return $this->response($this->error('', 'REQUEST_SITE_ID'));
  35. }
  36. $store_model = new StoreModel();
  37. $condition = [
  38. [ 'site_id', "=", $site_id ],
  39. [ 'status', '=', 1 ],
  40. [ 'is_frozen', '=', 0 ],
  41. ];
  42. $list = $store_model->getStorePageList($condition, $page, $page_size, 'create_time desc', 'store_id,store_name,telphone,store_image,site_id,site_name,address,full_address,longitude,latitude,open_date,username');
  43. return $this->response($list);
  44. }
  45. /**
  46. * 基础信息
  47. * @return false|string
  48. */
  49. public function info()
  50. {
  51. $store_id = isset($this->params['store_id']) ? $this->params['store_id'] : 0;
  52. $site_id = isset($this->params['site_id']) ? $this->params['site_id'] : 0;
  53. if (empty($site_id)) {
  54. return $this->response($this->error('', 'REQUEST_SITE_ID'));
  55. }
  56. if (empty($store_id)) {
  57. return $this->response($this->error('', 'REQUEST_STORE_ID'));
  58. }
  59. $condition = [
  60. [ 'store_id', "=", $store_id ],
  61. [ 'site_id', "=", $site_id ],
  62. [ 'status', '=', 1 ]
  63. ];
  64. $store_model = new StoreModel();
  65. $list = $store_model->getStoreInfo($condition, 'store_id,store_name,telphone,store_image,site_id,site_name,address,full_address,longitude,latitude,open_date,username');
  66. return $this->response($list);
  67. }
  68. }