feat: 完善跟单模板管理功能
- 更新需求文档:移除每日最大亏损限制、跟单延迟、轮询和WebSocket配置 - 跟单比例改为百分比格式(10%-1000%),只允许整数 - 所有USDC字段支持最多4位小数 - 固定金额和最小金额校验(必须>=1) - 模板名称支持编辑 - 复制模板改为Modal形式,可编辑后创建 - 模板列表按创建时间降序排序,显示创建时间 - 移动端适配:使用卡片式布局 - 合并跟单比例和固定金额列为跟单配置 - 支持卖出改为跟单卖出 - 菜单结构调整:跟单管理作为父菜单,包含跟单模板和跟单配置子菜单
This commit is contained in:
@@ -143,13 +143,13 @@ export const apiService = {
|
||||
/**
|
||||
* 添加 Leader
|
||||
*/
|
||||
add: (data: any) =>
|
||||
add: (data: { leaderAddress: string; leaderName?: string; category?: string }) =>
|
||||
apiClient.post<ApiResponse<any>>('/copy-trading/leaders/add', data),
|
||||
|
||||
/**
|
||||
* 更新 Leader
|
||||
*/
|
||||
update: (data: any) =>
|
||||
update: (data: { leaderId: number; leaderName?: string; category?: string }) =>
|
||||
apiClient.post<ApiResponse<any>>('/copy-trading/leaders/update', data),
|
||||
|
||||
/**
|
||||
@@ -161,25 +161,90 @@ export const apiService = {
|
||||
/**
|
||||
* 查询 Leader 列表
|
||||
*/
|
||||
list: (data: { enabled?: boolean; category?: string } = {}) =>
|
||||
apiClient.post<ApiResponse<any>>('/copy-trading/leaders/list', data)
|
||||
list: (data: { category?: string } = {}) =>
|
||||
apiClient.post<ApiResponse<any>>('/copy-trading/leaders/list', data),
|
||||
|
||||
/**
|
||||
* 查询 Leader 详情
|
||||
*/
|
||||
detail: (data: { leaderId: number }) =>
|
||||
apiClient.post<ApiResponse<any>>('/copy-trading/leaders/detail', data)
|
||||
},
|
||||
|
||||
/**
|
||||
* 配置管理 API
|
||||
* 跟单模板管理 API(子菜单:跟单模板)
|
||||
*/
|
||||
config: {
|
||||
templates: {
|
||||
/**
|
||||
* 获取全局配置
|
||||
* 创建模板
|
||||
*/
|
||||
get: () =>
|
||||
apiClient.post<ApiResponse<any>>('/copy-trading/config/get', {}),
|
||||
create: (data: any) =>
|
||||
apiClient.post<ApiResponse<any>>('/copy-trading/templates/create', data),
|
||||
|
||||
/**
|
||||
* 更新全局配置
|
||||
* 更新模板
|
||||
*/
|
||||
update: (data: any) =>
|
||||
apiClient.post<ApiResponse<void>>('/copy-trading/config/update', data)
|
||||
apiClient.post<ApiResponse<any>>('/copy-trading/templates/update', data),
|
||||
|
||||
/**
|
||||
* 删除模板
|
||||
*/
|
||||
delete: (data: { templateId: number }) =>
|
||||
apiClient.post<ApiResponse<void>>('/copy-trading/templates/delete', data),
|
||||
|
||||
/**
|
||||
* 复制模板
|
||||
*/
|
||||
copy: (data: any) =>
|
||||
apiClient.post<ApiResponse<any>>('/copy-trading/templates/copy', data),
|
||||
|
||||
/**
|
||||
* 查询模板列表
|
||||
*/
|
||||
list: () =>
|
||||
apiClient.post<ApiResponse<any>>('/copy-trading/templates/list', {}),
|
||||
|
||||
/**
|
||||
* 查询模板详情
|
||||
*/
|
||||
detail: (data: { templateId: number }) =>
|
||||
apiClient.post<ApiResponse<any>>('/copy-trading/templates/detail', data)
|
||||
},
|
||||
|
||||
/**
|
||||
* 跟单配置管理 API(子菜单:跟单配置)
|
||||
*/
|
||||
copyTrading: {
|
||||
/**
|
||||
* 创建跟单
|
||||
*/
|
||||
create: (data: { accountId: number; templateId: number; leaderId: number; enabled?: boolean }) =>
|
||||
apiClient.post<ApiResponse<any>>('/copy-trading/create', data),
|
||||
|
||||
/**
|
||||
* 查询跟单列表
|
||||
*/
|
||||
list: (data: { accountId?: number; templateId?: number; leaderId?: number; enabled?: boolean } = {}) =>
|
||||
apiClient.post<ApiResponse<any>>('/copy-trading/list', data),
|
||||
|
||||
/**
|
||||
* 更新跟单状态
|
||||
*/
|
||||
updateStatus: (data: { copyTradingId: number; enabled: boolean }) =>
|
||||
apiClient.post<ApiResponse<any>>('/copy-trading/update-status', data),
|
||||
|
||||
/**
|
||||
* 删除跟单
|
||||
*/
|
||||
delete: (data: { copyTradingId: number }) =>
|
||||
apiClient.post<ApiResponse<void>>('/copy-trading/delete', data),
|
||||
|
||||
/**
|
||||
* 查询钱包绑定的模板
|
||||
*/
|
||||
getAccountTemplates: (data: { accountId: number }) =>
|
||||
apiClient.post<ApiResponse<any>>('/copy-trading/account-templates', data)
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user