角色权限-操作日志1

master
chenzhi 5 years ago
parent 3a9575c602
commit 81830703f3

@ -220,8 +220,18 @@ class AuthManagerController extends AdminController{
if ( empty($data['id']) ) {
\Think\Log::actionLog('AuthManager/createGroup','authGroup',1);
$r = $AuthGroup->add();
addOperationLog(array(
"op_type"=>0,
"key"=> $_POST['title'],
"url"=>U("User/index")
));
}else{
\Think\Log::actionLog('AuthManager/editGroup','authGroup',1);
addOperationLog(array(
"op_type"=>1,
"key"=> $_POST['title'],
"url"=>U("User/index")
));
$r = $AuthGroup->save();
}
if($r===false){
@ -239,9 +249,46 @@ class AuthManagerController extends AdminController{
* @author 朱亚杰 <zhuyajie@topthink.net>
*/
public function changeStatus($method=null){
//操作日志-begin
if(is_array ( $_REQUEST['id'] )){
$ids = implode(",",$_REQUEST['id']);
}else{
$ids = $_REQUEST['id'];
}
$lr = M("AuthGroup")->field('title,status')->where("id in ({$ids})")->select();
$status = 0;
$op_name ='';
$op_type =1;
if ( empty($_REQUEST['id']) ) {
$this->error('请选择要操作的数据!');
}
// 1正常为0禁用,-1为删除'
switch ( strtolower($method) ){
case 'forbidgroup':
$status = 0;
$op_name = "禁用";
break;
case 'resumegroup':
$status = 1;
$op_name = "正常";
break;
case 'deletegroup':
$status = -1;
$op_name = "删除";
$op_type = 2;
break;
}
foreach ($lr as $k => $v) {
if($v['status'] != $status){
addOperationLog(array(
"op_type"=>$op_type,
"key"=> $v['title'],
"menu"=>"用户-管理组-角色权限-".$op_name,
"url"=>U("User/index")
));
}
}
//操作日志end
switch ( strtolower($method) ){
case 'forbidgroup':
\Think\Log::actionLog('AuthManager/changeStatus?method=forbidGroup','AuthGroup',$_REQUEST['id']);

Loading…
Cancel
Save