1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <?php
- namespace JinDouYun\Controller\Shop;
- use JinDouYun\Controller\BaseController;
- use JinDouYun\Controller\DingController;
- use JinDouYun\Model\Shop\MShop;
- use Mall\Framework\Core\ErrorCode;
- use Mall\Framework\Core\Ding;
- class ApiShop extends BaseController
- {
- private $objMShop;
- public function __construct($isCheckAcl = true, $isMustLogin = false, $checkToken = true, $getAreaCode = false, $checkShopToken = true, $checkSupplierToken = true)
- {
- parent::__construct($isCheckAcl, $isMustLogin, $checkToken, $getAreaCode, $checkShopToken, $checkSupplierToken);
- $authorization = $this->request->getServerParam('HTTP_AUTHORIZATION');
- if (!empty($authorization)) {
- self::getUserIdByAuthorization();
- }
- $this->objMShop = new MShop($this->onlineEnterpriseId,$this->onlineUserId);
- }
- /**
- * Doc: (des="门店")
- * User: XMing
- * Date: 2021/1/28
- * Time: 3:52 下午
- * @throws \Exception
- */
- public function getAll()
- {
- $params = $this->request->getRawJson();
- if( empty($params) ){
- $this->sendOutput('参数为空', ErrorCode::$paramError );
- }
- $selectParams = [
- 'name' => isset($params['name']) ? $params['name'] : '',
- 'shopType' => isset($params['shopType']) ? $params['shopType'] : '',
- 'enableStatus' => isset($params['enableStatus']) ? $params['enableStatus'] : '',
- ];
- $pageParams = pageToOffset($params['page']?:1, $params['pageSize']?:10);
- $selectParams['limit'] = $pageParams['limit'];
- $selectParams['offset'] = $pageParams['offset'];
- //longitude 经度
- //latitude 纬度
- $selectParams['longitude'] = getArrayItem($params,'longitude',0);
- $selectParams['latitude'] = getArrayItem($params,'latitude',0);
- $result = $this->objMShop->getAll($selectParams);
- if($result->isSuccess()){
- $returnData = $result->getData();
- $pageData = [
- 'pageIndex' => $params['page'],
- 'pageSize' => $params['pageSize'],
- 'pageTotal' => $returnData['total'],
- ];
- parent::sendOutput($returnData['data'], 0, $pageData);
- }else{
- parent::sendOutput($result->getData(), $result->getErrorCode());
- }
- }
- }
|