| | |
| | | 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; |
| | |
| | | |
| | | @Resource |
| | | private GateWebSocketClientManager manager; |
| | | |
| | | @Resource |
| | | private Environment environment; |
| | | |
| | | private String apiKeyMd5; |
| | | private String hostPort; |
| | |
| | | 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"; |