Files

70 lines
1.4 KiB
PHP

<?php
namespace app\admin\controller\app\pc;
use app\common\controller\Backend;
/**
* PC配置
*/
class Config extends Backend
{
/**
* AttachmentGroup模型对象
* @var \app\admin\model\attachment\AttachmentGroup
*/
protected $model = null;
protected $configName = 'score';
public function _initialize()
{
parent::_initialize();
}
/**
* 获取配置
* @return mixed
*/
public function getConfig(){
$type = $this->request->post("type", [], 'trim');
\app\common\model\fill\Handle::check('app_config',$this->getConfigName($type));
$data = \app\common\model\app\Config::getConfig($this->getConfigName($type));
if($type == 'pc'){
if(!isset($data['status'])){
$data['status'] = "1";
}
}
return $this->success("获取成功",$data);
}
/**
* 获取配置
* @return mixed
*/
public function setConfig(){
$row = $this->request->post("row/a", [], 'trim');
$type = $this->request->post("type", [], 'trim');
\app\common\model\fill\Handle::check('app_config',$this->getConfigName($type));
$data = \app\common\model\app\Config::setConfig($this->getConfigName($type),$row);
return $this->success("保存成功",$data);
}
public function getConfigName($type){
return 'pc_'.$type;
}
}