Browse Source

获取检验报告图片添加try-catch

lighter 1 năm trước cách đây
mục cha
commit
60517a551e

+ 9 - 5
src/main/java/thyyxxk/wxservice_server/factory/examreport/ExamReportService.java

@@ -67,12 +67,16 @@ public class ExamReportService {
         if (null == code || !code) {
             throw new BizException(response.getString("message"));
         }
-        JSONObject data = response.getJSONObject("data");
-        JSONArray items = data.getJSONArray("items");
         List<String> pics = new ArrayList<>();
-        for (int i = 0; i < items.size(); i++) {
-            JSONObject item = items.getJSONObject(i);
-            pics.add(item.getString("imgData"));
+        try {
+            JSONObject data = response.getJSONObject("data");
+            JSONArray items = data.getJSONArray("items");
+            for (int i = 0; i < items.size(); i++) {
+                JSONObject item = items.getJSONObject(i);
+                pics.add(item.getString("imgData"));
+            }
+        } catch (Exception e) {
+            return pics;
         }
         return pics;
     }