mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-05 19:41:44 +08:00
68 lines
2.2 KiB
PHP
68 lines
2.2 KiB
PHP
<?php
|
||
|
||
// +----------------------------------------------------------------------
|
||
// | ThinkAdmin
|
||
// +----------------------------------------------------------------------
|
||
// | 版权所有 2014~2017 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
|
||
// +----------------------------------------------------------------------
|
||
// | 官方网站: http://think.ctolog.com
|
||
// +----------------------------------------------------------------------
|
||
// | 开源协议 ( https://mit-license.org )
|
||
// +----------------------------------------------------------------------
|
||
// | github开源项目:https://github.com/zoujingli/ThinkAdmin
|
||
// +----------------------------------------------------------------------
|
||
|
||
namespace app\admin\controller;
|
||
|
||
use controller\BasicAdmin;
|
||
use service\DataService;
|
||
use service\NodeService;
|
||
use service\ToolsService;
|
||
|
||
/**
|
||
* 系统功能节点管理
|
||
* Class Node
|
||
* @package app\admin\controller
|
||
* @author Anyon <zoujingli@qq.com>
|
||
* @date 2017/02/15 18:13
|
||
*/
|
||
class Node extends BasicAdmin
|
||
{
|
||
|
||
/**
|
||
* 指定当前默认模型
|
||
* @var string
|
||
*/
|
||
public $table = 'SystemNode';
|
||
|
||
/**
|
||
* 显示节点列表
|
||
*/
|
||
public function index()
|
||
{
|
||
$alert = ['type' => 'danger', 'title' => '安全警告', 'content' => '结构为系统自动生成, 状态数据请勿随意修改!'];
|
||
$nodes = ToolsService::arr2table(NodeService::get(), 'node', 'pnode');
|
||
return view('', ['title' => '系统节点管理', 'nodes' => $nodes, 'alert' => $alert]);
|
||
}
|
||
|
||
/**
|
||
* 保存节点变更
|
||
*/
|
||
public function save()
|
||
{
|
||
if ($this->request->isPost()) {
|
||
$post = $this->request->post();
|
||
if (isset($post['name']) && isset($post['value'])) {
|
||
$nameattr = explode('.', $post['name']);
|
||
$field = array_shift($nameattr);
|
||
$data = ['node' => join(',', $nameattr), $field => $post['value']];
|
||
DataService::save($this->table, $data, 'node');
|
||
$this->success('参数保存成功!', '');
|
||
}
|
||
} else {
|
||
$this->error('访问异常,请重新进入...');
|
||
}
|
||
}
|
||
|
||
}
|