From 89706cf78c6b7376a21306529694a8b073ecddfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=99=E8=BF=B0=E3=80=81=E5=88=AB=E7=A6=BB?= <93301500+xushubieli@users.noreply.github.com> Date: Thu, 27 Mar 2025 08:30:58 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=87=AA=E5=8A=A8=E5=85=B3?= =?UTF-8?q?=E9=94=AE=E8=AF=8D=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/admin/archives_do.php | 4 ++-- src/admin/inc/inc_archives_functions.php | 18 +++--------------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/src/admin/archives_do.php b/src/admin/archives_do.php index a2a416a1..aafad1c3 100644 --- a/src/admin/archives_do.php +++ b/src/admin/archives_do.php @@ -658,7 +658,7 @@ else if ($dopost == "makekw") { if (strlen($keywords.$k) >= 60) { break; } else { - if (strlen($k) <= 2 || $length == 3) continue; + if (strlen($k) <= 6 || $length == 3) continue; $keywords .= $k.','; } } @@ -666,7 +666,7 @@ else if ($dopost == "makekw") { if (strlen($keywords.$k) >= 60) { break; } else if (!in_array($k, $titleindexs)) { - if (strlen($k) <= 2 || $length == 3) continue; + if (strlen($k) <= 6 || $length == 3) continue; $keywords .= $k.','; } } diff --git a/src/admin/inc/inc_archives_functions.php b/src/admin/inc/inc_archives_functions.php index 5336edfa..a4d3687c 100644 --- a/src/admin/inc/inc_archives_functions.php +++ b/src/admin/inc/inc_archives_functions.php @@ -537,12 +537,10 @@ function AnalyseHtmlBody($body, &$description, &$litpic, &$keywords, $dtype = '' //自动获取关键词 if ($autokey == 1) { $subject = $title; - $message = $body; //采用DedeBIZ Core分词组件分词 if (!empty($cfg_bizcore_appid) && !empty($cfg_bizcore_key)) { $keywords = ''; $client = new DedeBizClient(); - $data = $client->Spliteword($subject.Html2Text($message)); $keywords = $data->data; $client->Close(); } else { @@ -552,24 +550,14 @@ function AnalyseHtmlBody($body, &$description, &$litpic, &$keywords, $dtype = '' $sp->SetSource($subject, $cfg_soft_lang); $sp->StartAnalysis(); $titleindexs = preg_replace("/#p#|#e#/", '', $sp->GetFinallyIndex()); - $sp->SetSource(Html2Text($message), $cfg_soft_lang); $sp->StartAnalysis(); - $allindexs = preg_replace("/#p#|#e#/", '', $sp->GetFinallyIndex()); - if (is_array($allindexs) && is_array($titleindexs)) { + if (is_array($titleindexs)) { foreach ($titleindexs as $k => $v) { if (strlen($keywords.$k) >= 60) { break; } else { - if (strlen($k) <= 2 || $length == 3) continue; - $keywords .= $k.','; - } - } - foreach ($allindexs as $k => $v) { - if (strlen($keywords.$k) >= 60) { - break; - } else if (!in_array($k, $titleindexs)) { - if (strlen($k) <= 2 || $length == 3) continue; - $keywords .= $k.','; + if (strlen($k) <= 6 || $length == 3) continue; + $keywords .= ($keywords == '' ? "{$k}" : ",{$k}"); } } }