From 9157203653e7cc389e1e3b6a2d7209cc4ae88b49 Mon Sep 17 00:00:00 2001 From: WrBug Date: Sun, 28 Dec 2025 05:04:27 +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=20API=20=E5=81=A5=E5=BA=B7=E9=A1=B5=E9=9D=A2=E7=BC=BA?= =?UTF-8?q?=E5=B0=91=E6=95=B0=E6=8D=AE=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移动端添加 URL 地址显示 - 移动端添加状态文本显示(正常/异常/未配置) - 移动端添加消息/状态信息显示 - 移动端和桌面端显示信息保持一致 --- .../service/accounts/PositionCheckService.kt | 18 +++++------ .../system/TelegramNotificationService.kt | 6 ++-- frontend/src/pages/ApiHealthStatus.tsx | 30 +++++++++---------- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/backend/src/main/kotlin/com/wrbug/polymarketbot/service/accounts/PositionCheckService.kt b/backend/src/main/kotlin/com/wrbug/polymarketbot/service/accounts/PositionCheckService.kt index c34d951..da03f0e 100644 --- a/backend/src/main/kotlin/com/wrbug/polymarketbot/service/accounts/PositionCheckService.kt +++ b/backend/src/main/kotlin/com/wrbug/polymarketbot/service/accounts/PositionCheckService.kt @@ -483,17 +483,17 @@ class PositionCheckService( if (isMarketEnded) { logger.debug("市场已结束: marketId=$marketId, closed=${market.closed}, endDate=${market.endDate}") // 市场已结束,检查该 outcome 是赢了还是输了 - val outcomeResult = checkOutcomeResult(market, outcomeIndex) - when (outcomeResult) { - OutcomeResult.WON -> { + val outcomeResult = checkOutcomeResult(market, outcomeIndex) + when (outcomeResult) { + OutcomeResult.WON -> { logger.info("市场已结束且该 outcome 赢了,返回价格为 1: marketId=$marketId, outcomeIndex=$outcomeIndex") - return BigDecimal.ONE - } - OutcomeResult.LOST -> { + return BigDecimal.ONE + } + OutcomeResult.LOST -> { logger.info("市场已结束且该 outcome 输了,返回价格为 0: marketId=$marketId, outcomeIndex=$outcomeIndex") - return BigDecimal.ZERO - } - OutcomeResult.UNKNOWN -> { + return BigDecimal.ZERO + } + OutcomeResult.UNKNOWN -> { // 无法判断,记录警告并继续使用正常价格逻辑 logger.warn("市场已结束但无法判断 outcome 结果,使用正常价格: marketId=$marketId, outcomeIndex=$outcomeIndex, closed=${market.closed}, endDate=${market.endDate}, outcomePrices=${market.outcomePrices}, bestBid=${market.bestBid}, bestAsk=${market.bestAsk}") } diff --git a/backend/src/main/kotlin/com/wrbug/polymarketbot/service/system/TelegramNotificationService.kt b/backend/src/main/kotlin/com/wrbug/polymarketbot/service/system/TelegramNotificationService.kt index 7276832..0406ccc 100644 --- a/backend/src/main/kotlin/com/wrbug/polymarketbot/service/system/TelegramNotificationService.kt +++ b/backend/src/main/kotlin/com/wrbug/polymarketbot/service/system/TelegramNotificationService.kt @@ -100,14 +100,14 @@ class TelegramNotificationService( if (orderResponse.isSuccessful && orderResponse.body() != null) { val order = orderResponse.body()!! if (actualPrice == null) { - actualPrice = order.price + actualPrice = order.price } if (actualSize == null) { - actualSize = order.originalSize // 使用 originalSize 作为订单数量 + actualSize = order.originalSize // 使用 originalSize 作为订单数量 } actualSide = order.side // 使用订单详情中的 side if (actualOutcome == null) { - actualOutcome = order.outcome // 使用订单详情中的 outcome(市场方向) + actualOutcome = order.outcome // 使用订单详情中的 outcome(市场方向) } } } catch (e: Exception) { diff --git a/frontend/src/pages/ApiHealthStatus.tsx b/frontend/src/pages/ApiHealthStatus.tsx index e0081d4..5fb4c38 100644 --- a/frontend/src/pages/ApiHealthStatus.tsx +++ b/frontend/src/pages/ApiHealthStatus.tsx @@ -99,22 +99,22 @@ const ApiHealthStatus: React.FC = () => { bodyStyle={{ padding: '12px' }} > -
- - {item.name} - - - {item.responseTime !== undefined && item.responseTime !== null && ( - - {item.responseTime}ms - - )} - + + {item.name} + + + {item.responseTime !== undefined && item.responseTime !== null && ( + + {item.responseTime}ms + + )} + - -
+ /> +
+