优化操作日志基函数

master
chenzhi 5 years ago
parent a8c83122db
commit 7141e3752e

@ -2204,7 +2204,8 @@ function a_array_unique($array){
* op_type=>操作类型 1:编辑 2:删除 3:下载,
* op_name=>操作说明 例如:编辑,删除,锁定等,
* url=>需要跳转的url 添加去列表加唯一id编辑直接去编辑页面下载可以重新下载(新开页面),
* key=>关键词:用户的账号,游戏的名词等
* key=>关键词:用户的账号,游戏的名词等,
* menu=>非必须,菜单目录,不存在的话按控制器寻找
* )
*/
function addOperationLog($options)
@ -2229,18 +2230,24 @@ function a_array_unique($array){
'key'=>$options['key'],
'create_time'=>time()
];
//获取菜单名词
$act = CONTROLLER_NAME.'/'.ACTION_NAME;
$arr = [];
$menuname = D("menu")->field('title,pid,group')->where("url = '{$act}'")->find();
if($menuname){
$arr[] = $menuname['title'];
if(!empty($menuname['group'])){
$arr[] = $menuname['group'];
//获取菜单名称
if(!array_key_exists("menu",$options)){
$act = CONTROLLER_NAME.'/'.ACTION_NAME;
$arr = [];
$menuname = D("menu")->field('title,pid,group')->where("url = '{$act}'")->find();
if($menuname){
$arr[] = $menuname['title'];
if(!empty($menuname['group'])){
$arr[] = $menuname['group'];
}
getLink($menuname['pid'],$arr);
}
getLink($menuname['pid'],$arr);
$addarray['menu'] = implode ( "-",array_reverse($arr));
}else{
$addarray['menu'] = $options['menu'];
}
$addarray['menu'] = implode ( "-",array_reverse($arr));
M("OperationLog","tab_")->add($addarray);
}

@ -210,7 +210,7 @@ class MemberController extends ThinkController
unset($_GET['export']);
addOperationLog(array(
"op_type"=>3,
"key"=>date("YmdHis",time()),
"key"=>getNowDate(),
"url"=>U("Member/user_info",$_GET),
));
data2csv($data,"玩家_玩家列表",$field);

Loading…
Cancel
Save