mac
2024-03-14 f49ce86fe82047d2dd94adf65316013729d090a0
2024年03月14日10:28:25

备份代码
2个文件已修改
93 ■■■■■ 已修改文件
app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java 83 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/hdl/photovoltaic/uni/HDLUniMP.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
@@ -30,6 +30,7 @@
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;
@@ -111,7 +112,21 @@
            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) {
                    //创建电站
@@ -1079,6 +1094,72 @@
    }
    /**
     * 获取用户信息
     *
     * @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数据
app/src/main/java/com/hdl/photovoltaic/uni/HDLUniMP.java
@@ -15,6 +15,14 @@
    public final static String UNI_EVENT_GetAppParams = "uni_GetAppParams";//获取APP应用信息
    //region --------【小程序】发送到【原生】--------
    /*********用户 模块*********/
    public final static String UNI_EVENT_REPLY_USER_MODEL = "uni_user_model";//用户模块(大类)
    public final static String UNI_EVENT_REPLY_USER_INFO = "user_info";//用户信息
    public final static String UNI_EVENT_REPLY_USER_IMAGE = "user_image";//用户头像
    /*********住宅【电站】模块*********/
    public final static String UNI_EVENT_REPLY_HOME_MODEL = "uni_home_model";//住宅模块(大类)
    public final static String UNI_EVENT_REPLY_HOME_LIST = "list";//获取住宅【电站】列表
@@ -102,7 +110,7 @@
    public final static String UNI_EVENT_OPEN_HOME_DETAILS = "pages/powerStationDetail/index";//住宅【电站】详情
    public final static String UNI_EVENT_OPEN_HOME_DETAILS_C = "pages/powerStationDetail/tabbarPage";//C端打开【电站】详情
    public final static String UNI_EVENT_OPEN_HOME_Null_C = "pages/powerStationDetail/index";//无电站时
    public final static String UNI_EVENT_OPEN_HOME_Null_C = "pages/powerStationDetail/tabbarPage";//无电站时(不需要传参数)
    public final static String UNI_EVENT_OPEN_HOME_DEl = "del";//住宅【电站】删除
    /*********设备模块*********/
    //设备模块打开页面全路径