From 07fb950b0f6c460e4cc60c4e262bc5992074790e Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期二, 26 三月 2024 20:49:08 +0800
Subject: [PATCH] 2024年03月26日20:49:02
---
app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java | 43 ++++++++++++++++++++++++++++++++++++-------
1 files changed, 36 insertions(+), 7 deletions(-)
diff --git a/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java b/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
index 541edcf..45005db 100644
--- a/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
+++ b/app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
@@ -18,6 +18,7 @@
import com.alibaba.fastjson.JSON;
import com.google.gson.Gson;
+import com.google.gson.JsonObject;
import com.google.gson.reflect.TypeToken;
import com.hdl.linkpm.sdk.core.exception.HDLException;
import com.hdl.linkpm.sdk.device.bean.DeviceOidInfoBean;
@@ -25,6 +26,7 @@
import com.hdl.linkpm.sdk.ota.bean.CloudGatewayDriversBean;
import com.hdl.linkpm.sdk.ota.bean.DeviceFirmwareBean;
import com.hdl.linkpm.sdk.ota.bean.GatewayDriverBean;
+import com.hdl.linkpm.sdk.user.HDLLinkPMUser;
import com.hdl.linkpm.sdk.utils.HDLMD5Utils;
import com.hdl.photovoltaic.HDLApp;
import com.hdl.photovoltaic.R;
@@ -132,6 +134,15 @@
uniGetImageKey(mode_type, data, callback);
}
break;
+ //鐢ㄦ埛鏈湴缂撳瓨淇℃伅
+ case HDLUniMP.UNI_EVENT_REPLY_USER_LOCAL_INFO: {
+ JsonObject jsonObject = new JsonObject();
+ jsonObject.addProperty("user_name", UserConfigManage.getInstance().getUserName());
+ jsonObject.addProperty("user_image_url", UserConfigManage.getInstance().getUserImageUrl());
+ jsonObject.addProperty("user_account", UserConfigManage.getInstance().getAccount());
+ uniCallbackData(mode_type, jsonObject, callback);
+ }
+ break;
}
} else if (HDLUniMP.UNI_EVENT_REPLY_HOME_MODEL.equals(topic)) {
@@ -183,11 +194,11 @@
case HDLUniMP.UNI_EVENT_REPLY_DEVICE_ADD: {
this.uniAddInverterDeviceToCloud(mode_type, data, callback);
}
+ break;
//娣诲姞澶氫釜閫嗗彉鍣ㄥ埌浜戠
case HDLUniMP.UNI_EVENT_REPLY_DEVICE_ADD_All: {
this.uniAddAllInverterDeviceToCloud(mode_type, data, callback);
}
-
break;
//鍒犻櫎浜戠閫嗗彉鍣�
case HDLUniMP.UNI_EVENT_REPLY_DEVICE_DEL: {
@@ -365,11 +376,24 @@
case HDLUniMP.UNI_EVENT_REPLY_OTHER_LOCATION_INFO: {
this.uniGetLocationInfo(mode_type, data, callback);
}
+ break;
//涓撻棬鏀堕泦uni鏃ュ織
case HDLUniMP.UNI_EVENT_REPLY_OTHER_UNI_LOG: {
String customizeContentFormat = getKeyValue("customizeContentFormat", getKeyValue("data", data));
HdlLogLogic.print("uni--->log--->" + customizeContentFormat, true);
+
}
+ break;
+ //uni涓婚〉鐐瑰嚮杩斿洖閫氱煡
+ case HDLUniMP.UNI_EVENT_REPLY_OTHER_BACK: {
+ //EventBus浜嬩欢鍒嗗彂
+ BaseEventBus baseEventBus = new BaseEventBus();
+ baseEventBus.setTopic(HDLUniMP.UNI_EVENT_REPLY_OTHER_MODEL);
+ baseEventBus.setType(HDLUniMP.UNI_EVENT_REPLY_OTHER_BACK);
+ EventBus.getDefault().post(baseEventBus);
+
+ }
+ break;
}
} else if (HDLUniMP.UNI_EVENT_REPLY_MINE_MODEL.equals(topic)) {
//鎴戠殑妯″潡
@@ -1124,6 +1148,7 @@
UserConfigManage.getInstance().Save();
//鑾峰彇鐢ㄦ埛澶村儚璺緞
if (cUserInfo.getMemberHeadIcon().contains("http")) {
+ UserConfigManage.getInstance().setUserImageUrl(cUserInfo.getMemberHeadIcon());
//鏇存柊鐢ㄦ埛澶村儚
uniCallbackData(type, cUserInfo, callback);
} else {
@@ -1131,6 +1156,7 @@
@Override
public void onSuccess(String url) {
cUserInfo.setMemberHeadIcon(url);
+ UserConfigManage.getInstance().setUserImageUrl(cUserInfo.getMemberHeadIcon());
uniCallbackData(type, cUserInfo, callback);
}
@@ -1359,6 +1385,7 @@
// com.alibaba.fastjson.JSONArray jsonArray = JSON.parseArray(data);
try {
String devices = getKeyValue("devices", getKeyValue("data", data));
+ String homeId = UserConfigManage.getInstance().getHomeId(); //getKeyValue("homeId", getKeyValue("data", data));
Gson gson = new Gson();
Type typeOfT = new TypeToken<List<GatewayBean>>() {
}.getType();
@@ -1367,7 +1394,6 @@
uniCallbackData(type, null, -100, HDLApp.getInstance().getString(R.string.The_gateway_cannot_be_found_locally), callback);
return;
}
- String homeId = UserConfigManage.getInstance().getHomeId();
//璁板綍鏉℃暟
AtomicInteger atomicInteger = new AtomicInteger(0);
final boolean[] is_boolean = {false};
@@ -1483,16 +1509,16 @@
}
return;
}
- //杩涙潵浣忓畢璇︽儏閮借涓婁紶涓�娆id鍒楄〃鍒颁簯绔�;
- HdlDeviceLogic.getInstance().uploadDataToCloud(homeId, list, null);
+ if (callback != null) {
+ uniCallbackData(type, list, callback);
+ }
//EventBus浜嬩欢鍒嗗彂,杩涘叆浣忓畢寮�濮嬭闃呬富棰�
BaseEventBus baseEventBus = new BaseEventBus();
baseEventBus.setType(HDLUniMP.UNI_EVENT_REPLY_DEVICE_LIST);
baseEventBus.setData(list);
EventBus.getDefault().post(baseEventBus);
- if (callback != null) {
- uniCallbackData(type, list, callback);
- }
+ //杩涙潵浣忓畢璇︽儏閮借涓婁紶涓�娆id鍒楄〃鍒颁簯绔�;
+ HdlDeviceLogic.getInstance().uploadDataToCloud(homeId, list, null);
}
@Override
@@ -1579,6 +1605,9 @@
//灏忕▼搴忛偅閲屾湁鑷繁鐨勮姹傛柟娉�,闇�瑕佽繖浜涙暟鎹�
data.put("token", UserConfigManage.getInstance().getToken());
data.put("refreshToken", UserConfigManage.getInstance().getRefreshToken());
+ if (TextUtils.isEmpty(AppConfigManage.getUserRegionUrl())) {
+ AppConfigManage.setUserRegionUrl(HDLLinkPMUser.getInstance().getUserRegionUrl());
+ }
data.put("serverAddress", AppConfigManage.getUserRegionUrl());
data.put("appKey", AppConfigManage.getAppKey());
data.put("appSecret", AppConfigManage.getAppSecret());
--
Gitblit v1.8.0