feat: 完善 Telegram 推送通知功能

- 推送模板优化:
  - 优先使用账户名称而不是钱包地址
  - 使用市场标题而不是16进制ID
  - 添加可点击的市场链接(支持 slug 和 conditionId)
  - 添加市场方向(outcome)显示
  - 数量和价格从订单详情API获取实际值
  - 失败通知只显示后端返回的msg,不显示完整堆栈

- 多语言支持:
  - 后端推送消息支持多语言(使用前端最后请求的语言)
  - 添加所有 ErrorCode 的多语言资源文件(中文简体、繁体、英文)
  - 通知消息文本全部使用多语言资源

- 功能改进:
  - 从订单详情获取实际的 side、price、size、outcome
  - 支持买入/卖出方向的多语言显示
  - 错误信息优化,只显示后端返回的错误消息
This commit is contained in:
WrBug
2025-12-05 02:20:46 +08:00
parent 41596887c9
commit 777710c2ed
32 changed files with 4059 additions and 21 deletions
+71
View File
@@ -203,6 +203,7 @@
"language": "Language",
"apiHealth": "API Health",
"proxy": "Proxy",
"notifications": "Notifications",
"logout": "Logout",
"logoutConfirm": "Confirm Logout",
"logoutConfirmDesc": "Are you sure you want to logout?",
@@ -428,5 +429,75 @@
"deleteSuccess": "Copy trading deleted successfully",
"deleteFailed": "Failed to delete copy trading",
"deleteConfirm": "Are you sure you want to delete this copy trading relationship?"
},
"notificationSettings": {
"title": "Notification Settings",
"addConfig": "Add Configuration",
"editConfig": "Edit Configuration",
"configName": "Configuration Name",
"configNamePlaceholder": "e.g., My Telegram Bot",
"configNameRequired": "Please enter configuration name",
"type": "Notification Type",
"typeRequired": "Please select notification type",
"enabled": "Enabled Status",
"status": "Status",
"enabledStatus": "Enabled",
"disabledStatus": "Disabled",
"chatIds": "Chat IDs",
"chatIdsPlaceholder": "Chat IDs (click button above to auto-fetch, or enter manually, separate multiple with commas)",
"chatIdsRequired": "Please enter at least one Chat ID",
"chatIdsExtra": "Multiple Chat IDs separated by commas, e.g., 123456789,987654321. Click button above to auto-fetch (need to send message to bot first)",
"chatIdsCount": " recipients",
"chatIdsNotConfigured": "Not Configured",
"edit": "Edit",
"test": "Test",
"delete": "Delete",
"deleteConfirm": "Are you sure you want to delete this configuration?",
"enableSuccess": "Enabled",
"disableSuccess": "Disabled",
"updateStatusFailed": "Failed to update",
"deleteSuccess": "Deleted successfully",
"deleteFailed": "Failed to delete",
"createSuccess": "Created successfully",
"createFailed": "Failed to create",
"updateSuccess": "Updated successfully",
"updateFailed": "Failed to update",
"fetchFailed": "Failed to get configuration list",
"testSuccess": "Test message sent successfully, please check Telegram",
"testFailed": "Failed to send test message",
"getChatIdsSuccess": "Successfully fetched {count} Chat ID(s)",
"getChatIdsFailed": "Failed to get Chat IDs",
"getChatIdsNoToken": "Please enter Bot Token first",
"getChatIdsNoMessage": "Chat ID not found, please send a message to the bot first (e.g., /start), then retry",
"getChatIdsButton": "Get Chat ID"
},
"telegramConfig": {
"title": "Telegram Configuration Guide",
"step1": "Create a Telegram bot via <strong>@BotFather</strong> and get Bot Token",
"step2": "After entering Bot Token, click 'Get Chat ID' button to auto-fetch (need to send message to bot first)",
"step3": "Or manually get Chat ID via <strong>@userinfobot</strong>",
"step4": "Support multiple Chat IDs (separated by commas), all configured users will receive notifications",
"step5": "Telegram messages will be sent automatically when orders succeed or fail",
"botToken": "Bot Token",
"botTokenPlaceholder": "Bot Token (from @BotFather)",
"botTokenRequired": "Please enter Bot Token"
},
"discordConfig": {
"title": "Discord Configuration Guide",
"step1": "Create a Webhook in Discord server",
"step2": "Copy Webhook URL and enter in configuration",
"step3": "Discord messages will be sent automatically when orders succeed or fail",
"webhookUrl": "Webhook URL",
"webhookUrlPlaceholder": "Webhook URL (from Discord server settings)",
"webhookUrlRequired": "Please enter Webhook URL"
},
"slackConfig": {
"title": "Slack Configuration Guide",
"step1": "Create an Incoming Webhook in Slack workspace",
"step2": "Copy Webhook URL and enter in configuration",
"step3": "Slack messages will be sent automatically when orders succeed or fail",
"webhookUrl": "Webhook URL",
"webhookUrlPlaceholder": "Webhook URL (from Slack App settings)",
"webhookUrlRequired": "Please enter Webhook URL"
}
}