From 7355546a58b3173332e5fe3ba41f200e29b542de Mon Sep 17 00:00:00 2001 From: chenzhi Date: Wed, 31 Mar 2021 11:12:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=96=B0=E5=A2=9E=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AuthManagerController.class.php | 28 ++++++---------- Application/Admin/View/AuthManager/index.html | 32 ++++++++----------- ThinkPHP/Library/Think/Log.class.php | 4 +-- 3 files changed, 25 insertions(+), 39 deletions(-) diff --git a/Application/Admin/Controller/AuthManagerController.class.php b/Application/Admin/Controller/AuthManagerController.class.php index 297837013..0872c732c 100644 --- a/Application/Admin/Controller/AuthManagerController.class.php +++ b/Application/Admin/Controller/AuthManagerController.class.php @@ -27,7 +27,7 @@ class AuthManagerController extends AdminController{ //需要新增的节点必然位于$nodes $nodes = $this->returnNodes(false); - $AuthRule = M('AuthRule'); + $AuthRule = SM('AuthRule'); $map = array('module'=>'admin','type'=>array('in','1,2'));//status全部取出,以进行更新 //需要更新和删除的节点必然位于$rules $rules = $AuthRule->where($map)->order('name')->select(); @@ -128,7 +128,7 @@ class AuthManagerController extends AdminController{ * @author 朱亚杰 */ public function editGroup(){ - $auth_group = M('AuthGroup')->where( array('module'=>'admin','type'=>AuthGroupModel::TYPE_ADMIN) ) + $auth_group = SM('AuthGroup')->where( array('module'=>'admin','type'=>AuthGroupModel::TYPE_ADMIN) ) ->find( (int)$_GET['id'] ); $this->assign('auth_group',$auth_group); $this->meta_title = '编辑用户组'; @@ -151,9 +151,9 @@ class AuthManagerController extends AdminController{ ->getfield('id,id,title,rules'); $node_list = $this->returnNodes(); $map = array('module'=>'admin','type'=>AuthRuleModel::RULE_MAIN,'status'=>1); - $main_rules = M('AuthRule')->where($map)->getField('name,id'); + $main_rules = SM('AuthRule')->where($map)->getField('name,id'); $map = array('module'=>'admin','type'=>AuthRuleModel::RULE_URL,'status'=>1); - $child_rules = M('AuthRule')->where($map)->getField('name,id'); + $child_rules = SM('AuthRule')->where($map)->getField('name,id'); $this->assign('main_rules', $main_rules); $this->assign('auth_rules', $child_rules); @@ -205,40 +205,30 @@ class AuthManagerController extends AdminController{ } } if(isset($_POST['rules'])){ - $isrules = true; if(!empty($ruleiddata)){ $_POST['rules'] = array_merge($_POST['rules'],$ruleiddata); } sort($_POST['rules']); $_POST['rules'] = implode( ',' , array_unique($_POST['rules'])); }else{ - $isrules = false; $_POST['rules'] = ''; } $_POST['module'] = 'admin'; $_POST['type'] = AuthGroupModel::TYPE_ADMIN; - $AuthGroup = D('AuthGroup'); + $AuthGroup = SM('AuthGroup'); $data = $AuthGroup->create(); if ( $data ) { if ( empty($data['id']) ) { - if(!IS_SUBSITE){ - \Think\Log::actionLog('AuthManager/createGroup','authGroup',1); - } - $r = $AuthGroup->syncAdd($data); + \Think\Log::actionLog('AuthManager/createGroup','authGroup',1); + $r = $AuthGroup->add($data); addOperationLog(array( "op_type"=>0, "key"=> $_POST['title'], "url"=>U("AuthManager/index") )); }else{ - if(!IS_SUBSITE){ - \Think\Log::actionLog('AuthManager/editGroup','authGroup',1); - } - if($isrules){ - $r = SM("auth_group","sys_")->save($data); - }else{ - $r = $AuthGroup->where("id={$data['id']}")->syncSave($data); - } + \Think\Log::actionLog('AuthManager/editGroup','authGroup',1); + $r = SM("auth_group","sys_")->save($data); //操作日志,不传title表示是访问授权 $oparr = array( diff --git a/Application/Admin/View/AuthManager/index.html b/Application/Admin/View/AuthManager/index.html index f0b3e7c02..425ca02f4 100644 --- a/Application/Admin/View/AuthManager/index.html +++ b/Application/Admin/View/AuthManager/index.html @@ -5,16 +5,14 @@

角色权限

说明:可以设置管理账号的不同操作权限

- -
- +
+ - +
@@ -52,9 +50,9 @@ diff --git a/ThinkPHP/Library/Think/Log.class.php b/ThinkPHP/Library/Think/Log.class.php index 6a2d5ebe7..e2f7fb1db 100644 --- a/ThinkPHP/Library/Think/Log.class.php +++ b/ThinkPHP/Library/Think/Log.class.php @@ -114,7 +114,7 @@ class Log { $user_id = is_login(); //查询行为,判断是否执行 - $action_info = M('Action')->getByName($action); + $action_info = SM('Action')->getByName($action); if($action_info['status'] != 1){ return '该行为被禁用或删除'; } @@ -166,6 +166,6 @@ class Log { $data['remark'] = '操作url:'.$_SERVER['REQUEST_URI']; } - M('ActionLog')->add($data); + SM('ActionLog')->add($data); } } \ No newline at end of file
访问授权 + 成员授权 分类授权 - 成员授权 数据授权 市场专员分成 @@ -66,14 +64,12 @@ {:get_status_title($vo['status'])} - - - 禁用 - - 正常 - - 删除 - + + 禁用 + + 正常 + + 删除