12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <?php
- /**
- * 前台模版
- * Created by PhpStorm.
- * User: XiaoMing
- * Date: 2019/12/2
- * Time: 12:15
- */
- namespace JinDouYun\Controller\System;
- use JinDouYun\Controller\BaseController;
- use JinDouYun\Model\System\MPage;
- use Mall\Framework\Core\ErrorCode;
- use JinDouYun\Model\System\MEnterpriseBindTemplate;
- use Mall\Framework\Core\StatusCode;
- class ApiTemplate extends BaseController
- {
- private $objMEnterpriseBindTemplate;
- /**
- * ApiTemplate constructor.
- * @param bool $isCheckAcl
- * @param bool $isMustLogin
- * @param bool $checkToken
- * @param bool $getAreaCode
- */
- public function __construct($isCheckAcl = false, $isMustLogin = false, $checkToken = true,$getAreaCode=true)
- {
- parent::__construct($isCheckAcl, $isMustLogin, $checkToken,$getAreaCode);
- $authorization = $this->request->getServerParam('HTTP_AUTHORIZATION');
- if (!empty($authorization)) {
- self::getUserIdByAuthorization();
- }
- $this->objMEnterpriseBindTemplate = new MEnterpriseBindTemplate($this->onlineUserId, $this->onlineEnterpriseId,$this->areaCode);
- }
- /**
- * 获取首页模版及数据 废弃
- * @throws \Exception
- * @deprecated
- */
- public function getTemplate()
- {
- $params = $this->request->getRawJson();
- $dbResult = $this->objMEnterpriseBindTemplate->getTemplate();
- if ($dbResult->isSuccess()) {
- $returnData = $dbResult->getData();
- parent::sendOutput($returnData['data'], 0);
- }
- parent::sendOutput($dbResult->getData(), ErrorCode::$dberror);
- }
- /**
- * @throws \Exception
- */
- public function homePage()
- {
- $params = $this->request->getRawJson();
- $pageType = isset($params['pageType']) ? $params['pageType'] : StatusCode::$pageType['home'];//默认获取首页
- $dbResult = $this->objMEnterpriseBindTemplate->homePage($pageType,$this->shopId);
- if ($dbResult->isSuccess()) {
- $returnData = $dbResult->getData();
- parent::sendOutput($returnData['data'], 0);
- }
- parent::sendOutput($dbResult->getData(), ErrorCode::$dberror);
- }
- /**
- * Doc: (des="")
- * User: XMing
- * Date: 2020/12/28
- * Time: 4:25 下午
- * @throws \Exception
- */
- public function shopHome()
- {
- $params = (array)$this->request->getRawJson();
- $pageType = isset($params['pageType']) ? $params['pageType'] : StatusCode::$pageType['home'];//默认获取首页
- $shopId = getArrayItem($params,'merchantId',0);
- $objMPage = new MPage($this->onlineUserId,$this->onlineEnterpriseId);
- $dbResult = $objMPage->shopHome($shopId,$pageType);
- if ($dbResult->isSuccess()) {
- $returnData = $dbResult->getData();
- parent::sendOutput($returnData, 0);
- }
- parent::sendOutput($dbResult->getData(), ErrorCode::$dberror);
- }
- }
|