From 24b35232b40a5a06e47f1b713bf25283f485de44 Mon Sep 17 00:00:00 2001 From: User Date: Fri, 13 Mar 2026 23:45:09 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E4=B8=80=E9=82=AE=E4=BB=B6=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E7=B3=BB=E7=BB=9F=EF=BC=9A=E6=B7=BB=E5=8A=A0=20blackl?= =?UTF-8?q?ist=5Fspam=5Fnotify=20=E5=92=8C=20username=5Fchange=5Fnotify=20?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=EF=BC=8C=E9=87=8D=E6=9E=84=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=BD=BF=E7=94=A8=E7=BB=9F=E4=B8=80=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- email-templates/base.php | 95 ++++++++++++++++ email-templates/blacklist-spam-notify.php | 62 ++--------- email-templates/username-change-notify.php | 123 ++------------------- 3 files changed, 116 insertions(+), 164 deletions(-) diff --git a/email-templates/base.php b/email-templates/base.php index 657d974..64095ff 100644 --- a/email-templates/base.php +++ b/email-templates/base.php @@ -68,6 +68,38 @@ function argon_get_email_types() {

识别码:{{ai_detection_code}}

如果您认为这是误判,请通过识别码查询详细信息或联系网站管理员申诉。

+

+ 查询识别详情 +

', + 'placeholders' => array( + 'blog_name' => __('博客名称', 'argon'), + 'post_title' => __('文章标题', 'argon'), + 'post_url' => __('文章链接', 'argon'), + 'commenter_name' => __('评论者名称', 'argon'), + 'comment_content' => __('评论内容', 'argon'), + 'ai_spam_reason' => __('AI 识别理由', 'argon'), + 'ai_detection_code' => __('AI 识别码', 'argon'), + 'query_url' => __('查询链接', 'argon'), + 'unsubscribe_url' => __('退订链接', 'argon'), + 'theme_color' => __('主题色', 'argon'), + ), + ), + 'panic_mode_notify' => array( + 'name' => __('怕死模式审核通知', 'argon'), + 'description' => __('当评论在怕死模式下未通过审核时发送给评论者', 'argon'), + 'default_subject' => '[{{blog_name}}] 您的评论未通过审核', + 'default_content' => '

评论审核通知

+

尊敬的用户 {{commenter_name}}

+

您在文章《{{post_title}}》中发表的评论未通过系统审核。

+
+

您的评论内容

+

{{comment_content}}

+
+
+

审核说明

+

很抱歉,由于该文章当前处于特殊审核状态,评论内容需要经过更严格的审查。您的评论未能通过此次审核,建议您修改后重新提交。

+
+

如果您认为这是误判,请联系网站管理员申诉。

查询识别详情

', @@ -134,6 +166,69 @@ function argon_get_email_types() { 'theme_color' => __('主题色', 'argon'), ), ), + 'blacklist_spam_notify' => array( + 'name' => __('黑名单拦截通知', 'argon'), + 'description' => __('当评论被黑名单关键字拦截时发送给评论者', 'argon'), + 'default_subject' => '[{{blog_name}}] 您的评论被系统拦截', + 'default_content' => '

评论拦截通知

+

您好,{{commenter_name}}

+

您在文章《{{post_title}}》中的评论因触发关键字过滤规则而被系统自动拦截。

+
+

您的评论内容

+

{{comment_content}}

+
+
+

触发的关键字:{{blacklist_keywords}}

+
+

如果您认为这是一次误判,可以点击下方按钮申请 AI 复审。

+

+ 申请 AI 复审 +

', + 'placeholders' => array( + 'blog_name' => __('博客名称', 'argon'), + 'post_title' => __('文章标题', 'argon'), + 'post_url' => __('文章链接', 'argon'), + 'commenter_name' => __('评论者名称', 'argon'), + 'comment_content' => __('评论内容', 'argon'), + 'blacklist_keywords' => __('触发的关键字', 'argon'), + 'feedback_url' => __('申诉链接', 'argon'), + 'theme_color' => __('主题色', 'argon'), + ), + ), + 'username_change_notify' => array( + 'name' => __('用户名变更通知', 'argon'), + 'description' => __('当评论用户名被 AI 识别为不合规并自动修改时发送给评论者', 'argon'), + 'default_subject' => '[{{blog_name}}] 您的评论用户名已被修改', + 'default_content' => '

用户名变更通知

+

您好,{{original_username}}

+

您在文章《{{post_title}}》发表的评论已成功提交,但系统检测到您的用户名可能不符合规范。

+
+

AI 检测结果

+

{{ai_reason}}

+
+
+

原用户名:{{original_username}}

+

新用户名:{{new_username}}

+
+
+

温馨提示

+

您的评论内容正常,仅用户名被自动修改。今后发表评论时,请使用符合规范的用户名。

+
+

+ 查看您的评论 +

', + 'placeholders' => array( + 'blog_name' => __('博客名称', 'argon'), + 'post_title' => __('文章标题', 'argon'), + 'post_url' => __('文章链接', 'argon'), + 'original_username' => __('原用户名', 'argon'), + 'new_username' => __('新用户名', 'argon'), + 'ai_reason' => __('AI 判断理由', 'argon'), + 'ai_detection_code' => __('识别码', 'argon'), + 'comment_url' => __('评论链接', 'argon'), + 'theme_color' => __('主题色', 'argon'), + ), + ), ); // 允许通过 filter 扩展邮件类型 diff --git a/email-templates/blacklist-spam-notify.php b/email-templates/blacklist-spam-notify.php index 5bc99f9..6983441 100644 --- a/email-templates/blacklist-spam-notify.php +++ b/email-templates/blacklist-spam-notify.php @@ -43,58 +43,16 @@ function argon_send_blacklist_spam_notify_email($comment) { 'token' => $feedback_token ], home_url()); - // 邮件设置 - $settings = argon_get_email_settings(); - $site_name = get_bloginfo('name'); - $site_url = home_url(); - - // 邮件主题 - $subject = sprintf('[%s] 您的评论被系统拦截', $site_name); - - // 邮件内容 - $message = argon_get_email_template('base', [ - 'site_name' => $site_name, - 'site_url' => $site_url, - 'header_color' => $settings['header_color'], - 'content' => sprintf(' -

评论拦截通知

-

- 您好,%s! -

-

- 您在文章《%s》中的评论因触发关键字过滤规则而被系统自动拦截。 -

-
-

您的评论内容:

-

%s

-
-
-

触发的关键字:%s

-
-

- 如果您认为这是一次误判,可以点击下方按钮申请 AI 复审。我们的 AI 系统会重新评估您的评论,如果确认无误,将自动恢复您的评论并优化关键字规则。 -

-
- 申请 AI 复审 -
-

- 此邮件由系统自动发送,请勿直接回复。如有疑问,请联系网站管理员。 -

- ', - esc_html($comment->comment_author), - esc_url(get_permalink($post->ID)), - esc_html($post->post_title), - esc_html($comment->comment_content), - esc_html($keywords_text), - esc_url($feedback_url) - ) - ]); + // 准备模板变量 + $vars = array( + 'post_title' => $post->post_title, + 'post_url' => get_permalink($post->ID), + 'commenter_name' => $comment->comment_author, + 'comment_content' => $comment->comment_content, + 'blacklist_keywords' => $keywords_text, + 'feedback_url' => $feedback_url, + ); // 发送邮件 - $headers = ['Content-Type: text/html; charset=UTF-8']; - if (!empty($settings['from_email'])) { - $headers[] = 'From: ' . $settings['from_name'] . ' <' . $settings['from_email'] . '>'; - } - - return wp_mail($comment->comment_author_email, $subject, $message, $headers); + return argon_send_email($comment->comment_author_email, 'blacklist_spam_notify', $vars); } diff --git a/email-templates/username-change-notify.php b/email-templates/username-change-notify.php index 40f14d9..5c75983 100644 --- a/email-templates/username-change-notify.php +++ b/email-templates/username-change-notify.php @@ -31,118 +31,17 @@ function argon_send_username_change_notify_email($comment, $original_username, $ return false; } - // 获取 AI 配置信息 - $provider = get_option('argon_ai_summary_provider', 'openai'); - $model = get_option('argon_ai_summary_model', ''); - - $provider_names = [ - 'openai' => 'OpenAI', - 'anthropic' => 'Anthropic', - 'deepseek' => 'DeepSeek', - 'qianwen' => '通义千问', - 'wenxin' => '文心一言', - 'doubao' => '豆包', - 'kimi' => 'Kimi', - 'zhipu' => '智谱', - 'siliconflow' => 'SiliconFlow' - ]; - - $provider_display = isset($provider_names[$provider]) ? $provider_names[$provider] : $provider; - - // 获取邮件设置 - $settings = argon_get_email_settings(); - - // 构建邮件内容 - $email_subject = sprintf(__('您在「%s」的评论用户名已被修改', 'argon'), wp_trim_words($post->post_title, 20)); - - $email_body = ' -
-

- ' . __('用户名变更通知', 'argon') . ' -

-

- ' . sprintf(__('您好,%s!', 'argon'), '' . esc_html($original_username) . '') . ' -

-

- ' . sprintf( - __('您在文章「%s」发表的评论已成功提交,但系统检测到您的用户名可能不符合规范。', 'argon'), - esc_url(get_permalink($post->ID)), - $settings['theme_color'], - esc_html($post->post_title) - ) . ' -

-
- -
-

- ' . __('AI 检测结果', 'argon') . ' -

-

- ' . esc_html($reason) . ' -

-
- -
- - - - - - - - - -
- ' . __('原用户名', 'argon') . ' - - ' . esc_html($original_username) . ' -
- ' . __('新用户名', 'argon') . ' - - ' . esc_html($new_username) . ' -
-
- -
-

- ' . __('温馨提示', 'argon') . ' -

-

- ' . __('您的评论内容正常,仅用户名被自动修改。今后发表评论时,请使用符合规范的用户名。', 'argon') . ' -

-
- -
- - ' . __('查看您的评论', 'argon') . ' - -
- -
-

- ' . __('检测信息', 'argon') . ' -

- - - - - - - - - - - - - -
' . __('AI 模型', 'argon') . ':' . esc_html($provider_display) . ' - ' . esc_html($model) . '
' . __('识别码', 'argon') . ':' . esc_html($detection_code) . '
' . __('检测时间', 'argon') . ':' . current_time('Y-m-d H:i:s') . '
-
- '; - - // 渲染完整邮件 - $html = argon_render_email($email_body, ['subject' => $email_subject]); + // 准备模板变量 + $vars = array( + 'post_title' => $post->post_title, + 'post_url' => get_permalink($post->ID), + 'original_username' => $original_username, + 'new_username' => $new_username, + 'ai_reason' => $reason, + 'ai_detection_code' => $detection_code, + 'comment_url' => get_comment_link($comment), + ); // 发送邮件 - return send_mail($comment->comment_author_email, $email_subject, $html); + return argon_send_email($comment->comment_author_email, 'username_change_notify', $vars); }