角色权限修改状态提醒优化

master
chenzhi 5 years ago
parent 6885ec61fc
commit 673e3fb5cd

@ -272,23 +272,29 @@ class AuthManagerController extends AdminController{
$this->error('请选择要操作的数据!'); $this->error('请选择要操作的数据!');
} }
// 1正常为0禁用,-1为删除' // 1正常为0禁用,-1为删除'
switch ( strtolower($method) ){ switch ( strtolower($method) ){
case 'forbidgroup': case 'forbidgroup':
$status = 0; $status = 0;
$op_name = "禁用"; $op_name = "禁用";
$msg = array('success'=>'操作成功,状态禁用成功!', 'error'=>'状态禁用失败!', 'url'=>'' ,'ajax'=>IS_AJAX);
break; break;
case 'resumegroup': case 'resumegroup':
$status = 1; $status = 1;
$op_name = "正常"; $op_name = "正常";
$msg = array('success'=>'操作成功,状态恢复成功!', 'error'=>'状态恢复失败!', 'url'=>'' ,'ajax'=>IS_AJAX);
break; break;
case 'deletegroup': case 'deletegroup':
$status = -1; $status = -1;
$op_name = "删除"; $op_name = "删除";
$op_type = 2; $op_type = 2;
$msg = array('success'=>'操作成功,删除成功!', 'error'=>'删除失败!', 'url'=>'' ,'ajax'=>IS_AJAX);
break; break;
} }
$setFalg =false;
foreach ($lr as $k => $v) { foreach ($lr as $k => $v) {
if($v['status'] != $status){ if($v['status'] != $status){
$setFalg = true;
addOperationLog(array( addOperationLog(array(
"op_type"=>$op_type, "op_type"=>$op_type,
"key"=> $v['title'], "key"=> $v['title'],
@ -297,22 +303,18 @@ class AuthManagerController extends AdminController{
)); ));
} }
} }
//操作日志end if($setFalg){
switch ( strtolower($method) ){ $savedata = [
case 'forbidgroup': "status"=>$status
\Think\Log::actionLog('AuthManager/changeStatus?method=forbidGroup','AuthGroup',$_REQUEST['id']); ];
$this->forbid('AuthGroup'); $res = M("AuthGroup")->where("id in ({$ids})")->save($savedata);
break; if($res !==false ){
case 'resumegroup': $this->success($msg['success'],$msg['url'],$msg['ajax']);
\Think\Log::actionLog('AuthManager/changeStatus?method=resumegroup','AuthGroup',$_REQUEST['id']); }else{
$this->resume('AuthGroup'); $this->error($msg['error'],$msg['url'],$msg['ajax']);
break; }
case 'deletegroup': }else{
\Think\Log::actionLog('AuthManager/changeStatus?method=deletegroup','AuthGroup',$_REQUEST['id']); $this->success("操作成功,状态未改变",'',IS_AJAX);;
$this->delete('AuthGroup');
break;
default:
$this->error($method.'参数非法');
} }
} }

Loading…
Cancel
Save