添加识别蜘蛛爬虫记录、完善细节小bug
This commit is contained in:
parent
c0dc76c6ff
commit
5f026df1ea
@ -292,6 +292,20 @@ function get_login_user($key = "")
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断访客是否是蜘蛛
|
||||
*/
|
||||
function isRobot($except = '') {
|
||||
$ua = strtolower ( $_SERVER ['HTTP_USER_AGENT'] );
|
||||
$botchar = "/(baidu|google|spider|soso|yahoo|sohu-search|yodao|robozilla|AhrefsBot)/i";
|
||||
$except ? $botchar = str_replace ( $except . '|', '', $botchar ) : '';
|
||||
if (preg_match ( $botchar, $ua )) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 客户操作日志
|
||||
* @param string $type 操作类型 login reg add edit view delete down join sign play order pay
|
||||
@ -321,7 +335,7 @@ function add_user_log($type, $param_str = '', $param_id = 0, $param = [])
|
||||
case 'delete':
|
||||
$title = '删除';
|
||||
break;
|
||||
case 'down':
|
||||
case 'down':
|
||||
$title = '下载';
|
||||
break;
|
||||
case 'join':
|
||||
@ -339,10 +353,10 @@ function add_user_log($type, $param_str = '', $param_id = 0, $param = [])
|
||||
case 'pay':
|
||||
$title = '支付';
|
||||
break;
|
||||
case 'api':
|
||||
case 'api':
|
||||
$title = 'API请求';
|
||||
break;
|
||||
case 'install':
|
||||
case 'install':
|
||||
$title = '安装';
|
||||
break;
|
||||
default:
|
||||
@ -350,7 +364,7 @@ function add_user_log($type, $param_str = '', $param_id = 0, $param = [])
|
||||
break;
|
||||
}
|
||||
if ($type == 'login') {
|
||||
$login_user = \think\facade\Db::name('user')->where(array('id' => $param_id))->find();
|
||||
$login_user = \think\facade\Db::name('User')->where(array('id' => $param_id))->find();
|
||||
if ($login_user['nickname'] == '') {
|
||||
$login_user['nickname'] = $login_user['name'];
|
||||
}
|
||||
@ -363,6 +377,11 @@ function add_user_log($type, $param_str = '', $param_id = 0, $param = [])
|
||||
$login_user = [];
|
||||
$login_user['id'] = 0;
|
||||
$login_user['nickname'] = '游客';
|
||||
if(isRobot()){
|
||||
$login_user['nickname'] = '蜘蛛';
|
||||
$type = 'spider';
|
||||
$title = '爬行';
|
||||
}
|
||||
} else {
|
||||
if ($login_user['nickname'] == '') {
|
||||
$login_user['nickname'] = $login_user['username'];
|
||||
@ -386,7 +405,7 @@ function add_user_log($type, $param_str = '', $param_id = 0, $param = [])
|
||||
$data['function'] = app('request')->action();
|
||||
$data['ip'] = $request->ip();
|
||||
$data['create_time'] = time();
|
||||
\think\facade\Db::name('user_log')->strict(false)->field(true)->insert($data);
|
||||
\think\facade\Db::name('UserLog')->strict(false)->field(true)->insert($data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -14,9 +14,7 @@
|
||||
<div class="r user-right">
|
||||
<div class="user-info">
|
||||
<dl class="clearfix">
|
||||
<dt class="user-info-img"><img
|
||||
src='{$userInfo.headimgurl}' />
|
||||
</dt>
|
||||
<dt class="user-info-img"><img src="{$userInfo.headimgurl}" /></dt>
|
||||
<dd class="user-info-name">{$userInfo.showname}</dd>
|
||||
<dd class="user-info-tips">
|
||||
{$userInfo.desc}
|
||||
@ -30,18 +28,17 @@
|
||||
<td class="td-gay" width="12%">真实姓名</td>
|
||||
<td width="38%">{$userInfo.name}</td>
|
||||
<td class="td-gay" width="12%">性别</td>
|
||||
<td width="38%">{$userInfo.sex}</a>
|
||||
</td>
|
||||
<td width="38%">{$userInfo.sex}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="td-gay">所在城市</td>
|
||||
<td>{$userInfo.city}</a>
|
||||
<td>{$userInfo.city}</td>
|
||||
<td class="td-gay">出生日期</td>
|
||||
<td>{:date('Y-m-d',$userInfo.birthday)}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="td-gay">手机号码</td>
|
||||
<td>{$userInfo.mobile}</a>
|
||||
<td>{$userInfo.mobile}</td>
|
||||
<td class="td-gay">电子邮箱</td>
|
||||
<td>{$userInfo.email}</td>
|
||||
</tr>
|
||||
|
@ -19,7 +19,7 @@ class Index
|
||||
{
|
||||
// 检测是否安装过
|
||||
if (is_installed()) {
|
||||
echo '你已经安装过勾股cms系统!';
|
||||
echo '你已经安装过勾股cms系统!如需重新安装,请删除“config/install.lock”文件';
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ CREATE TABLE `cms_admin` (
|
||||
`last_login_time` int(11) NOT NULL DEFAULT '0',
|
||||
`login_num` int(11) NOT NULL DEFAULT '0',
|
||||
`last_login_ip` varchar(64) NOT NULL DEFAULT '',
|
||||
`status` int(1) NOT NULL DEFAULT '1' COMMENT '1正常-1禁止登录',
|
||||
`status` int(1) NOT NULL DEFAULT '1' COMMENT '1正常,0禁止登录,-1删除',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `id` (`id`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARACTER SET = utf8mb4 COMMENT='管理员表';
|
||||
|
Loading…
x
Reference in New Issue
Block a user