mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-23 09:38:02 +00:00
9
src/services/webhookService.js
Normal file → Executable file
9
src/services/webhookService.js
Normal file → Executable file
@@ -3,6 +3,7 @@ const crypto = require('crypto')
|
||||
const logger = require('../utils/logger')
|
||||
const webhookConfigService = require('./webhookConfigService')
|
||||
const { getISOStringWithTimezone } = require('../utils/dateHelper')
|
||||
const appConfig = require('../../config/config')
|
||||
|
||||
class WebhookService {
|
||||
constructor() {
|
||||
@@ -15,6 +16,7 @@ class WebhookService {
|
||||
custom: this.sendToCustom.bind(this),
|
||||
bark: this.sendToBark.bind(this)
|
||||
}
|
||||
this.timezone = appConfig.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')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user