feat: 重构仓位轮训逻辑并修复多语言配置
主要改动: 1. 创建独立的 PositionCheckService 服务 - 将仓位检查逻辑从 PositionPushService 中分离 - 实现待赎回仓位检查和未卖出订单检查 - 实现订单状态更新逻辑(FIFO策略) 2. 修改 PositionPushService - 后端启动时自动启动轮训任务 - 每次轮训后推送全量数据给所有订阅的客户端 - 调用 PositionCheckService 进行仓位检查 3. 自动赎回功能调整 - 将自动赎回从跟单配置级别移到系统级别 - 添加系统级自动赎回配置管理 - 支持 Builder API Key 配置检查 4. 多语言配置修复 - 修复 PositionCheckService 中的硬编码消息 - 使用 MessageSource 获取多语言文本 - 添加自动赎回和 Builder API Key 相关的多语言资源 5. 数据库迁移 - V8: 添加跟单配置名称字段 - V9: 将自动赎回配置移到系统配置表 6. 前端更新 - 添加系统级自动赎回配置界面 - 更新跟单配置管理界面 - 添加 Builder API Key 配置界面
This commit is contained in:
+16
-2
@@ -92,7 +92,7 @@ function App() {
|
||||
* 处理订单推送消息,显示全局通知
|
||||
*/
|
||||
const handleOrderPush = useCallback((message: OrderPushMessage) => {
|
||||
const { accountName, order, orderDetail } = message
|
||||
const { accountName, order, orderDetail, leaderName, configName } = message
|
||||
|
||||
// 根据订单类型和操作类型确定通知内容
|
||||
const orderTypeText = getOrderTypeText(order.type)
|
||||
@@ -100,7 +100,21 @@ function App() {
|
||||
|
||||
// 如果有市场名称,在标题中显示
|
||||
const marketName = orderDetail?.marketName || order.market.substring(0, 8) + '...'
|
||||
const title = `${accountName} - ${orderTypeText}`
|
||||
|
||||
// 构建标题:如果是跟单订单,显示 leader 备注和跟单配置名
|
||||
let title = `${accountName} - ${orderTypeText}`
|
||||
if (leaderName || configName) {
|
||||
const parts: string[] = []
|
||||
if (configName) {
|
||||
parts.push(configName)
|
||||
}
|
||||
if (leaderName) {
|
||||
parts.push(`Leader: ${leaderName}`)
|
||||
}
|
||||
if (parts.length > 0) {
|
||||
title = `${accountName} (${parts.join(', ')}) - ${orderTypeText}`
|
||||
}
|
||||
}
|
||||
|
||||
// 优先使用订单详情中的数据,如果没有则使用 WebSocket 消息中的数据
|
||||
const price = orderDetail ? parseFloat(orderDetail.price).toFixed(4) : parseFloat(order.price).toFixed(4)
|
||||
|
||||
Reference in New Issue
Block a user