fix(okxNewPrice): 修复 WebSocket 推送数据字段缺失问题
- 增加对 'arg' 字段的空值检查
- 增加对 'channel' 字段的空值检查
- 添加缺失字段时的日志警告信息
- 避免因字段缺失导致的潜在运行时异常
| | |
| | | } |
| | | |
| | | private void subscribeEvent(JSONObject response) { |
| | | String channel = response.getString("channel"); |
| | | JSONObject arg = response.getJSONObject("arg"); |
| | | if (arg == null) { |
| | | log.warn("无效的推送数据,缺少 'arg' 字段 :{}",response); |
| | | return; |
| | | } |
| | | |
| | | String channel = arg.getString("channel"); |
| | | if (channel == null) { |
| | | log.warn("无效的推送数据,缺少 'channel' 字段{}",response); |
| | | return; |
| | | } |
| | | if (OrderInfoWs.ORDERINFOWS_CHANNEL.equals(channel)) { |
| | | OrderInfoWs.initEvent(response); |
| | | } |