Merge remote-tracking branch 'origin/feature/operation_log' into feature/operation_log

master
zhengyongxing 5 years ago
commit 6483047fe4

@ -223,16 +223,24 @@ class AuthManagerController extends AdminController{
addOperationLog(array( addOperationLog(array(
"op_type"=>0, "op_type"=>0,
"key"=> $_POST['title'], "key"=> $_POST['title'],
"url"=>U("User/index") "url"=>U("AuthManager/index")
)); ));
}else{ }else{
\Think\Log::actionLog('AuthManager/editGroup','authGroup',1); \Think\Log::actionLog('AuthManager/editGroup','authGroup',1);
addOperationLog(array(
"op_type"=>1,
"key"=> $_POST['title'],
"url"=>U("User/index")
));
$r = $AuthGroup->save(); $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){ if($r===false){
$this->error('操作失败'.$AuthGroup->getError()); $this->error('操作失败'.$AuthGroup->getError());
@ -284,7 +292,7 @@ class AuthManagerController extends AdminController{
"op_type"=>$op_type, "op_type"=>$op_type,
"key"=> $v['title'], "key"=> $v['title'],
"menu"=>"用户-管理组-角色权限-".$op_name, "menu"=>"用户-管理组-角色权限-".$op_name,
"url"=>U("User/index") "url"=>U("AuthManager/index")
)); ));
} }
} }
@ -406,7 +414,22 @@ class AuthManagerController extends AdminController{
if( $gid && !$AuthGroup->checkGroupId($gid)){ if( $gid && !$AuthGroup->checkGroupId($gid)){
$this->error($AuthGroup->error); $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('操作成功'); $this->success('操作成功');
}else{ }else{
$this->error($AuthGroup->getError()); $this->error($AuthGroup->getError());
@ -431,6 +454,11 @@ class AuthManagerController extends AdminController{
$this->error('用户组不存在'); $this->error('用户组不存在');
} }
if ( $AuthGroup->removeFromGroup($uid,$gid) ){ 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('操作成功'); $this->success('操作成功');
}else{ }else{
$this->error('操作失败'); $this->error('操作失败');
@ -455,6 +483,12 @@ class AuthManagerController extends AdminController{
$this->error($AuthGroup->error); $this->error($AuthGroup->error);
} }
if ( $AuthGroup->addToCategory($gid,$cid) ){ 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')); $this->success('操作成功',U('index'));
}else{ }else{
$this->error('操作失败'); $this->error('操作失败');
@ -534,6 +568,12 @@ class AuthManagerController extends AdminController{
'data_president'=>$promoteData, 'data_president'=>$promoteData,
'show_data'=>$show_data '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')); $this->success('操作成功',U('AuthManager/index'));
} else { } else {
$this->success('操作成功',U('AuthManager/index')); $this->success('操作成功',U('AuthManager/index'));

Loading…
Cancel
Save