72 lines
1.6 KiB
PHP
72 lines
1.6 KiB
PHP
<?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);
|
|
}
|
|
|
|
}
|