From cc55bd528d057226785c08a2924049a8c5ee900c Mon Sep 17 00:00:00 2001 From: wangjinlei <751475802@qq.com> Date: Wed, 3 Jun 2026 13:30:27 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=A0=A1=E5=AF=B9bug?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/common/TurnitinService.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/application/common/TurnitinService.php b/application/common/TurnitinService.php index 0e1dc9aa..47542d94 100644 --- a/application/common/TurnitinService.php +++ b/application/common/TurnitinService.php @@ -218,15 +218,16 @@ class TurnitinService } foreach ($candidates as $n) { - if ($n > 0 && $n <= 1.0) { - $scaled = round($n * 100, 2); - if ($scaled > 1.0 || $n < 0.05) { - return $scaled; - } + if ($n < 0) { + continue; } - if ($n >= 0) { - return round($n, 2); + // Turnitin TCA 的 overall_match_percentage 是 0–100 整数,"1" 即代表 1%。 + // 仅当值是「严格小于 1 的非整数」(真正的 0–1 小数比例,如 0.12=12%)时才 ×100, + // 避免把整数 1(1%)误判成 100%。 + if ($n > 0 && $n < 1.0) { + return round(min($n * 100, 100), 2); } + return round(min($n, 100), 2); } return 0.0;