123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <?php
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- namespace app\api\controller;
-
- use app\common\basics\Api;
- use app\common\server\JsonServer;
- use think\facade\Validate;
- use app\api\logic\ShopLogic;
-
-
- class Shop extends Api
- {
- public $like_not_need_login = ['getShopInfo', 'getShopList','getNearbyShops'];
-
-
-
- public function getShopInfo()
- {
- if($this->request->isGet()) {
- $shopId = $this->request->get('shop_id', '', 'trim');
- $validate = Validate::rule('shop_id', 'require|integer|gt:0');
- if(!$validate->check(['shop_id'=>$shopId])) {
- return JsonServer::error($validate->getError());
- }
- $data = ShopLogic::getShopInfo($shopId, $this->user_id, input());
- return JsonServer::success('获取店铺信息成功', $data);
- }else{
- return JsonServer::error('请求类型错误');
- }
- }
-
-
-
- public function getShopList()
- {
- if($this->request->isGet()) {
- $get = $this->request->get();
- $get['page_no'] = $this->page_no;
- $get['page_size'] = $this->page_size;
- $data = ShopLogic::getShopList($get);
- return JsonServer::success('获取店铺列表成功', $data);
- }else{
- return JsonServer::error('请求类型错误');
- }
- }
-
-
-
-
- public function getNearbyShops()
- {
- if($this->request->isGet()) {
- $get = $this->request->get();
- $get['page_no'] = $this->page_no;
- $get['page_size'] = $this->page_size;
- $data = ShopLogic::getNearbyShops($get);
- return JsonServer::success('获取店铺列表成功', $data);
- }else{
- return JsonServer::error('请求类型错误');
- }
- }
- }
|