feat: 添加精确的账户费用计算和时区支持

- 实现基于模型使用量的精确每日费用计算
- 添加 dateHelper 工具支持时区转换
- 移除未使用的 webhook 配置代码
- 清理环境变量和配置文件中的 webhook 相关设置
- 优化前端费用显示,使用后端精确计算的数据
- 添加 DEBUG_HTTP_TRAFFIC 调试选项支持

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
shaw
2025-09-01 11:29:16 +08:00
parent 246bdc928a
commit 5cfa3cc72f
16 changed files with 476 additions and 151 deletions

View File

@@ -2,6 +2,7 @@ const axios = require('axios')
const crypto = require('crypto')
const logger = require('../utils/logger')
const webhookConfigService = require('./webhookConfigService')
const { getISOStringWithTimezone } = require('../utils/dateHelper')
class WebhookService {
constructor() {
@@ -206,7 +207,7 @@ class WebhookService {
const payload = {
type,
service: 'claude-relay-service',
timestamp: new Date().toISOString(),
timestamp: getISOStringWithTimezone(new Date()),
data
}
@@ -357,7 +358,7 @@ class WebhookService {
title,
color,
fields,
timestamp: new Date().toISOString(),
timestamp: getISOStringWithTimezone(new Date()),
footer: {
text: 'Claude Relay Service'
}
@@ -580,7 +581,7 @@ class WebhookService {
try {
const testData = {
message: 'Claude Relay Service webhook测试',
timestamp: new Date().toISOString()
timestamp: getISOStringWithTimezone(new Date())
}
await this.sendToPlatform(platform, 'test', testData, { maxRetries: 1, retryDelay: 1000 })