feat: 添加系统管理功能(代理配置和API健康检查)
- 新增代理配置管理功能,支持HTTP代理配置(host、port、用户名、密码) - 代理配置存储在数据库中,支持实时生效,无需重启服务 - 代理配置变更时自动重连WebSocket连接(订单推送和跟单服务) - 新增API健康状态检查功能,监控Polymarket各API和Polygon RPC的可用性 - 优化API健康状态UI,支持响应式设计(移动端和桌面端) - 将Ethereum RPC相关配置和代码统一改为Polygon RPC - 修复代理检查时的SSL证书验证问题 - 优化代理配置:关闭代理时保留配置信息,避免重新输入
This commit is contained in:
@@ -387,6 +387,65 @@ export const apiService = {
|
||||
*/
|
||||
list: (data: any) =>
|
||||
apiClient.post<ApiResponse<any>>('/copy-trading/orders/tracking', data)
|
||||
},
|
||||
|
||||
/**
|
||||
* 代理配置 API
|
||||
*/
|
||||
proxyConfig: {
|
||||
/**
|
||||
* 获取当前代理配置
|
||||
*/
|
||||
get: () =>
|
||||
apiClient.post<ApiResponse<any>>('/proxy-config/get', {}),
|
||||
|
||||
/**
|
||||
* 获取所有代理配置
|
||||
*/
|
||||
list: () =>
|
||||
apiClient.post<ApiResponse<any[]>>('/proxy-config/list', {}),
|
||||
|
||||
/**
|
||||
* 保存 HTTP 代理配置
|
||||
*/
|
||||
saveHttp: (data: {
|
||||
enabled: boolean
|
||||
host: string
|
||||
port: number
|
||||
username?: string
|
||||
password?: string
|
||||
}) =>
|
||||
apiClient.post<ApiResponse<any>>('/proxy-config/http/save', data),
|
||||
|
||||
/**
|
||||
* 检查代理是否可用
|
||||
*/
|
||||
check: () =>
|
||||
apiClient.post<ApiResponse<{
|
||||
success: boolean
|
||||
message: string
|
||||
responseTime?: number
|
||||
}>>('/proxy-config/check', {}),
|
||||
|
||||
/**
|
||||
* 删除代理配置
|
||||
*/
|
||||
delete: (data: { id: number }) =>
|
||||
apiClient.post<ApiResponse<void>>('/proxy-config/delete', data),
|
||||
|
||||
/**
|
||||
* 检查所有 API 的健康状态
|
||||
*/
|
||||
checkApiHealth: () =>
|
||||
apiClient.post<ApiResponse<{
|
||||
apis: Array<{
|
||||
name: string
|
||||
url: string
|
||||
status: string
|
||||
message: string
|
||||
responseTime?: number
|
||||
}>
|
||||
}>>('/proxy-config/api-health-check', {})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user