fix: 修复 AI 审查历史记录只显示评论审查的问题

- 在批量扫描结果中添加 username_invalid 字段
- 区分显示评论审查和用户名审查
- 在理由前添加审查类型标识(评论审查/用户名审查)
- 保存完整的检测结果到评论元数据
This commit is contained in:
2026-01-23 16:49:44 +08:00
parent 6f78be2312
commit b3cd3747d3

View File

@@ -8231,18 +8231,31 @@ function argon_spam_detection_scan() {
if (isset($item['is_spam']) && $item['is_spam']) { if (isset($item['is_spam']) && $item['is_spam']) {
$comment = get_comment($comment_id); $comment = get_comment($comment_id);
if ($comment) { if ($comment) {
// 检查是否有用户名问题
$username_invalid = isset($item['username_invalid']) ? $item['username_invalid'] : false;
$reason = isset($item['reason']) ? $item['reason'] : __('未知原因', 'argon');
// 如果有用户名问题,在理由中标注
if ($username_invalid) {
$reason = __('用户名审查:', 'argon') . $reason;
} else {
$reason = __('评论审查:', 'argon') . $reason;
}
$spam_results[] = [ $spam_results[] = [
'comment_id' => $comment_id, 'comment_id' => $comment_id,
'author' => $comment->comment_author, 'author' => $comment->comment_author,
'content' => mb_substr(strip_tags($comment->comment_content), 0, 100), 'content' => mb_substr(strip_tags($comment->comment_content), 0, 100),
'reason' => isset($item['reason']) ? $item['reason'] : __('未知原因', 'argon'), 'reason' => $reason,
'detection_code' => $detection_code 'detection_code' => $detection_code,
'username_invalid' => $username_invalid
]; ];
// 保存检测结果 // 保存检测结果
update_comment_meta($comment_id, '_argon_spam_detection_result', [ update_comment_meta($comment_id, '_argon_spam_detection_result', [
'is_spam' => true, 'is_spam' => true,
'reason' => $item['reason'] 'reason' => $item['reason'],
'username_invalid' => $username_invalid
]); ]);
} }
} else { } else {