diff --git a/Application/Admin/Controller/AuthManagerController.class.php b/Application/Admin/Controller/AuthManagerController.class.php index 2505fe021..94dd862f8 100644 --- a/Application/Admin/Controller/AuthManagerController.class.php +++ b/Application/Admin/Controller/AuthManagerController.class.php @@ -223,16 +223,24 @@ class AuthManagerController extends AdminController{ addOperationLog(array( "op_type"=>0, "key"=> $_POST['title'], - "url"=>U("User/index") + "url"=>U("AuthManager/index") )); }else{ \Think\Log::actionLog('AuthManager/editGroup','authGroup',1); - addOperationLog(array( - "op_type"=>1, - "key"=> $_POST['title'], - "url"=>U("User/index") - )); $r = $AuthGroup->save(); + //操作日志,不传title表示是访问授权 + $oparr = array( + "op_type"=>1, + "url"=>U("AuthManager/index") + ); + if(empty($_POST['title'])){ + $oparr['key'] = M("AuthGroup")->where("id={$data['id']}")->field("title")->find()['title']; + $oparr['menu'] = "用户-管理组-角色权限-访问授权"; + }else{ + $oparr['key'] =$_POST['title']; + $oparr['menu'] = "用户-管理组-角色权限-基础信息编辑"; + } + addOperationLog($oparr); } if($r===false){ $this->error('操作失败'.$AuthGroup->getError()); @@ -284,7 +292,7 @@ class AuthManagerController extends AdminController{ "op_type"=>$op_type, "key"=> $v['title'], "menu"=>"用户-管理组-角色权限-".$op_name, - "url"=>U("User/index") + "url"=>U("AuthManager/index") )); } } @@ -406,7 +414,22 @@ class AuthManagerController extends AdminController{ if( $gid && !$AuthGroup->checkGroupId($gid)){ $this->error($AuthGroup->error); } - if ( $AuthGroup->addToGroup($uid,$gid) ){ + $flag = false; + try { + $flag = $AuthGroup->addToGroup($uid,$gid); + } catch (\Throwable $th) { + if(empty($AuthGroup->getError())){ + $this->error("操作失败:请确认添加的用户是否存在或已经有归属"); + }else{ + $this->error($AuthGroup->getError()); + } + } + if($flag){ + addOperationLog(array( + "op_type"=>1, + "key"=> M("AuthGroup")->where("id={$gid}")->field("title")->find()['title'], + "url"=>U("AuthManager/index") + )); $this->success('操作成功'); }else{ $this->error($AuthGroup->getError()); @@ -431,6 +454,11 @@ class AuthManagerController extends AdminController{ $this->error('用户组不存在'); } if ( $AuthGroup->removeFromGroup($uid,$gid) ){ + addOperationLog(array( + "op_type"=>1, + "key"=> M("AuthGroup")->where("id={$gid}")->field("title")->find()['title'], + "url"=>U("AuthManager/index") + )); $this->success('操作成功'); }else{ $this->error('操作失败'); @@ -455,6 +483,12 @@ class AuthManagerController extends AdminController{ $this->error($AuthGroup->error); } if ( $AuthGroup->addToCategory($gid,$cid) ){ + //操作日志 + addOperationLog(array( + "op_type"=>1, + "key"=> M("AuthGroup")->where("id={$gid}")->field("title")->find()['title'], + "url"=>U("AuthManager/index") + )); $this->success('操作成功',U('index')); }else{ $this->error('操作失败'); @@ -534,6 +568,12 @@ class AuthManagerController extends AdminController{ 'data_president'=>$promoteData, 'show_data'=>$show_data ))) { + addOperationLog(array( + "op_type"=>1, + "key"=> M("AuthGroup")->where("id={$gid}")->field("title")->find()['title'], + "menu"=>"用户-管理组-角色权限-数据授权", + "url"=>U("AuthManager/index") + )); $this->success('操作成功',U('AuthManager/index')); } else { $this->success('操作成功',U('AuthManager/index'));