12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?php
- /**
- * 模版模块
- * Created by PhpStorm.
- * User: XiaoMing
- * Date: 2019/11/29
- * Time: 16:22
- */
- namespace JinDouYun\Controller\System;
- use JinDouYun\Controller\BaseController;
- use Mall\Framework\Core\ErrorCode;
- use Mall\Framework\Core\StatusCode;
- use JinDouYun\Model\System\MTemplateModule;
- class TemplateModule extends BaseController
- {
- private $objMTemplateModule;
- /**
- * TemplateModule constructor.
- * @param bool $isCheckAcl
- * @param bool $isMustLogin
- */
- public function __construct($isCheckAcl = true, $isMustLogin = true)
- {
- parent::__construct($isCheckAcl, $isMustLogin);
- $this->objMTemplateModule = new MTemplateModule($this->onlineUserId, $this->onlineEnterpriseId);
- }
- /**
- * 添加,编辑系统模版模块
- * @return array
- */
- public function commonFieldFilter()
- {
- $params = $this->request->getRawJson();
- if (empty($params)) {
- $this->sendOutput('参数为空', ErrorCode::$paramError);
- }
- $data = [
- 'templateId' => isset($params['templateId']) ? $params['templateId'] : '',
- 'title' => isset($params['title']) ? $params['title'] : '',
- ];
- foreach ($data as $key => $value) {
- if (empty($value) && $value !== 0) {
- $this->sendOutput($key . '参数错误', ErrorCode::$paramError);
- }
- }
- $data['enableStatus'] = isset($params['enableStatus']) ? $params['enableStatus'] : StatusCode::$delete;
- return $data;
- }
- /**
- * 获取系统模板下模块
- */
- public function getAll()
- {
- $templateId = $this->request->param('request_id');
- if (empty($templateId)){
- $this->sendOutput('缺少模板id', ErrorCode::$paramError);
- }
- $selectParams = [
- 'templateId' => $templateId,
- 'enableStatus' => StatusCode::$standard,
- ];
- $dbResult = $this->objMTemplateModule->getAll($selectParams);
- if ($dbResult->isSuccess()) {
- $returnData = $dbResult->getData();
- parent::sendOutput($returnData['data'], 0);
- }
- parent::sendOutput($dbResult->getData(), ErrorCode::$dberror);
- }
- }
|