Administrator
2026-08-13 85a2c65e624650ebae57cc5d26aad22fdebbfc59
src/main/java/com/xcong/excoin/modules/gateApi/HeartbeatScheduler.java
@@ -3,6 +3,7 @@
import com.xcong.excoin.modules.station.model.GateStatsEvent;
import com.xcong.excoin.modules.station.model.HeartbeatMsg;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@@ -24,6 +25,9 @@
    @Resource
    private GateWebSocketClientManager manager;
    @Resource
    private Environment environment;
    private String apiKeyMd5;
    private String hostPort;
@@ -70,8 +74,8 @@
    private String resolveHostPort() {
        try {
            String host = InetAddress.getLocalHost().getHostAddress();
            // port 从 Spring 环境变量获取,默认 8888
            String port = System.getProperty("server.port", "8888");
            // port 从 Spring Environment 获取(兼容 --server.port=xxx 命令行参数),默认 8888
            String port = environment.getProperty("server.port", "8888");
            return host + ":" + port;
        } catch (Exception e) {
            return "unknown";