初始化项目:添加后端代码、ThinkPHP框架、前端资源
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\app\agent;
|
||||
|
||||
use app\common\controller\Backend;
|
||||
|
||||
/**
|
||||
* 分销配置
|
||||
*/
|
||||
class Config extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* AttachmentGroup模型对象
|
||||
* @var \app\admin\model\attachment\AttachmentGroup
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
protected $configName = 'agent';
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
|
||||
\app\common\model\fill\Handle::check('app_config',$this->configName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取配置
|
||||
* @return mixed
|
||||
*/
|
||||
public function getConfig(){
|
||||
$data = \app\common\model\app\Config::getConfig($this->configName);
|
||||
|
||||
foreach ($data['levelPlan'] as &$item){
|
||||
$item['saved'] = true;
|
||||
}
|
||||
return $this->success("获取成功",$data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取配置
|
||||
* @return mixed
|
||||
*/
|
||||
public function setConfig(){
|
||||
$row = $this->request->post("row/a", [], 'trim');
|
||||
$data = \app\common\model\app\Config::setConfig($this->configName,$row);
|
||||
return $this->success("保存成功",$data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除等级中的level
|
||||
* @return void
|
||||
*/
|
||||
public function delLevel(){
|
||||
$index = $this->request->post("index");
|
||||
|
||||
$data = \app\common\model\app\Config::getConfig($this->configName);
|
||||
|
||||
if(isset($data['levelPlan'][$index])){
|
||||
unset($data['levelPlan'][$index]);
|
||||
}
|
||||
$data = \app\common\model\app\Config::setConfig($this->configName,$data);
|
||||
|
||||
//重置受影响的level
|
||||
\app\common\model\app\agent\Level::delLevelConfigReset();
|
||||
|
||||
return $this->success("保存成功",$data);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user