From 011cf052979d3c60d4c9a9ccefd3f1c1cf53cc90 Mon Sep 17 00:00:00 2001 From: BlueMatthew Date: Thu, 22 Feb 2024 14:23:19 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E4=B8=80=E9=85=8D=E7=BD=AE=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E7=9A=84=E5=90=8D=E5=AD=97=E9=A3=8E=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xypower/common/MicroPhotoContext.java | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/common/src/main/java/com/xypower/common/MicroPhotoContext.java b/common/src/main/java/com/xypower/common/MicroPhotoContext.java index 305f4e40..7ddf66f0 100644 --- a/common/src/main/java/com/xypower/common/MicroPhotoContext.java +++ b/common/src/main/java/com/xypower/common/MicroPhotoContext.java @@ -134,11 +134,11 @@ public class MicroPhotoContext { JSONObject jsonObject = TextUtils.isEmpty(content) ? new JSONObject() : new JSONObject(content); appConfig.cmdid = jsonObject.optString("CMDID", ""); - appConfig.server = jsonObject.optString("Server", ""); - appConfig.port = jsonObject.optInt("Port", 0); - appConfig.protocol = jsonObject.optInt("Protocol", DEFAULT_PROTOCOL); - appConfig.networkProtocol = jsonObject.optInt("NetworkProtocol", 0); - appConfig.network = jsonObject.optInt("Network", 0); + appConfig.server = jsonObject.optString("server", ""); + appConfig.port = jsonObject.optInt("port", 0); + appConfig.protocol = jsonObject.optInt("protocol", DEFAULT_PROTOCOL); + appConfig.networkProtocol = jsonObject.optInt("networkProtocol", 0); + appConfig.network = jsonObject.optInt("network", 0); appConfig.heartbeat = jsonObject.optInt("heartbeat", 0); appConfig.packetSize = jsonObject.optInt("packetSize", 0); @@ -162,11 +162,11 @@ public class MicroPhotoContext { JSONObject jsonObject = TextUtils.isEmpty(content) ? new JSONObject() : new JSONObject(content); appConfig.cmdid = jsonObject.optString("CMDID", ""); - appConfig.server = jsonObject.optString("Server", ""); - appConfig.port = jsonObject.optInt("Port", 0); - appConfig.protocol = jsonObject.optInt("Protocol", DEFAULT_PROTOCOL); - appConfig.networkProtocol = jsonObject.optInt("NetworkProtocol", 0); - appConfig.network = jsonObject.optInt("Network", 0); + appConfig.server = jsonObject.optString(jsonObject.has("server") ? "server" : "Server", ""); + appConfig.port = jsonObject.optInt(jsonObject.has("port") ? "port" : "Port", 0); + appConfig.protocol = jsonObject.optInt(jsonObject.has("protocol") ? "protocol" : "Protocol", DEFAULT_PROTOCOL); + appConfig.networkProtocol = jsonObject.optInt(jsonObject.has("networkProtocol") ? "networkProtocol" : "NetworkProtocol", 0); + appConfig.network = jsonObject.optInt(jsonObject.has("network") ? "network" : "Network", 0); appConfig.heartbeat = jsonObject.optInt("heartbeat", 0); appConfig.packetSize = jsonObject.optInt("packetSize", 0); @@ -196,11 +196,11 @@ public class MicroPhotoContext { JSONObject jsonObject = TextUtils.isEmpty(content) ? new JSONObject() : new JSONObject(content); jsonObject.put("CMDID", appConfig.cmdid); - jsonObject.put("Server", appConfig.server); - jsonObject.put("Port", appConfig.port); - jsonObject.put("Protocol", appConfig.protocol); - jsonObject.put("NetworkProtocol", appConfig.networkProtocol); - jsonObject.put("Network", appConfig.network); + jsonObject.put("server", appConfig.server); + jsonObject.put("port", appConfig.port); + jsonObject.put("protocol", appConfig.protocol); + jsonObject.put("networkProtocol", appConfig.networkProtocol); + jsonObject.put("network", appConfig.network); if (appConfig.heartbeat > 0) { jsonObject.put("heartbeat", appConfig.heartbeat);