From ed57e750b5e2cf14fe5d447ff318228f8df77d23 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Fri, 05 Jun 2026 16:48:51 +0800
Subject: [PATCH] refactor(okx): 移除算法单频道处理器并优化网格交易重置逻辑

---
 src/main/java/com/xcong/excoin/modules/okxNewPrice/OkxGridWsClient.java |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/xcong/excoin/modules/okxNewPrice/OkxGridWsClient.java b/src/main/java/com/xcong/excoin/modules/okxNewPrice/OkxGridWsClient.java
index b6974ae..8d5329b 100644
--- a/src/main/java/com/xcong/excoin/modules/okxNewPrice/OkxGridWsClient.java
+++ b/src/main/java/com/xcong/excoin/modules/okxNewPrice/OkxGridWsClient.java
@@ -137,7 +137,11 @@
                     isConnecting.set(false);
                     if (sharedExecutor != null && !sharedExecutor.isShutdown()) {
                         resetHeartbeatTimer();
-                        wsLogin();
+                        if (isPublic) {
+                            subscribeAllHandlers();
+                        } else {
+                            wsLogin();
+                        }
                     }
                 }
 
@@ -225,6 +229,21 @@
 
             if ("subscribe".equals(event) || "unsubscribe".equals(event)) {
                 log.info("[{}] {}事件: {}", logPrefix, event, response.getString("arg"));
+                // 订阅成功确认:解析频道名并通知对应 handler
+                if ("subscribe".equals(event)) {
+                    JSONObject argObj = response.getJSONObject("arg");
+                    if (argObj != null) {
+                        String channel = argObj.getString("channel");
+                        if (channel != null) {
+                            for (OkxGridChannelHandler handler : channelHandlers) {
+                                if (channel.equals(handler.getChannelName())) {
+                                    handler.onSubscribed();
+                                    break;
+                                }
+                            }
+                        }
+                    }
+                }
                 return;
             }
 

--
Gitblit v1.9.1