From 754e10158fa5e103783409a1e3fc3441969f781d Mon Sep 17 00:00:00 2001 From: tianya Date: Tue, 15 Apr 2025 21:16:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=81=E9=87=8F=E7=BB=9F=E8=AE=A1=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E5=A2=9E=E5=8A=A0=E8=9C=98=E8=9B=9B=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E5=8F=8A=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/changelog.md | 6 ++- src/admin/statistics_list.php | 9 ++++ src/admin/templets/statistics_list.htm | 5 ++ src/system/archive/archives.class.php | 3 ++ src/system/libraries/crawlerdetect.class.php | 2 +- src/system/libraries/fixtures/crawlers.php | 49 +++++++++++++++----- src/system/libraries/statistics.class.php | 16 +++---- 7 files changed, 69 insertions(+), 21 deletions(-) diff --git a/docs/changelog.md b/docs/changelog.md index f69e3a0f..bdf5ee59 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,6 +1,10 @@ # 更新记录 通过访问 https://www.dedebiz.com/git 获取完整更新记录 +# V6.5.8 +- 流量统计功能增加蜘蛛判断及查询; +- 修复自定义模型中字段禁止会员投稿的问题; + # V6.5.6 - PHP8高版本兼容性调整; - SQLite支持兼容性调整; @@ -79,7 +83,7 @@ - 修正TAG生成目录错误; - 移除FTP的支持; - 其他常规问题修复; -- + # V6.2.10 - DedeBIZ基于自由软件基金会发行的GPL v2许可证发布 - 修正后台功能说明提示; diff --git a/src/admin/statistics_list.php b/src/admin/statistics_list.php index 41467b60..445605b5 100644 --- a/src/admin/statistics_list.php +++ b/src/admin/statistics_list.php @@ -12,6 +12,8 @@ require_once(dirname(__FILE__)."/config.php"); require_once(DEDEINC.'/datalistcp.class.php'); function RenderUrlType($t) { switch ($t) { + case -1: + return "蜘蛛"; case 1: return "列表"; case 2: @@ -31,6 +33,7 @@ if (isset($id) && isset($reid)) { } } $ip = isset($ip) ? HtmlReplace(trim($ip)) : ''; +$url_type = isset($url_type) ? intval($url_type) : 0; if (empty($mobile)) $mobile = ''; if (isset($dopost) && $dopost == "delete") { $ids = explode('`',$aids); @@ -47,12 +50,18 @@ if (isset($dopost) && $dopost == "delete") { exit(); } else { $addsql = " WHERE ip LIKE '%$ip%' "; + if ($url_type === -1) { + $addsql .= " AND url_type = -1 "; + } else if ($url_type === 1) { + $addsql .= " AND url_type > 0 "; + } $sql = "SELECT * FROM `#@__statistics_detail` $addsql ORDER BY id DESC"; $dlist = new DataListCP(); //流量列表数 $dlist->pagesize = 30; $tplfile = DEDEADMIN."/templets/statistics_list.htm"; $dlist->SetParameter("ip",$ip); + $dlist->SetParameter("url_type",$url_type); $dlist->SetTemplate($tplfile); $dlist->SetSource($sql); $dlist->Display(); diff --git a/src/admin/templets/statistics_list.htm b/src/admin/templets/statistics_list.htm index d9bf3ac0..573a16da 100644 --- a/src/admin/templets/statistics_list.htm +++ b/src/admin/templets/statistics_list.htm @@ -21,6 +21,11 @@
+
diff --git a/src/system/archive/archives.class.php b/src/system/archive/archives.class.php index db3af124..2e236142 100755 --- a/src/system/archive/archives.class.php +++ b/src/system/archive/archives.class.php @@ -60,6 +60,9 @@ class Archives //如果当前文档不是系统模型,为自定义模型 $query = "SELECT arc.*,tp.reid,tp.typedir,ch.addtable,mb.uname,mb.face,mb.userid,mb.sex FROM `#@__archives` arc LEFT JOIN `#@__arctype` tp on tp.id=arc.typeid LEFT JOIN `#@__channeltype` as ch on arc.channel = ch.id LEFT JOIN `#@__member` mb on arc.mid = mb.mid WHERE arc.id='$aid' "; $this->Fields = $this->dsql->GetOne($query); + if (!is_array($this->Fields)) { + echo DedeAlert('id:'.$aid.'的文档数据不存在',ALERT_DANGER); + } } else { $this->Fields['title'] = ''; $this->Fields['money'] = $this->Fields['arcrank'] = 0; diff --git a/src/system/libraries/crawlerdetect.class.php b/src/system/libraries/crawlerdetect.class.php index 36420d9c..ce6abc10 100644 --- a/src/system/libraries/crawlerdetect.class.php +++ b/src/system/libraries/crawlerdetect.class.php @@ -64,7 +64,7 @@ class CrawlerDetect /** * Class constructor. */ - public function __construct(array $headers = null, $userAgent = null) + public function __construct($headers = null, $userAgent = null) { $this->crawlers = new Crawlers(); $this->exclusions = new Exclusions(); diff --git a/src/system/libraries/fixtures/crawlers.php b/src/system/libraries/fixtures/crawlers.php index 71237bee..991c4bb1 100644 --- a/src/system/libraries/fixtures/crawlers.php +++ b/src/system/libraries/fixtures/crawlers.php @@ -1,5 +1,5 @@ isRobot()) { - return ""; - } $pm = array(); $pm['dduuid'] = GetCookie("DedeStUUID"); if (empty($pm['dduuid'])) { @@ -46,6 +42,10 @@ class DedeStatistics { $pm['created_date'] = MyDate("Ymd",$pm['t']); $pm['created_hour'] = MyDate("H",$pm['t']); $pm['url_type'] = isset($envs['url_type'])? $envs['url_type'] : $url_type; + if ($crawler = $agent->robot($agent->getUserAgent())) { + $pm['url_type'] = -1; + $pm['browser'] = $crawler; + } $pm['typeid'] = isset($envs['typeid'])? $envs['typeid'] : $typeid; $pm['aid'] = isset($envs['aid'])? $envs['aid'] : $aid; $pm['value'] = isset($envs['value'])? $envs['value'] : $value; @@ -156,10 +156,10 @@ class DedeStatistics { if (is_array($info)) { return $info; } - $pv = $dsql->GetOne("SELECT COUNT(*) as total FROM `#@__statistics_detail` WHERE created_date = $d"); - $uv = $dsql->GetOne("SELECT COUNT(DISTINCT dduuid) as total FROM `#@__statistics_detail` WHERE created_date = $d"); - $ip = $dsql->GetOne("SELECT COUNT(DISTINCT ip) as total FROM `#@__statistics_detail` WHERE created_date = $d"); - $vv = $dsql->GetOne("SELECT COUNT(DISTINCT ssid) as total FROM `#@__statistics_detail` WHERE created_date = $d"); + $pv = $dsql->GetOne("SELECT COUNT(*) as total FROM `#@__statistics_detail` WHERE created_date = $d AND url_type >= 0"); + $uv = $dsql->GetOne("SELECT COUNT(DISTINCT dduuid) as total FROM `#@__statistics_detail` WHERE created_date = $d AND url_type >= 0"); + $ip = $dsql->GetOne("SELECT COUNT(DISTINCT ip) as total FROM `#@__statistics_detail` WHERE created_date = $d AND url_type >= 0"); + $vv = $dsql->GetOne("SELECT COUNT(DISTINCT ssid) as total FROM `#@__statistics_detail` WHERE created_date = $d AND url_type >= 0"); if ($d < intval($today)) { //缓存数据 $insql = "INSERT INTO `#@__statistics` (`sdate`,`pv`,`uv`,`ip`,`vv`) VALUES ('$d', '{$pv['total']}','{$uv['total']}','{$ip['total']}','{$vv['total']}')";