| | |
| | | import com.google.gson.Gson; |
| | | import com.hdl.photovoltaic.HDLApp; |
| | | import com.hdl.photovoltaic.config.UserConfigManage; |
| | | import com.hdl.photovoltaic.listener.CloudCallBeak; |
| | | import com.hdl.photovoltaic.ui.bean.HouseIdBean; |
| | | import com.hdl.photovoltaic.uni.HDLUniMP; |
| | | import com.hdl.photovoltaic.uni.HDLUniMPSDKManager; |
| | | import com.hdl.photovoltaic.utils.WifiUtils; |
| | | |
| | | import org.json.JSONObject; |
| | | |
| | | |
| | | import java.util.List; |
| | | |
| | | import io.dcloud.feature.unimp.DCUniMPJSCallback; |
| | | |
| | |
| | | if (!HDLUniMP.UNI_APP_ID.equals(appId)) { |
| | | return; |
| | | } |
| | | String json = data == null ? "{}" : data.toString(); |
| | | json = json.equals("") ? "{}" : json; |
| | | org.json.JSONObject jsonObject = new org.json.JSONObject(json); |
| | | org.json.JSONObject jsonObject = getJSONObject(data); |
| | | String type_value = ""; |
| | | if (jsonObject.has("type")) { |
| | | type_value = jsonObject.getString("type"); |
| | |
| | | switch (type_value) { |
| | | case HDLUniMP.UNI_EVENT_REPLY_HOME_CREATION: { |
| | | //创建 |
| | | HdlResidenceLogic.getInstance().getResidenceList("", "", null); |
| | | HdlResidenceLogic.getInstance().getResidenceIdList("", "", new CloudCallBeak<List<HouseIdBean>>() { |
| | | @Override |
| | | public void onSuccess(List<HouseIdBean> list) { |
| | | HdlResidenceLogic.getInstance().setHouseIdList(list); |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(Exception exception) { |
| | | |
| | | } |
| | | }); |
| | | |
| | | } |
| | | break; |
| | |
| | | uniCallBackBaseBean.setMes(msg); |
| | | uniCallBackBaseBean.setData(obj); |
| | | if (callback != null) { |
| | | callback.invoke(uniCallBackBaseBean); |
| | | callback.invoke(getJSONObject(uniCallBackBaseBean)); |
| | | } |
| | | } catch (Exception e) { |
| | | HdlLogLogic.print("uni===组装uni发送数据格式", e.getMessage()); |
| | |
| | | */ |
| | | private JSONObject getJSONObject(Object obj) { |
| | | try { |
| | | if (obj == null) { |
| | | return new JSONObject(); |
| | | } |
| | | if (TextUtils.isEmpty(obj.toString())) { |
| | | return new JSONObject(); |
| | | } |
| | | String json = new Gson().toJson(obj); |
| | | return new JSONObject(json); |
| | | } catch (Exception e) { |