From c6188faf1529cb869b5dd2e36c99609a9d3daa42 Mon Sep 17 00:00:00 2001 From: BlueMatthew Date: Fri, 12 Jan 2024 11:32:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=BF=90=E7=BB=B4=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/xypower/common/JSONUtils.java | 2 +- .../main/java/com/xypower/mpmaster/AppMaster.java | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/common/src/main/java/com/xypower/common/JSONUtils.java b/common/src/main/java/com/xypower/common/JSONUtils.java index 27e8fe16..bd98c7ef 100644 --- a/common/src/main/java/com/xypower/common/JSONUtils.java +++ b/common/src/main/java/com/xypower/common/JSONUtils.java @@ -107,7 +107,7 @@ public class JSONUtils { return false; } - public static boolean updateJsonProperty(JSONObject jsonObject, String name, int fieldType, JSONObject val) { + public static boolean updateJsonProperty(JSONObject jsonObject, String name, int fieldType, Object val) { if (name == null) { return false; } diff --git a/mpmaster/src/main/java/com/xypower/mpmaster/AppMaster.java b/mpmaster/src/main/java/com/xypower/mpmaster/AppMaster.java index cff92c7f..4a651b75 100644 --- a/mpmaster/src/main/java/com/xypower/mpmaster/AppMaster.java +++ b/mpmaster/src/main/java/com/xypower/mpmaster/AppMaster.java @@ -93,7 +93,7 @@ public class AppMaster { @Override public void run() { - // mMasterUrl = "http://192.168.50.50/mntn/"; + // mMasterUrl = "http://192.168.50.100/mntn/"; String masterUrl = mMasterUrl; @@ -210,17 +210,16 @@ public class AppMaster { JSONArray jsonConfigs = null; try { jsonConfigs = jsonObject.getJSONArray("configs"); + String path = jsonObject.optString("path", null); + String fileName = jsonObject.optString("fileName", null); if (jsonConfigs != null) { for (int idx = 0; idx < jsonConfigs.length(); idx++) { JSONObject jsonConfig = jsonConfigs.getJSONObject(idx); - - String path = jsonConfig.optString("path", null); - String fileName = jsonConfig.optString("fileName", null); - String configName = jsonConfig.optString("cfgName", null); - int fieldType = jsonConfig.optInt("cfgType", 0); - JSONObject val = jsonConfig.optJSONObject("cfgValue"); + String configName = jsonConfig.optString("name", null); + int fieldType = jsonConfig.optInt("type", 0); + Object val = jsonConfig.opt("value"); updateConfig(path, fileName, configName, fieldType, val); } @@ -277,7 +276,7 @@ public class AppMaster { } } - private boolean updateConfig(String path, String fileName, String name, int fieldType, JSONObject val) { + private boolean updateConfig(String path, String fileName, String name, int fieldType, Object val) { if (name == null) { return false;