| | |
| | | import com.hdl.photovoltaic.internet.HttpServer.MyNanoHttpServer; |
| | | import com.hdl.photovoltaic.listener.CloudCallBeak; |
| | | import com.hdl.photovoltaic.listener.LinkCallBack; |
| | | import com.hdl.photovoltaic.ui.bean.CUserInfo; |
| | | import com.hdl.photovoltaic.ui.bean.CloudInverterDeviceBean; |
| | | import com.hdl.photovoltaic.ui.bean.DeviceTimeBean; |
| | | import com.hdl.photovoltaic.ui.bean.Geolocation; |
| | |
| | | String type = getKeyValue("type", data);//小类 |
| | | String mode_type = "大类->" + topic + "--->" + "小类->" + type;//用来打印的 |
| | | HdlLogLogic.print("uni--->发送--->" + mode_type + "\r\n" + data, true); |
| | | if (HDLUniMP.UNI_EVENT_REPLY_HOME_MODEL.equals(topic)) { |
| | | if (HDLUniMP.UNI_EVENT_REPLY_USER_MODEL.equals(topic)) { |
| | | //用户模块 |
| | | switch (type) { |
| | | //用户信息 |
| | | case HDLUniMP.UNI_EVENT_REPLY_USER_INFO: { |
| | | this.uniGetUserInfo(mode_type, data, callback); |
| | | } |
| | | //用户头像(旧平台逻辑是头像单独获取下载地址) |
| | | case HDLUniMP.UNI_EVENT_REPLY_USER_IMAGE: { |
| | | uniGetImageKey(mode_type, data, callback); |
| | | } |
| | | break; |
| | | } |
| | | |
| | | } else if (HDLUniMP.UNI_EVENT_REPLY_HOME_MODEL.equals(topic)) { |
| | | //住宅模块 |
| | | switch (type) { |
| | | //创建电站 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取用户信息 |
| | | * |
| | | * @param data uni数据 |
| | | * @param callback uni回调 |
| | | */ |
| | | private void uniGetUserInfo(String type, Object data, DCUniMPJSCallback callback) { |
| | | HdlAccountLogic.getInstance().getMemberInfo_C(new CloudCallBeak<CUserInfo>() { |
| | | @Override |
| | | public void onSuccess(CUserInfo cUserInfo) { |
| | | if (cUserInfo == null) { |
| | | return; |
| | | } |
| | | UserConfigManage.getInstance().setBingPhone(cUserInfo.getMemberPhone()); |
| | | UserConfigManage.getInstance().setBingEmail(cUserInfo.getMemberEmail()); |
| | | UserConfigManage.getInstance().Save(); |
| | | //获取用户头像路径 |
| | | if (cUserInfo.getMemberHeadIcon().contains("http")) { |
| | | //更新用户头像 |
| | | uniCallbackData(type, cUserInfo, callback); |
| | | } else { |
| | | HdlAccountLogic.getInstance().getImageKey_C(cUserInfo.getMemberHeadIcon(), new CloudCallBeak<String>() { |
| | | @Override |
| | | public void onSuccess(String url) { |
| | | cUserInfo.setMemberHeadIcon(url); |
| | | uniCallbackData(type, cUserInfo, callback); |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | uniCallbackData(type, null, e.getCode(), e.getMsg(), callback); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | uniCallbackData(type, null, e.getCode(), e.getMsg(), callback); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 获取用户头像 |
| | | * |
| | | * @param data uni数据 |
| | | * @param callback uni回调 |
| | | */ |
| | | private void uniGetImageKey(String type, Object data, DCUniMPJSCallback callback) { |
| | | String imageKey = getKeyValue("imageKey", getKeyValue("data", data)); |
| | | HdlAccountLogic.getInstance().getImageKey_C(imageKey, new CloudCallBeak<String>() { |
| | | @Override |
| | | public void onSuccess(String url) { |
| | | uniCallbackData(type, url, callback); |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | uniCallbackData(type, null, e.getCode(), e.getMsg(), callback); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 逆变器清空住宅id |
| | | * |
| | | * @param data uni数据 |