管理员列表增删改导出-操作日志

master
chenzhi 5 years ago
parent 40d2c2777f
commit 3a9575c602

@ -4794,9 +4794,10 @@ class ExportController extends Controller
} }
$GetData = $_GET;
unset($GetData['xlsname']);
addOperationLog(['op_type'=>3,'key'=>getNowDate(),'url'=>U('User/index',$GetData),'menu'=>'用户-管理组-管理员列表-导出']);
$this->exportExcel($xlsName, $xlsCell, $xlsData); $this->exportExcel($xlsName, $xlsCell, $xlsData);
} }

@ -211,6 +211,13 @@ class UserController extends AdminController
$res = M('UcenterMember')->where($map1)->setField('status', $status); $res = M('UcenterMember')->where($map1)->setField('status', $status);
$res1 = M('Member')->where($map)->setField('status', $status); $res1 = M('Member')->where($map)->setField('status', $status);
if ($res && $res1) { if ($res && $res1) {
$nickname = M('Member')->where($map)->field("nickname")->find()['nickname'];//默认一个,多个时需要遍历
addOperationLog(array(
"op_type"=>1,
"key"=> $nickname,
"menu"=>"用户-管理组-管理员列表-锁定/解锁",
"url"=>U("User/index",array("nickname"=>$nickname))
));
$this->success('更新成功!'); $this->success('更新成功!');
} else { } else {
$this->error('更新失败!'); $this->error('更新失败!');
@ -283,6 +290,13 @@ class UserController extends AdminController
if (!M('Member')->add($user)) { if (!M('Member')->add($user)) {
$this->error('用户添加失败!'); $this->error('用户添加失败!');
} else { } else {
//操作日志
addOperationLog(array(
"op_type"=>0,
"key"=>$username,
"url"=>U("User/index",array("nickname"=>$username))
));
\Think\Log::actionLog('User/add', 'Member', $uid); \Think\Log::actionLog('User/add', 'Member', $uid);
$this->success('用户添加成功!', U('index')); $this->success('用户添加成功!', U('index'));
} }
@ -399,6 +413,12 @@ class UserController extends AdminController
if ($smember !== false || $meb || $ag) { if ($smember !== false || $meb || $ag) {
M('user_pwd')->where($maps)->setField('password', think_encrypt($info['password'])); M('user_pwd')->where($maps)->setField('password', think_encrypt($info['password']));
addOperationLog(array(
"op_type"=>1,
"key"=>$_POST['username'],
"url"=>U("User/index",array("nickname"=>$_POST['username']))
));
$this->success('修改成功!', U('User/index')); $this->success('修改成功!', U('User/index'));
} else { } else {
$this->error('修改失败!', U('User/index')); $this->error('修改失败!', U('User/index'));
@ -604,11 +624,17 @@ class UserController extends AdminController
public function delete($id) public function delete($id)
{ {
M()->startTrans(); M()->startTrans();
$nickname = M('Member')->where("uid = '{$id}'")->field("nickname")->find()['nickname'];
$res1 = M('member')->delete($id); $res1 = M('member')->delete($id);
$res2 = M('ucenter_member')->delete($id); $res2 = M('ucenter_member')->delete($id);
$res3 = M('auth_group_access')->where(array('uid' => $id))->delete(); $res3 = M('auth_group_access')->where(array('uid' => $id))->delete();
if ($res1 && $res2 && $res3) { if ($res1 && $res2 && $res3) {
M()->commit(); M()->commit();
addOperationLog(array(
"op_type"=>2,
"key"=> $nickname,
"url"=>U("User/index")
));
$this->success('删除成功'); $this->success('删除成功');
} else { } else {
M()->rollback(); M()->rollback();

Loading…
Cancel
Save