From 88be178cdecf1af5a697956006489147ee9045dc Mon Sep 17 00:00:00 2001 From: WrBug Date: Wed, 3 Dec 2025 23:38:01 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF=E8=B7=9F=E5=8D=95=E9=85=8D=E7=BD=AE=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=92=8C=E9=87=8D=E8=AF=95=E8=AE=A2=E5=8D=95=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移动端跟单配置管理添加Switch开关,支持开启/停用跟单 - 在移动端卡片布局中添加Switch组件 - 与桌面端功能保持一致 - 优化重试订单的日志记录逻辑 - 第一次失败时不记录日志,静默重试 - 只在重试后仍然失败时才记录日志 - 减少不必要的日志输出,提高日志质量 --- .../service/CopyOrderTrackingService.kt | 12 +++++++++--- frontend/src/pages/CopyTradingList.tsx | 9 ++++++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/backend/src/main/kotlin/com/wrbug/polymarketbot/service/CopyOrderTrackingService.kt b/backend/src/main/kotlin/com/wrbug/polymarketbot/service/CopyOrderTrackingService.kt index 9e8991f..48300cf 100644 --- a/backend/src/main/kotlin/com/wrbug/polymarketbot/service/CopyOrderTrackingService.kt +++ b/backend/src/main/kotlin/com/wrbug/polymarketbot/service/CopyOrderTrackingService.kt @@ -661,10 +661,12 @@ class CopyOrderTrackingService( if (!orderResponse.isSuccessful || orderResponse.body() == null) { lastError = Exception("创建订单失败: code=${orderResponse.code()}, message=${orderResponse.message()}") if (attempt < 2) { - logger.warn("创建订单失败,准备重试(重新签名): copyTradingId=$copyTradingId, tradeId=$tradeId, attempt=$attempt") + // 第一次失败不记录日志,静默重试 delay(1000) // 重试前等待1秒 continue } + // 重试后仍然失败,记录日志 + logger.warn("创建订单失败(重试后仍失败): copyTradingId=$copyTradingId, tradeId=$tradeId, attempt=$attempt, code=${orderResponse.code()}, message=${orderResponse.message()}") return Result.failure(lastError!!) } @@ -672,10 +674,12 @@ class CopyOrderTrackingService( if (!response.success || response.orderId == null) { lastError = Exception("创建订单失败: errorMsg=${response.errorMsg}") if (attempt < 2) { - logger.warn("创建订单失败,准备重试(重新签名): copyTradingId=$copyTradingId, tradeId=$tradeId, attempt=$attempt, errorMsg=${response.errorMsg}") + // 第一次失败不记录日志,静默重试 delay(1000) // 重试前等待1秒 continue } + // 重试后仍然失败,记录日志 + logger.warn("创建订单失败(重试后仍失败): copyTradingId=$copyTradingId, tradeId=$tradeId, attempt=$attempt, errorMsg=${response.errorMsg}") return Result.failure(lastError!!) } @@ -684,10 +688,12 @@ class CopyOrderTrackingService( } catch (e: Exception) { lastError = e if (attempt < 2) { - logger.warn("调用创建订单API异常,准备重试(重新签名): copyTradingId=$copyTradingId, tradeId=$tradeId, attempt=$attempt", e) + // 第一次失败不记录日志,静默重试 delay(1000) // 重试前等待1秒 continue } + // 重试后仍然失败,记录日志 + logger.warn("调用创建订单API异常(重试后仍失败): copyTradingId=$copyTradingId, tradeId=$tradeId, attempt=$attempt", e) return Result.failure(e) } } diff --git a/frontend/src/pages/CopyTradingList.tsx b/frontend/src/pages/CopyTradingList.tsx index 6634f19..ca75285 100644 --- a/frontend/src/pages/CopyTradingList.tsx +++ b/frontend/src/pages/CopyTradingList.tsx @@ -464,10 +464,17 @@ const CopyTradingList: React.FC = () => { }}> {record.templateName} -
+
{record.enabled ? '启用' : '禁用'} + handleToggleStatus(record)} + checkedChildren="开启" + unCheckedChildren="停止" + size="small" + />