From 73b3585a9dd3f745f020fe24796e50031b41a811 Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期四, 15 六月 2023 21:23:09 +0800 Subject: [PATCH] 2023年06月15日21:23:00 --- app/src/main/java/com/hdl/photovoltaic/uni/HDLUniMP.java | 29 ++++++++++++++++++++--------- 1 files changed, 20 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/com/hdl/photovoltaic/uni/HDLUniMP.java b/app/src/main/java/com/hdl/photovoltaic/uni/HDLUniMP.java index 2d35ae6..4fb75f6 100644 --- a/app/src/main/java/com/hdl/photovoltaic/uni/HDLUniMP.java +++ b/app/src/main/java/com/hdl/photovoltaic/uni/HDLUniMP.java @@ -1,6 +1,5 @@ package com.hdl.photovoltaic.uni; -import androidx.annotation.NonNull; import com.google.gson.Gson; @@ -51,6 +50,7 @@ public static class UniCallBackBaseBean implements Serializable { + private String path;//鎵撳紑灏忕▼搴忚矾寰�(鏆傛椂鐢ㄤ笉涓�) private String code;//鐘舵�佺爜 private String mes;//淇℃伅鎻忚堪 private String topic;//鏆傛椂鐢ㄤ笉涓� @@ -109,15 +109,26 @@ this.type = type; } - public JSONObject getJSONObject(Object obj) { - Gson gson = new Gson(); - String json = gson.toJson(obj); - com.alibaba.fastjson.JSONObject d=new com.alibaba.fastjson.JSONObject(); - JSONObject jsonObject = gson.fromJson(json, JSONObject.class); - if (jsonObject == null) { - jsonObject = new JSONObject(); + public String getPath() { + return path == null ? "" : path; + } + + public void setPath(String path) { + this.path = path; + } + + /** + * 褰撳墠瀵硅薄杞� JSONObject + * + * @return JSONObject + */ + public JSONObject getJSONObject() { + try { + String json = new Gson().toJson(this); + return new JSONObject(json); + } catch (Exception e) { + return new JSONObject(); } - return jsonObject; } -- Gitblit v1.8.0