From 503f20b06bece86484f2da55419421396c51a657 Mon Sep 17 00:00:00 2001 From: maplegao Date: Fri, 5 Sep 2025 16:40:24 +0800 Subject: [PATCH] =?UTF-8?q?webhook=E6=97=B6=E9=97=B4=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E6=8C=87=E5=AE=9A=E6=97=B6=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/services/webhookService.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/services/webhookService.js b/src/services/webhookService.js index c026ead6..5cd575f8 100644 --- a/src/services/webhookService.js +++ b/src/services/webhookService.js @@ -3,6 +3,7 @@ const crypto = require('crypto') const logger = require('../utils/logger') const webhookConfigService = require('./webhookConfigService') const { getISOStringWithTimezone } = require('../utils/dateHelper') +const config = require('../../config/config') class WebhookService { constructor() { @@ -15,6 +16,7 @@ class WebhookService { custom: this.sendToCustom.bind(this), bark: this.sendToBark.bind(this) } + this.timezone = config.system.timezone || 'Asia/Shanghai' } /** @@ -309,11 +311,10 @@ class WebhookService { formatMessageForWechatWork(type, data) { const title = this.getNotificationTitle(type) const details = this.formatNotificationDetails(data) - return ( `## ${title}\n\n` + `> **服务**: Claude Relay Service\n` + - `> **时间**: ${new Date().toLocaleString('zh-CN')}\n\n${details}` + `> **时间**: ${new Date().toLocaleString('zh-CN', {timeZone: this.timezone})}\n\n${details}` ) } @@ -325,7 +326,7 @@ class WebhookService { return ( `#### 服务: Claude Relay Service\n` + - `#### 时间: ${new Date().toLocaleString('zh-CN')}\n\n${details}` + `#### 时间: ${new Date().toLocaleString('zh-CN', {timeZone: this.timezone})}\n\n${details}` ) } @@ -450,7 +451,7 @@ class WebhookService { // 添加服务标识和时间戳 lines.push(`\n服务: Claude Relay Service`) - lines.push(`时间: ${new Date().toLocaleString('zh-CN')}`) + lines.push(`时间: ${new Date().toLocaleString('zh-CN', {timeZone: this.timezone})}`) return lines.join('\n') }