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
+12 -4
View File
@@ -18,12 +18,14 @@ import {
GithubOutlined,
TwitterOutlined,
GlobalOutlined,
CheckCircleOutlined
CheckCircleOutlined,
NotificationOutlined
} from '@ant-design/icons'
import type { MenuProps } from 'antd'
import type { ReactNode } from 'react'
import { removeToken } from '../utils'
import { wsManager } from '../services/websocket'
import Logo from './Logo'
const { Header, Content, Sider } = AntLayout
@@ -133,6 +135,11 @@ const Layout: React.FC<LayoutProps> = ({ children }) => {
key: '/system-settings/proxy',
icon: <LinkOutlined />,
label: t('menu.proxy')
},
{
key: '/system-settings/notifications',
icon: <NotificationOutlined />,
label: t('menu.notifications')
}
]
},
@@ -198,9 +205,10 @@ const Layout: React.FC<LayoutProps> = ({ children }) => {
alignItems: 'center',
justifyContent: 'space-between'
}}>
<div style={{ color: '#fff', fontSize: '18px', fontWeight: 'bold' }}>
PolyHermes
</div>
<Logo
size="normal"
darkMode={true}
/>
<div style={{ display: 'flex', alignItems: 'center', gap: '12px' }}>
<a
href="https://github.com/WrBug/PolyHermes"