权限节点的更新

This commit is contained in:
2018-05-08 14:20:25 +08:00
parent 74c83cb725
commit c46a444244
5 changed files with 89 additions and 28 deletions

View File

@@ -10,6 +10,10 @@
namespace app\admin\controller; namespace app\admin\controller;
use app\common\controller\Admin; use app\common\controller\Admin;
/**
* @title 内容管理
*/
class Content extends Admin { class Content extends Admin {
public function _initialize() { public function _initialize() {
@@ -30,7 +34,7 @@ class Content extends Admin {
} }
/** /**
* 内容列表 * @title 内容列表
* @return [html] [页面内容] * @return [html] [页面内容]
* @author molong <ycgpp@126.com> * @author molong <ycgpp@126.com>
*/ */
@@ -64,7 +68,7 @@ class Content extends Admin {
} }
/** /**
* 内容添加 * @title 内容添加
* @author molong <ycgpp@126.com> * @author molong <ycgpp@126.com>
*/ */
public function add() { public function add() {
@@ -97,7 +101,7 @@ class Content extends Admin {
} }
/** /**
* 内容修改 * @title 内容修改
* @author molong <ycgpp@126.com> * @author molong <ycgpp@126.com>
*/ */
public function edit($id) { public function edit($id) {
@@ -135,7 +139,7 @@ class Content extends Admin {
} }
/** /**
* 内容删除 * @title 内容删除
* @author molong <ycgpp@126.com> * @author molong <ycgpp@126.com>
*/ */
public function del() { public function del() {
@@ -158,7 +162,7 @@ class Content extends Admin {
} }
/** /**
* 设置状态 * @title 设置状态
* @author molong <ycgpp@126.com> * @author molong <ycgpp@126.com>
*/ */
public function status($id, $status) { public function status($id, $status) {
@@ -172,7 +176,7 @@ class Content extends Admin {
} }
/** /**
* 设置置顶 * @title 设置置顶
* @author molong <ycgpp@126.com> * @author molong <ycgpp@126.com>
*/ */
public function settop($id, $is_top) { public function settop($id, $is_top) {
@@ -186,7 +190,7 @@ class Content extends Admin {
} }
/** /**
* 获取字段信息 * @title 获取字段信息
* @return array 字段数组 * @return array 字段数组
* @author molong <ycgpp@126.com> * @author molong <ycgpp@126.com>
*/ */
@@ -216,7 +220,7 @@ class Content extends Admin {
} }
/** /**
* 创建搜索 * @title 创建搜索
* @return [array] [查询条件] * @return [array] [查询条件]
*/ */
protected function buildMap() { protected function buildMap() {

View File

@@ -10,6 +10,10 @@
namespace app\admin\controller; namespace app\admin\controller;
use app\common\controller\Admin; use app\common\controller\Admin;
/**
* @title 数据库管理
* @description 数据库管理
*/
class Database extends Admin { class Database extends Admin {
/** /**
* 数据库备份/还原列表 * 数据库备份/还原列表
@@ -71,7 +75,7 @@ class Database extends Admin {
return $this->fetch($type); return $this->fetch($type);
} }
/** /**
* 优化表 * @title 优化表
* @param String $tables 表名 * @param String $tables 表名
* @author 麦当苗儿 <zuojiazi@vip.qq.com> * @author 麦当苗儿 <zuojiazi@vip.qq.com>
*/ */
@@ -100,7 +104,7 @@ class Database extends Admin {
} }
} }
/** /**
* 修复表 * @title 修复表
* @param String $tables 表名 * @param String $tables 表名
* @author 麦当苗儿 <zuojiazi@vip.qq.com> * @author 麦当苗儿 <zuojiazi@vip.qq.com>
*/ */
@@ -129,7 +133,7 @@ class Database extends Admin {
} }
} }
/** /**
* 删除备份文件 * @title 删除备份文件
* @param Integer $time 备份时间 * @param Integer $time 备份时间
* @author 麦当苗儿 <zuojiazi@vip.qq.com> * @author 麦当苗儿 <zuojiazi@vip.qq.com>
*/ */
@@ -148,7 +152,7 @@ class Database extends Admin {
} }
} }
/** /**
* 备份数据库 * @title 备份数据库
* @param String $tables 表名 * @param String $tables 表名
* @param Integer $id 表ID * @param Integer $id 表ID
* @param Integer $start 起始行数 * @param Integer $start 起始行数
@@ -222,7 +226,7 @@ class Database extends Admin {
} }
} }
/** /**
* 还原数据库 * @title 还原数据库
* @author 麦当苗儿 <zuojiazi@vip.qq.com> * @author 麦当苗儿 <zuojiazi@vip.qq.com>
*/ */
public function import($time = 0, $part = null, $start = null) { public function import($time = 0, $part = null, $start = null) {

View File

@@ -10,6 +10,10 @@
namespace app\admin\controller; namespace app\admin\controller;
use app\common\controller\Admin; use app\common\controller\Admin;
/**
* @title 自定义表单
* @description 自定义表单
*/
class Form extends Admin { class Form extends Admin {
public function _initialize() { public function _initialize() {
@@ -23,7 +27,9 @@ class Form extends Admin {
$this->field = $this->getField(); $this->field = $this->getField();
} }
//自定义表单 /**
* @title 表单列表
*/
public function index() { public function index() {
$map = array(); $map = array();
$order = "id desc"; $order = "id desc";
@@ -41,7 +47,7 @@ class Form extends Admin {
} }
/** /**
* 添加表单 * @title 添加表单
*/ */
public function add(\think\Request $request) { public function add(\think\Request $request) {
if ($this->request->isPost()) { if ($this->request->isPost()) {
@@ -62,7 +68,7 @@ class Form extends Admin {
} }
/** /**
* 编辑表单 * @title 编辑表单
*/ */
public function edit(\think\Request $request) { public function edit(\think\Request $request) {
if ($this->request->isPost()) { if ($this->request->isPost()) {
@@ -85,7 +91,7 @@ class Form extends Admin {
} }
/** /**
* 删除表单 * @title 删除表单
*/ */
public function del() { public function del() {
$id = $this->getArrayParam('id'); $id = $this->getArrayParam('id');
@@ -119,6 +125,9 @@ class Form extends Admin {
return $this->fetch('list_'.$form['name']); return $this->fetch('list_'.$form['name']);
} }
/**
* @title 数据详情
*/
public function detail($form_id = '', $id = ''){ public function detail($form_id = '', $id = ''){
$form = $this->model->where('id', $form_id)->find(); $form = $this->model->where('id', $form_id)->find();
@@ -132,7 +141,9 @@ class Form extends Admin {
return $this->fetch('detail_'.$form['name']); return $this->fetch('detail_'.$form['name']);
} }
//数据导出 /**
* @title 数据导出
*/
public function outxls($form_id = '') { public function outxls($form_id = '') {
$form = $this->model->where('id', $form_id)->find(); $form = $this->model->where('id', $form_id)->find();
@@ -152,6 +163,9 @@ class Form extends Admin {
$out->out(); $out->out();
} }
/**
* @title 表单字段
*/
public function attr($form_id = '') { public function attr($form_id = '') {
$map = array(); $map = array();
$order = "id desc"; $order = "id desc";
@@ -167,6 +181,9 @@ class Form extends Admin {
return $this->fetch(); return $this->fetch();
} }
/**
* @title 添加表单字段
*/
public function addattr(){ public function addattr(){
$form_id = $this->request->param('form_id', ''); $form_id = $this->request->param('form_id', '');
if (!$form_id) { if (!$form_id) {
@@ -194,6 +211,9 @@ class Form extends Admin {
} }
} }
/**
* @title 编辑表单字段
*/
public function editattr(\think\Request $request){ public function editattr(\think\Request $request){
$param = $this->request->param(); $param = $this->request->param();
@@ -222,6 +242,9 @@ class Form extends Admin {
} }
} }
/**
* @title 删除表单字段
*/
public function delattr(\think\Request $request){ public function delattr(\think\Request $request){
$id = $request->param('id', 0); $id = $request->param('id', 0);
if (!$id) { if (!$id) {

View File

@@ -10,6 +10,10 @@
namespace app\admin\controller; namespace app\admin\controller;
use app\common\controller\Admin; use app\common\controller\Admin;
/**
* @title 用户组管理
* @description 用户组管理
*/
class Group extends Admin { class Group extends Admin {
protected $model; protected $model;
@@ -21,7 +25,9 @@ class Group extends Admin {
$this->rule = model('AuthRule'); $this->rule = model('AuthRule');
} }
//会员分组首页控制器 /**
* @title 用户组列表
*/
public function index($type = 'admin') { public function index($type = 'admin') {
$map['module'] = $type; $map['module'] = $type;
@@ -39,7 +45,9 @@ class Group extends Admin {
return $this->fetch(); return $this->fetch();
} }
//会员分组添加控制器 /**
* @title 添加用户组
*/
public function add($type = 'admin') { public function add($type = 'admin') {
if ($this->request->isPost()) { if ($this->request->isPost()) {
$result = $this->group->change(); $result = $this->group->change();
@@ -59,7 +67,9 @@ class Group extends Admin {
} }
} }
//会员分组编辑控制器 /**
* @title 编辑用户组
*/
public function edit($id) { public function edit($id) {
if (!$id) { if (!$id) {
return $this->error("非法操作!"); return $this->error("非法操作!");
@@ -83,7 +93,10 @@ class Group extends Admin {
} }
} }
//会员分组编辑字段控制器
/**
* @title 编辑用户组单字段
*/
public function editable() { public function editable() {
$pk = input('pk', '', 'trim,intval'); $pk = input('pk', '', 'trim,intval');
$name = input('name', '', 'trim'); $name = input('name', '', 'trim');
@@ -96,7 +109,10 @@ class Group extends Admin {
} }
} }
//会员分组删除控制器
/**
* @title 删除用户组
*/
public function del() { public function del() {
$id = $this->getArrayParam('id'); $id = $this->getArrayParam('id');
if (empty($id)) { if (empty($id)) {
@@ -110,7 +126,10 @@ class Group extends Admin {
} }
} }
//权限节点控制器
/**
* @title 权限节点
*/
public function access($type = 'admin') { public function access($type = 'admin') {
$map['module'] = $type; $map['module'] = $type;
@@ -128,7 +147,9 @@ class Group extends Admin {
return $this->fetch(); return $this->fetch();
} }
//根据菜单更新节点 /**
* @title 更新权限
*/
public function upnode($type) { public function upnode($type) {
//$rule = model('Menu')->getAuthNodes($type); //$rule = model('Menu')->getAuthNodes($type);
$reuslt = $this->rule->uprule($type); $reuslt = $this->rule->uprule($type);
@@ -136,7 +157,7 @@ class Group extends Admin {
} }
/** /**
* 授权 * @title 用户组授权
*/ */
public function auth($id) { public function auth($id) {
if (!$id) { if (!$id) {
@@ -197,6 +218,9 @@ class Group extends Admin {
} }
} }
/**
* @title 添加节点
*/
public function addnode($type = 'admin') { public function addnode($type = 'admin') {
if ($this->request->isPost()) { if ($this->request->isPost()) {
$result = $this->rule->change(); $result = $this->rule->change();
@@ -216,6 +240,9 @@ class Group extends Admin {
} }
} }
/**
* @title 编辑节点
*/
public function editnode($id) { public function editnode($id) {
if ($this->request->isPost()) { if ($this->request->isPost()) {
$result = $this->rule->change(); $result = $this->rule->change();
@@ -239,6 +266,9 @@ class Group extends Admin {
} }
} }
/**
* @title 删除节点
*/
public function delnode($id) { public function delnode($id) {
if (!$id) { if (!$id) {
return $this->error("非法操作!"); return $this->error("非法操作!");

View File

@@ -30,14 +30,14 @@ class AuthRule extends Base{
array('name'=>'condition','title'=>'条件','type'=>'text','help'=>'') array('name'=>'condition','title'=>'条件','type'=>'text','help'=>'')
); );
public $filter_method = array('__construct', 'execute', 'sqlSplit', 'isMobile', 'is_wechat', '_initialize'); public $filter_method = array('__construct', 'execute', 'login', 'sqlSplit', 'isMobile', 'is_wechat', '_initialize');
public function uprule($type){ public function uprule($type){
$data = $this->updaterule($type); $data = $this->updaterule($type);
foreach ($data as $value) { foreach ($data as $value) {
$id = $this->where(array('name' => $value['name']))->value('id'); $id = $this->where(array('name' => $value['name']))->value('id');
if ($id) { if ($id) {
$save['id'] = $id; $value['id'] = $id;
} }
$list[] = $value; $list[] = $value;
} }