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
+46
View File
@@ -600,3 +600,49 @@ export interface OrderTrackingRequest {
buyOrderId?: string
}
/**
* 消息推送配置
*/
export interface NotificationConfig {
id?: number
type: string // telegram、discord、slack 等
name: string // 配置名称
enabled: boolean // 是否启用
config: {
botToken?: string // Telegram Bot Token
chatIds?: string[] // Telegram Chat IDs
[key: string]: any // 其他配置字段
}
createdAt?: number
updatedAt?: number
}
/**
* 通知配置请求
*/
export interface NotificationConfigRequest {
type: string
name: string
enabled?: boolean
config: {
botToken?: string
chatIds?: string[] | string // 支持数组或逗号分隔的字符串
[key: string]: any
}
}
/**
* 通知配置更新请求
*/
export interface NotificationConfigUpdateRequest {
id: number
type: string
name: string
enabled?: boolean
config: {
botToken?: string
chatIds?: string[] | string
[key: string]: any
}
}