1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?php
- /**
- * 基本设置
- * Created by PhpStorm.
- * User: XiaoMing
- * Date: 2019/12/5
- * Time: 15:26
- */
- namespace JinDouYun\Controller\System;
- use JinDouYun\Controller\BaseController;
- use Mall\Framework\Core\ErrorCode;
- use JinDouYun\Model\System\MBasicSetup;
- class BasicSetup extends BaseController
- {
- private $objMBasicSetup;
- public function __construct($isCheckAcl = true, $isMustLogin = true)
- {
- parent::__construct($isCheckAcl, $isMustLogin);
- $this->objMBasicSetup = new MBasicSetup($this->onlineEnterpriseId);
- }
- /**
- * 添加,编辑数据
- * @return array
- */
- public function commonFieldFilter()
- {
- $params = $this->request->getRawJson();
- if (empty($params)) {
- $this->sendOutput('参数为空', ErrorCode::$paramError);
- }
- $data = [
- 'enterpriseId' => $this->onlineEnterpriseId,
- 'basicData' => isset($params['basicData']) ? json_encode($params['basicData']) : '',
- ];
- foreach ($data as $key => $value) {
- if (empty($value) && $value !== 0) {
- $this->sendOutput($key . '参数错误', ErrorCode::$paramError);
- }
- }
- return $data;
- }
- /**
- * 编辑基本设置
- */
- public function setting()
- {
- $data = $this->commonFieldFilter();
- $result = $this->objMBasicSetup->setting($data);
- if ($result->isSuccess()) {
- parent::sendOutput($result->getData());
- } else {
- parent::sendOutput($result->getData(), $result->getErrorCode());
- }
- }
- /**
- * 获取基本设置
- */
- public function getBasicSetup()
- {
- $result = $this->objMBasicSetup->getBasicSetup();
- if ($result->isSuccess()) {
- parent::sendOutput($result->getData());
- } else {
- parent::sendOutput($result->getData(), $result->getErrorCode());
- }
- }
- }
|