瀏覽代碼

修改存在歧义方法,JSONObject.put改为set,优化部分代码逻辑

limeng 2 年之前
父節點
當前提交
f087296be3
共有 1 個文件被更改,包括 10 次插入7 次删除
  1. 10 7
      ruoyi-admin/src/main/java/com/ruoyi/hwMeeting/controller/HwMeetingController.java

+ 10 - 7
ruoyi-admin/src/main/java/com/ruoyi/hwMeeting/controller/HwMeetingController.java

@@ -43,8 +43,8 @@ public class HwMeetingController {
                 JSONObject password = JSONUtil.parseObj(o);
                 JSONObject generalInfo = new JSONObject();
                 if (password.getStr("conferenceRole").equals("general")) {
-                    generalInfo.put("conferenceID", object.getStr("conferenceID"));
-                    generalInfo.put("password", password.getStr("password"));
+                    generalInfo.set("conferenceID", object.getStr("conferenceID"));
+                    generalInfo.set("password", password.getStr("password"));
                     mmap.put("info",generalInfo);
                 }
             }
@@ -76,8 +76,8 @@ public class HwMeetingController {
                 JSONObject password = JSONUtil.parseObj(o);
                 JSONObject chairInfo = new JSONObject();
                 if (password.getStr("conferenceRole").equals("chair")) {
-                    chairInfo.put("conferenceID", object.getStr("conferenceID"));
-                    chairInfo.put("password", password.getStr("password"));
+                    chairInfo.set("conferenceID", object.getStr("conferenceID"));
+                    chairInfo.set("password", password.getStr("password"));
                     mmap.put("info",chairInfo);
                 }
             }
@@ -100,15 +100,18 @@ public class HwMeetingController {
         return AjaxResult.error("未查询到数据");
     }
 
+    /**
+     * 判断返回数据是JSONArray还是JSONObject,
+     * 如果是Array 则表示成功
+     * 反之失败
+     * */
     private boolean isSuccess(String result) {
         Object object = new JSONTokener(result).nextValue();
-        /**
-         * 判断返回数据是JSONArray还是JSONObject,如果是Array 则表示成功
-         * */
         if (object instanceof JSONObject) {
             JSONObject jsonObject = (JSONObject) object;
             String error_code = jsonObject.get("error_code").toString();
             System.err.println(error_code);
+            return false;
         }
         return true;
     }