|
|
|
@ -663,67 +663,6 @@ class AdminController extends Controller {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 操作日志
|
|
|
|
|
* array(
|
|
|
|
|
* op_type=>操作类型 1:编辑 2:删除 3:下载,
|
|
|
|
|
* op_name=>操作说明 例如:编辑,删除,锁定等,
|
|
|
|
|
* url=>需要跳转的url 添加去列表加唯一id,编辑直接去编辑页面,下载可以重新下载(新开页面),
|
|
|
|
|
* key=>关键词:用户的账号,游戏的名词等
|
|
|
|
|
* )
|
|
|
|
|
*/
|
|
|
|
|
public function addOperationLog($options)
|
|
|
|
|
{
|
|
|
|
|
$checkarr = ['op_type','url','key'];
|
|
|
|
|
foreach ($checkarr as $v) {
|
|
|
|
|
if(!array_key_exists($v,$options)){
|
|
|
|
|
$this->error('操作日志添加,参数错误');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(!array_key_exists("op_name",$options)){
|
|
|
|
|
$options['op_name'] = ($options['op_type'] == 1 ? "编辑" : ($options['op_type'] == 2 ? "删除" :"导出"));
|
|
|
|
|
}
|
|
|
|
|
//获取ip
|
|
|
|
|
$addarray = [
|
|
|
|
|
"op_ip"=>$_SERVER['REMOTE_ADDR'],
|
|
|
|
|
'admin_id'=>$_SESSION['onethink_admin']['user_auth']['uid'],
|
|
|
|
|
'admin_account'=>$_SESSION['onethink_admin']['user_auth']['username'],
|
|
|
|
|
'op_type'=>$options['op_type'],
|
|
|
|
|
'op_name'=>$options['op_name'],
|
|
|
|
|
'url'=>$options['url'],
|
|
|
|
|
'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'];
|
|
|
|
|
}
|
|
|
|
|
$this-> getLink($menuname['pid'],$arr);
|
|
|
|
|
}
|
|
|
|
|
$addarray['menu'] = implode ( "-",array_reverse($arr));
|
|
|
|
|
M("OperationLog","tab_")->add($addarray);
|
|
|
|
|
}
|
|
|
|
|
public function getLink($pid=0,&$arr){
|
|
|
|
|
if($pid == 0){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
$menuname = D("menu")->field('title,pid,group')->where("id = '{$pid}'")->find();
|
|
|
|
|
if($menuname){
|
|
|
|
|
$arr[] = $menuname['title'];
|
|
|
|
|
if(!empty($menuname['group'])){
|
|
|
|
|
$arr[] = $menuname['group'];
|
|
|
|
|
}
|
|
|
|
|
if($menuname['pid'] != 0){
|
|
|
|
|
$this->getLink($menuname['pid'], $arr);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|