| | |
| | | package com.hdl.photovoltaic.uni; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | |
| | | import com.google.gson.Gson; |
| | | |
| | |
| | | public static class UniCallBackBaseBean implements Serializable { |
| | | |
| | | |
| | | private String path;//打开小程序路径(暂时用不上) |
| | | private String code;//状态码 |
| | | private String mes;//信息描述 |
| | | private String topic;//暂时用不上 |
| | |
| | | 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; |
| | | } |
| | | return jsonObject; |
| | | |
| | | 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(); |
| | | } |
| | | } |
| | | |
| | | |