修复运维修改配置文件的bug

serial
BlueMatthew 1 year ago
parent 375ffaca81
commit c6188faf15

@ -107,7 +107,7 @@ public class JSONUtils {
return false; 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) { if (name == null) {
return false; return false;
} }

@ -93,7 +93,7 @@ public class AppMaster {
@Override @Override
public void run() { public void run() {
// mMasterUrl = "http://192.168.50.50/mntn/"; // mMasterUrl = "http://192.168.50.100/mntn/";
String masterUrl = mMasterUrl; String masterUrl = mMasterUrl;
@ -210,17 +210,16 @@ public class AppMaster {
JSONArray jsonConfigs = null; JSONArray jsonConfigs = null;
try { try {
jsonConfigs = jsonObject.getJSONArray("configs"); jsonConfigs = jsonObject.getJSONArray("configs");
String path = jsonObject.optString("path", null);
String fileName = jsonObject.optString("fileName", null);
if (jsonConfigs != null) { if (jsonConfigs != null) {
for (int idx = 0; idx < jsonConfigs.length(); idx++) { for (int idx = 0; idx < jsonConfigs.length(); idx++) {
JSONObject jsonConfig = jsonConfigs.getJSONObject(idx); JSONObject jsonConfig = jsonConfigs.getJSONObject(idx);
String configName = jsonConfig.optString("name", null);
String path = jsonConfig.optString("path", null); int fieldType = jsonConfig.optInt("type", 0);
String fileName = jsonConfig.optString("fileName", null); Object val = jsonConfig.opt("value");
String configName = jsonConfig.optString("cfgName", null);
int fieldType = jsonConfig.optInt("cfgType", 0);
JSONObject val = jsonConfig.optJSONObject("cfgValue");
updateConfig(path, fileName, configName, fieldType, val); 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) { if (name == null) {
return false; return false;

Loading…
Cancel
Save