用户编辑结束

master
chenzhi 5 years ago
parent 6dfb13e4d9
commit 80f8eb431c

@ -673,12 +673,15 @@ class AdminController extends Controller {
*/ */
public function addOperationLog($options) public function addOperationLog($options)
{ {
$checkarr = ['op_type','op_name','url','key']; $checkarr = ['op_type','url','key'];
foreach ($checkarr as $v) { foreach ($checkarr as $v) {
if(!array_key_exists($v,$options)){ if(!array_key_exists($v,$options)){
$this->error('操作日志添加,参数错误'); $this->error('操作日志添加,参数错误');
} }
} }
if(!array_key_exists("op_name",$options)){
$options['op_name'] = ($options['op_type'] == 1 ? "编辑" : ($options['op_type'] == 2 ? "删除" :"下载"));
}
//获取ip //获取ip
$addarray = [ $addarray = [
"op_ip"=>$_SERVER['REMOTE_ADDR'], "op_ip"=>$_SERVER['REMOTE_ADDR'],

@ -807,12 +807,7 @@ class MemberController extends ThinkController
if ($res !== false) { if ($res !== false) {
\Think\Log::actionLog("Member/edit", "Member", $id); \Think\Log::actionLog("Member/edit", "Member", $id);
//操作日志 //操作日志
$this->addOperationLog(array( $this->userEditOperationLog($id);
"op_type"=>1,
"op_name"=>"编辑用户信息",
"key"=>$this->getUserAccount($id),
"url"=>U("Member/user_info",array("user_id"=>$id))
));
$this->success("修改成功", U('user_info')); $this->success("修改成功", U('user_info'));
} else { } else {
@ -1019,6 +1014,7 @@ class MemberController extends ThinkController
->where($map) ->where($map)
->setField('phone', $_POST['phone']); ->setField('phone', $_POST['phone']);
if ($pro !== false) { if ($pro !== false) {
$this->userEditOperationLog($user['id']);
$this->ajaxReturn(array("status" => 1, "msg" => "手机修改成功")); $this->ajaxReturn(array("status" => 1, "msg" => "手机修改成功"));
} else { } else {
$this->ajaxReturn(array("status" => 0, "msg" => "手机修改失败")); $this->ajaxReturn(array("status" => 0, "msg" => "手机修改失败"));
@ -1038,6 +1034,7 @@ class MemberController extends ThinkController
->where($map) ->where($map)
->setField('real_name', $_POST['real_name']); ->setField('real_name', $_POST['real_name']);
if ($pro !== false) { if ($pro !== false) {
$this->userEditOperationLog($_POST['id']);
$this->ajaxReturn(array("status" => 1, "msg" => "真实姓名修改成功")); $this->ajaxReturn(array("status" => 1, "msg" => "真实姓名修改成功"));
} else { } else {
$this->ajaxReturn(array("status" => 0, "msg" => "真实姓名修改失败")); $this->ajaxReturn(array("status" => 0, "msg" => "真实姓名修改失败"));
@ -1063,6 +1060,7 @@ class MemberController extends ThinkController
->where($map) ->where($map)
->setField('idcard', $_POST['idcard']); ->setField('idcard', $_POST['idcard']);
if ($pro !== false) { if ($pro !== false) {
$this->userEditOperationLog($_POST['id']);
$this->ajaxReturn(array("status" => 1, "msg" => "身份证号码修改成功")); $this->ajaxReturn(array("status" => 1, "msg" => "身份证号码修改成功"));
} else { } else {
$this->ajaxReturn(array("status" => 0, "msg" => "身份证号码修改失败")); $this->ajaxReturn(array("status" => 0, "msg" => "身份证号码修改失败"));
@ -1248,6 +1246,8 @@ class MemberController extends ThinkController
foreach ($users as $item) { foreach ($users as $item) {
\Think\Log::actionLog('Member/lock_status', 'Member', $item['id']); \Think\Log::actionLog('Member/lock_status', 'Member', $item['id']);
} }
$this->userEditOperationLog($id,"锁定/解锁");
$this->success('操作成功!'); $this->success('操作成功!');
} else { } else {
$this->error('操作失败!'); $this->error('操作失败!');
@ -1694,10 +1694,17 @@ class MemberController extends ThinkController
return $this->success("解除成功"); return $this->success("解除成功");
} }
} }
//获取用户账号 public function userEditOperationLog($id,$op_name = false)
public function getUserAccount($id)
{ {
return M("User","tab_")->field("account")->where("id='{$id}'")->find()['account']; $option = array(
"op_type"=>1,
"key"=>get_user_account($id),
"url"=>U("Member/edit",array("id"=>$id))
);
if($op_name){
$option['op_name'] = $op_name;
}
$this->addOperationLog($option);
# code... # code...
} }
} }
Loading…
Cancel
Save