wxr
2024-12-02 ea0b1e8e5f43c5fd0a7d479e25ede3b8cbea464a
HDL_ON/DAL/Server/HttpServerRequest.cs
@@ -3,9 +3,7 @@
using System.IO;
using System.Net;
using System.Text;
using HDL_ON.DAL.Mqtt;
using HDL_ON.Entity;
using HDL_ON.UI;
using Newtonsoft.Json.Linq;
namespace HDL_ON.DAL.Server
@@ -82,6 +80,30 @@
            return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_ArmSensorHistoricalData, requestJson);
        }
        /// <summary>
        /// 获取门锁历史记录
        /// </summary>
        /// <param name="deviceId"></param>
        /// <param name="pageSize"></param>
        /// <param name="pageNo"></param>
        /// <returns></returns>
        public ResponsePackNew GetVideoDoorlockHistory(string deviceId, string pageSize, string pageNo)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("deviceId", deviceId);
            d.Add("pageSize", pageSize);
            d.Add("pageNo", pageNo);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_ArmSensorHistoricalData, requestJson);
        }
        /// <summary>
        /// 读取最近一个月的数据
        /// </summary>
        /// <returns></returns>
@@ -132,14 +154,14 @@
        public ResponsePackNew GetRegionByAccount(string account)
        {
            var requestJson = HttpUtil.GetSignRequestJson(new RegionByAccountObj() { account = account });
            return HttpUtil.RequestHttpsPost(NewAPI.API_POST_GetRegionByAccount, requestJson, HttpUtil.GlobalRequestHttpsHost);
            return HttpUtil.RequestHttpsPost(NewAPI.API_POST_GetRegionByAccount, requestJson, HttpUtil.Ins.GlobalRequestHttpsHost);
        }
        /// <summary>
        /// 刷新Token
        /// </summary>
        /// <returns></returns>
        public string RefreshToken()
        public string RefreshToken(bool canRefresh = true)
        {
            var requestJson = HttpUtil.GetSignRequestJson(new RefreshTokenObj()
            {
@@ -156,15 +178,26 @@
                UserInfo.Current.SaveUserInfo();
#if __IOS__
                //var sdm = new SiriKit.SceneDateManager();
                //sdm.AccessToken = UserInfo.Current.LoginTokenString;
                //sdm.RefreshToken = UserInfo.Current.RefreshToken;
                var sdm = new SiriKit.SceneDateManager();
                sdm.AccessToken = UserInfo.Current.LoginTokenString;
                sdm.RefreshToken = UserInfo.Current.RefreshToken;
#endif
            }
            else if (revertObj.Code == StateCode.PasswrodError)
            {
                UserInfo.Current.LastTime = DateTime.MinValue;
            }
#if __IOS__
            else if (revertObj.Code == "10001")
            {
                if (canRefresh)
                {
                    UserInfo.Current.RefreshToken = SiriKit.NSUserDefaultsHelper.DataSuite.StringForKey(SiriKit.NSUserDefaultsHelper.StorageKeys.GLOBAL_GRefreshToken);
                    //UserInfo.Current.AccessToken = SiriKit.NSUserDefaultsHelper.DataSuite.StringForKey(SiriKit.NSUserDefaultsHelper.StorageKeys.GLOBAL_GAccessToken);
                    RefreshToken(false);
                }
            }
#endif
            return revertObj.Code;
        }
@@ -257,8 +290,8 @@
                {
#if __IOS__
                    //var sdm = new SiriKit.SceneDateManager();
                    //sdm.IsLgoin = true;
                    var sdm = new SiriKit.SceneDateManager();
                    sdm.IsLgoin = true;
#endif
                }
            }
@@ -286,8 +319,8 @@
                {
#if __IOS__
                    //var sdm = new SiriKit.SceneDateManager();
                    //sdm.IsLgoin = true;
                    var sdm = new SiriKit.SceneDateManager();
                    sdm.IsLgoin = true;
#endif
                }
            }
@@ -542,106 +575,88 @@
            var resultObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_Gethomepager, requestJson);
            if (resultObj.Code == StateCode.SUCCESS)
            {
                try
                UserInfo.Current.regionList = new List<RegionInfoRes>();
                var homeList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<RegionInfoRes>>(resultObj.Data.ToString());
                if (homeList == null || homeList.Count == 0)
                {
                    UserInfo.Current.regionList = new List<RegionInfoRes>();
                    var homeList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<RegionInfoRes>>(resultObj.Data.ToString());
                    if (homeList == null || homeList.Count == 0)
                    if (DB_ResidenceData.Instance.CurrentRegion!=null && DB_ResidenceData.Instance.CurrentRegion.id != "")
                    {
                        if (DB_ResidenceData.Instance.CurrentRegion != null && DB_ResidenceData.Instance.CurrentRegion.id != "")
                        Shared.Application.RunOnMainThread(() =>
                        {
                            Shared.Application.RunOnMainThread(() =>
                            {
                                try
                                {
                                    DriverLayer.UdpSocket._BusSocket.Stop();
                                    MqttClient.DisConnectRemote("住宅丢失");
                                    MainPage.GoUserPage(false);
                                }
                                catch { }
                            });
                            //DB_ResidenceData.Instance.CurrentRegion = null;
                        }
                        return "null";
                            MainPage.GoUserPage(false);
                        });
                    }
                    else
                }
                else
                {
                    foreach (var home in homeList)
                    {
                        foreach (var home in homeList)
                        if (home.isBindGateway)//是否绑定网关
                        {
                            if (home.isBindGateway)//是否绑定网关
                            UserInfo.Current.regionList.Add(home);
                            //新绑定的住宅,直接切换到新住宅
                            if (!string.IsNullOrEmpty(homeId))
                            {
                                UserInfo.Current.regionList.Add(home);
                                //新绑定的住宅,直接切换到新住宅
                                if (!string.IsNullOrEmpty(homeId))
                                if (homeId.Contains(home.id))
                                {
                                    if (homeId.Contains(home.id))
                                    {
                                        DB_ResidenceData.Instance.CurrentRegion = home;
                                    }
                                    DB_ResidenceData.Instance.CurrentRegion = home;
                                }
                            }
                        }
                        if (UserInfo.Current.regionList.Count == 0)
                    }
                    if (UserInfo.Current.regionList.Count == 0)
                    {
                        Shared.Application.RunOnMainThread(() =>
                        {
                            MainPage.GoUserPage(false);
                        });
                        return "null";
                    }
                    //-------如果账号是首次登录
                    if (DB_ResidenceData.Instance.CurrentRegion == null || string.IsNullOrEmpty(DB_ResidenceData.Instance.CurrentRegion.id))
                    {
                        //刷新当前住宅
                        DB_ResidenceData.Instance.CurrentRegion = UserInfo.Current.regionList[0];
                        DB_ResidenceData.Instance.SaveResidenceData();
                        UserInfo.Current.SaveUserInfo();
                        //刷新一次住宅网关
                        GetHomeGatewayList();
                    }
                    else
                    {
                        //住宅被删除
                        var findHome = UserInfo.Current.regionList.Find((obj) => obj.id == DB_ResidenceData.Instance.CurrentRegion.id);
                        if (findHome == null)
                        {
                            Shared.Application.RunOnMainThread(() =>
                            {
                                HDL_ON.DriverLayer.UdpSocket._BusSocket.Stop();
                                MqttClient.DisConnectRemote("住宅丢失");
                                MainPage.GoUserPage(false);
                                DB_ResidenceData.Instance.CurrentRegion = UserInfo.Current.regionList[0];
                                GetHomeGatewayList();
                                DB_ResidenceData.Instance.SaveResidenceData();
                                UserInfo.Current.SaveUserInfo();
                                Action action = () =>
                                {
                                    MainPage.GoUserPage(true);
                                };
                                new UI.PublicAssmebly().TipMsg(StringId.Tip, StringId.ResidenceDeletedSwitchToAnotherResidence, action);
                            });
                            return "null";//null表示有住宅,但是全部都没有网关,这个不能去掉
                        }
                        //-------如果账号是首次登录
                        if (DB_ResidenceData.Instance.CurrentRegion == null || string.IsNullOrEmpty(DB_ResidenceData.Instance.CurrentRegion.id))
                        else
                        {
                            //刷新当前住宅
                            DB_ResidenceData.Instance.CurrentRegion = UserInfo.Current.regionList[0];
                            DB_ResidenceData.Instance.CurrentRegion = findHome;
                            DB_ResidenceData.Instance.SaveResidenceData();
                            UserInfo.Current.SaveUserInfo();
                            //刷新一次住宅网关
                            GetHomeGatewayList();
                        }
                        else
                        {
                            //住宅被删除
                            var findHome = UserInfo.Current.regionList.Find((obj) => obj.id == DB_ResidenceData.Instance.CurrentRegion.id);
                            if (findHome == null)
                            {
                                Shared.Application.RunOnMainThread(() =>
                                {
                                    DB_ResidenceData.Instance.CurrentRegion = UserInfo.Current.regionList[0];
                                    GetHomeGatewayList();
                                    DB_ResidenceData.Instance.SaveResidenceData();
                                    UserInfo.Current.SaveUserInfo();
                                    Action action = () =>
                                    {
                                        MainPage.GoUserPage(true);
                                    };
                                    new UI.PublicAssmebly().TipMsg(StringId.Tip, StringId.ResidenceDeletedSwitchToAnotherResidence, action);
                                });
                            }
                            else
                            {
                                //刷新当前住宅
                                DB_ResidenceData.Instance.CurrentRegion = findHome;
                                DB_ResidenceData.Instance.SaveResidenceData();
                                UserInfo.Current.SaveUserInfo();
                                //刷新一次住宅网关
                                GetHomeGatewayList();
                            }
                        }
                    }
#if __IOS__
                        //var sdm = new SiriKit.SceneDateManager();
                        //sdm.RegionUrl = DB_ResidenceData.Instance.CurrentRegion.regionUrl;
                        //sdm.HomeId = DB_ResidenceData.Instance.CurrentRegion.id;
                    var sdm = new SiriKit.SceneDateManager();
                    sdm.RegionUrl = DB_ResidenceData.Instance.CurrentRegion.regionUrl;
                    sdm.HomeId = DB_ResidenceData.Instance.CurrentRegion.id;
#endif
                    }
                }
                catch
                {
                    return "null";
                }
            }
@@ -694,8 +709,8 @@
                        {
                            if (mHomeGatewayRes.Count > 0)
                            {
                                DB_ResidenceData.Instance.HomeGateway = mHomeGatewayRes[0];
                                DriverLayer.Control.Ins.GatewayOnline_Cloud = mHomeGatewayRes[0].gatewayStatus;
                                DB_ResidenceData.Instance.HomeGateway = mHomeGatewayRes[0];//网关状态
                                HDL_ON.DriverLayer.Control.Ins.GatewayOnline_Cloud = mHomeGatewayRes[0].gatewayStatus;
                                DB_ResidenceData.Instance.SaveResidenceData();
                                return revertObj.Code;
                            }
@@ -717,6 +732,34 @@
            }
        }
        /// <summary>
        /// 获取住宅交付链接
        /// </summary>
        /// <returns></returns>
        public ResponsePackNew GetHouseDeliveryUrl()
        {
            var d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            var jsonString = HttpUtil.GetSignRequestJson(d);
            var revertObj = HttpUtil.RequestHttpsPostFroHome(NewAPI.APi_Post_GetHoserDeliverUrl, jsonString);
            return revertObj;
        }
        /// <summary>
        /// 住宅交付回滚
        /// </summary>
        /// <returns></returns>
        public ResponsePackNew RollBack()
        {
            var d = new Dictionary<string, object>();
            d.Add("houseId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("communityId", DB_ResidenceData.Instance.CurrentRegion.communityId);
            d.Add("flowRecordContent", "onPro交付回滚");
            d.Add("projectFlowRecordActionEnum", "DELIVERY_ROLLBACK");
            var jsonString = HttpUtil.GetSignRequestJson(d);
            var revertObj = HttpUtil.RequestHttpsPostFroHome(NewAPI.APi_Post_UpdateProjectDebugStatus, jsonString);
            return revertObj;
        }
        /// <summary>
        /// 获取网关信息
        /// </summary>
        public string GetGatewayInfo()
@@ -733,7 +776,7 @@
                var mHomeGatewayRes = Newtonsoft.Json.JsonConvert.DeserializeObject<HomeGatewayInfo>(revertObj.Data.ToString());
                if (mHomeGatewayRes != null)
                {
                    DriverLayer.Control.Ins.GatewayOnline_Cloud = mHomeGatewayRes.gatewayStatus;
                    HDL_ON.DriverLayer.Control.Ins.GatewayOnline_Cloud = mHomeGatewayRes.gatewayStatus;
                }
            }
            return revertObj.Code;
@@ -757,7 +800,7 @@
        {
            var requestObj = new ChildDeleteObj()
            {
                childAccountId = subaccount.childAccountId,
                childId = subaccount.id,
                homeId = subaccount.homeId
            };
            var requestJson = HttpUtil.GetSignRequestJson(requestObj);
@@ -772,12 +815,11 @@
        /// <returns></returns>
        public ResponsePackNew EditSubAccountNickName(string nickName, string childAccountId)
        {
            var requestJson = HttpUtil.GetSignRequestJson(new UpdateChildNickNameObj()
            {
                homeId = DB_ResidenceData.Instance.CurrentRegion.id,
                childAccountId = childAccountId,
                nickName = nickName,
            });
            var d = new Dictionary<string, string>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("childId", childAccountId);
            d.Add("nickName", nickName);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Child_Update, requestJson);
        }
@@ -792,7 +834,7 @@
            var requestJson = HttpUtil.GetSignRequestJson(new UpdateChildAllowCreateSceneObj()
            {
                homeId = DB_ResidenceData.Instance.CurrentRegion.id,
                childAccountId = childAccountId,
                childId = childAccountId,
                isAllowCreateScene = isAllow,
            });
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Child_Update, requestJson);
@@ -1008,11 +1050,77 @@
        public ResponsePackNew BindResidenceMemberAccount(string subAccount, string nickName)
        {
            //添加子账号
            var requestObj = new ChildAddObj() { homeId = DB_ResidenceData.Instance.CurrentRegion.id, account = subAccount, nickName = nickName };
            var requestObj = new ChildAddObj()
            {
                homeId = DB_ResidenceData.Instance.CurrentRegion.id,
                account = subAccount,
                nickName = nickName
            };
            var requestJson = HttpUtil.GetSignRequestJson(requestObj);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Child_Add, requestJson);
        }
        //v1.7更新接口
        public ResponsePackNew BindResidenceMemberAccount(string subAccount, string nickName,string faceUrl)
        {
            //添加子账号
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("nickName", nickName);
            if (!string.IsNullOrEmpty(subAccount))
            {
                d.Add("account", subAccount);
            }
            if (!string.IsNullOrEmpty(faceUrl))
            {
                d.Add("faceUrl", @"data:image/jpg;base64," + faceUrl);
            }
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Child_Add, requestJson);
        }
        /// <summary>
        /// 删除成员账号人脸数据
        /// </summary>
        /// <param name="subAccount"></param>
        /// <param name="nickName"></param>
        /// <param name="faceUrl"></param>
        /// <returns></returns>
        public ResponsePackNew DeleteMemberFace( string childId)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("childId", childId);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Child_RemoveFace, requestJson);
        }
        /// <summary>
        /// 更新成员账号人脸数据
        /// </summary>
        public ResponsePackNew UpdataMemberFace(string childId, string faceUrl)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("childId", childId);
            d.Add("userFace", @"data:image/jpg;base64," + faceUrl);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Child_UpdateFace, requestJson);
        }
        /// <summary>
        /// 家庭成员绑定账号
        /// </summary>
        /// <param name="childId"></param>
        /// <param name="faceUrl"></param>
        /// <returns></returns>
        public ResponsePackNew SubChildBindAccount(string childId, string account)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("childId", childId);
            d.Add("account", account);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Child_BindAccount, requestJson);
        }
        /// <summary>
        /// 修改住宅调试权限
@@ -1078,7 +1186,7 @@
#endif
                //是否生产模式
                bool isProduce = true;
                if (HttpUtil.GlobalRequestHttpsHost == "https://test-gz.hdlcontrol.com")
                if (HttpUtil.Ins.GlobalRequestHttpsHost == "https://test-gz.hdlcontrol.com")
                {
                    isProduce = false;
                }
@@ -1430,12 +1538,14 @@
        }
#endregion
#region 获取天气部分
        #region 获取天气部分
        /// <summary>
        /// 获取指定经纬度的城市信息天气信息
        /// </summary>
        public void GetCityWeatherInfo(string lon, string lat)
        {
            if (lon == "0" || lat == "0")
                return;
            MainPage.cityInfo.lon = lon;
            MainPage.cityInfo.lat = lat;
@@ -1481,6 +1591,7 @@
                            MainPage.cityInfo.lowestTemperature = jt.GetValue("lowestTemperature").ToString();
                            MainPage.cityInfo.highestTemperature = jt.GetValue("highestTemperature").ToString();
                            MainPage.CityWeatherAction?.Invoke();
                            HDL_ON.UI.HomePage.LoadEvent_RefreshAir();
                            break;
                        }
                        catch (Exception ex)
@@ -1490,14 +1601,6 @@
                    }
                    System.Threading.Thread.Sleep(5000);
                }
                Shared.Application.RunOnMainThread(() =>
                {
                    try
                    {
                        HDL_ON.UI.HomePage.LoadEvent_RefreshAir();
                    }
                    catch { }
                });
            });
        }
        ///// <summary>
@@ -2109,7 +2212,7 @@
        /// <param name="productPlatform"></param>
        /// <param name="productBrand"></param>
        /// <returns></returns>
        public ResponsePackNew IndependentRegister3TyDevcie(string spk, string extDevId, string deviceName, string pairCode = "")
        public ResponsePackNew IndependentRegister3TyDevcie(string spk, string extDevId, string deviceName,string productBrandIdentity, string pairCode = "")
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
@@ -2117,6 +2220,7 @@
            d.Add("extDevId", extDevId);
            d.Add("name", deviceName);
            d.Add("code", pairCode);
            d.Add("productBrandIdentity", productBrandIdentity);
            var requestJson = HttpUtil.GetSignRequestJson(d);
@@ -2195,7 +2299,7 @@
            d.Add("actions", actionObjs);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            MainPage.Log($"api功能控制:{requestJson}");
            MainPage.Log($"api发送控制:{requestJson}");
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_ControlDevice, requestJson);
        }
        /// <summary>
@@ -2215,6 +2319,23 @@
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_EditDevice, requestJson);
        }
        /// <summary>
        /// 编辑设备信息
        /// 绑定关系、名称、收藏
        /// </summary>
        /// <returns></returns>
        public ResponsePackNew UpdataDevcieName(string deviceId,string name)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("deviceId", deviceId);
            d.Add("name", name);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_EditDevice, requestJson);
        }
        /// <summary>
        /// 编辑设备信息
        /// 绑定关系、名称、收藏
@@ -2357,7 +2478,7 @@
#endregion
#region Kaede --场景功能--------------------------
        #region Kaede --场景功能--------------------------
        /// <summary>
        /// 获取场景列表
        /// 房间ID可空,默认查询住宅下所有房间
@@ -2489,9 +2610,9 @@
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_CancelCollectScene, requestJson).Code;
        }
#endregion
        #endregion
#region Kaede --房间功能--------------------------
        #region Kaede --房间功能--------------------------
        /// <summary>
        /// 获取房间列表
        /// </summary>
@@ -2566,10 +2687,10 @@
            return pack;
        }
#endregion
        #endregion
#region Kaede -- 安防接口____________________________
        #region Kaede -- 安防接口____________________________
        /// <summary>
        /// 获取安防列表
        /// </summary>
@@ -2733,10 +2854,10 @@
            return pack;
        }
#endregion
        #endregion
#region Kaede --第三方品牌功能--------------------------
        #region Kaede --第三方品牌功能--------------------------
        /// <summary>
        /// 获取第三方品牌列表
        /// </summary>
@@ -2766,13 +2887,11 @@
        /// <returns></returns>
        public ResponsePackNew Search3tyIotDevice(string companyId)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("companyId", companyId);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Search3tyIotDevice, requestJson);
            return pack;
        }
@@ -2848,9 +2967,9 @@
            return pack;
        }
#endregion
        #endregion
#region ■ 萤石云SDK相关接口_________________________
        #region ■ 萤石云SDK相关接口_________________________
        /// <summary>
        /// 河东获取萤石云子账号token的接口
        /// 2021-07-07 新方案接口调整对接
@@ -2863,10 +2982,10 @@
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_EZ_GetChildToken, requestJson);
        }
#endregion
        #endregion
#region ■ 可视对讲_________________________
        #region ■ 可视对讲_________________________
        /// <summary>
        /// 检查住宅是否绑定丰林
        /// </summary>
@@ -2898,9 +3017,25 @@
        }
#endregion
        /// <summary>
        /// 获取第三方注册的id
        /// </summary>
        /// <param homeId="homeId">住宅id</param>
        /// <returns></returns>
        public ResponsePackNew GetExtUserId(string homeId)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", homeId);
#region ■ 门锁相关____________________________
            var requestJson = HttpUtil.GetSignRequestJson(d);
            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetExtUserId, requestJson);
            return pack;
        }
        #endregion
        #region ■ 门锁相关____________________________
        /// <summary>
        /// 获取门锁历史记录(按日期降序)
@@ -2968,9 +3103,383 @@
            //IMessageCommon.Current.ShowErrorInfoAlter(responePack.Code);
            return listSortLog;
        }
        /// <summary>
        /// 获取门锁临时密码
        /// </summary>
        /// <param name="deviceId"></param>
        /// <returns></returns>
        public ResponsePackNew GetDoorTempPassword(string deviceId)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("deviceId", deviceId);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetTempPasswrod, requestJson);
        }
        /// <summary>
        /// 创建门锁临时密码
        /// </summary>
        /// <param name="deviceId"></param>
        /// <returns></returns>
        public ResponsePackNew CreateDoorTempPassword(string deviceId,string beginTime,string endTime)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("deviceId", deviceId);
            d.Add("beginTime", beginTime);
            d.Add("endTime", endTime);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_CreateTempPasswrod, requestJson);
        }
        /// <summary>
        /// 删除门锁临时密码
        /// </summary>
        /// <returns></returns>
        public ResponsePackNew DelDoorTempPassword(string deviceId, string pwdId)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("deviceId", deviceId);
            d.Add("pwdId", pwdId);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_DelTempPasswrod, requestJson);
        }
#endregion
#region ■ 音箱语言控制相关_________________________
        #region 视频门锁  2023-07-07 16:47:20
        /// <summary>
        /// 获取萤石门锁用户列表
        /// </summary>
        /// <param name="deviceId"></param>
        /// <returns></returns>
        public ResponsePackNew GetDoorlockUserList(string deviceId)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("deviceId", deviceId);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetDoorlockUserList, requestJson);
        }
        /// <summary>
        /// 修改门锁用户备注
        /// </summary>
        /// <returns></returns>
        public ResponsePackNew EditDoorlockUserName(string deviceId,string lockUserIndex,string remarkName)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("deviceId", deviceId);
            d.Add("lockUserIndex", lockUserIndex);
            d.Add("remarkName", remarkName);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_setDoorUserRemark, requestJson);
        }
        /// <summary>
        /// 删除门锁用户数字密码
        /// </summary>
        /// <param name="deviceId"></param>
        /// <param name="lockUserIndex"></param>
        /// <returns></returns>
        public ResponsePackNew DeleteDoorlockUserNumberPassword(string deviceId, string lockUserIndex)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("deviceId", deviceId);
            d.Add("lockUserIndex", lockUserIndex);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_DeleteDoorlockUser_NumberPassword, requestJson);
        }
        /// <summary>
        /// 删除门锁用户卡密码
        /// </summary>
        /// <param name="deviceId"></param>
        /// <param name="lockUserIndex"></param>
        /// <returns></returns>
        public ResponsePackNew DeleteDoorlockUserCardPassword(string deviceId, string lockUserIndex)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("deviceId", deviceId);
            d.Add("lockUserIndex", lockUserIndex);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_DeleteDoorlockUser_DeleteCardPassword, requestJson);
        }
        /// <summary>
        /// 删除门锁用户指纹密码
        /// </summary>
        /// <param name="deviceId"></param>
        /// <param name="lockUserIndex"></param>
        /// <returns></returns>
        public ResponsePackNew DeleteDoorlockUserFingerPassword(string deviceId, string lockUserIndex)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("deviceId", deviceId);
            d.Add("lockUserIndex", lockUserIndex);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_DeleteDoorlockUser_DeleteFingerPassword, requestJson);
        }
        /// <summary>
        /// 删除门锁用户人脸密码
        /// </summary>
        /// <param name="deviceId"></param>
        /// <param name="lockUserIndex"></param>
        /// <returns></returns>
        public ResponsePackNew DeleteDoorlockUserFacePassword(string deviceId, string lockUserIndex)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("deviceId", deviceId);
            d.Add("lockUserIndex", lockUserIndex);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_DeleteDoorlockUser_DeleteFacePassword, requestJson);
        }
        /// <summary>
        /// 删除门锁用户
        /// </summary>
        /// <param name="deviceId"></param>
        /// <param name="lockUserIndex"></param>
        /// <returns></returns>
        public ResponsePackNew DeleteDoorlockUser(string deviceId, string lockUserIndex)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("deviceId", deviceId);
            d.Add("lockUserIndex", lockUserIndex);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_DeleteDoorlockUser_DeleteUser, requestJson);
        }
        /// <summary>
        /// 查询按键两次开门
        /// </summary>
        /// <param name="deviceId"></param>
        /// <returns></returns>
        public ResponsePackNew GetDoubleClickOpenDoorSwitch(string deviceId)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("deviceId", deviceId);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetDoubleClickOpenDoorSwitch, requestJson);
        }
        /// <summary>
        /// 设置按键两次开门
        /// </summary>
        /// <param name="deviceId"></param>
        /// <param name="enabled">按键两次开门开关 0-关闭,1次按键开门 1-开启,2次按键开门</param>
        /// <returns></returns>
        public ResponsePackNew SetDoubleClickOpenDoorSwitch(string deviceId,int enabled)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("deviceId", deviceId);
            d.Add("enabled", enabled);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_SetDoubleClickOpenDoorSwitch, requestJson);
        }
        /// <summary>
        /// 查询童锁开关
        /// </summary>
        /// <param name="deviceId"></param>
        /// <returns></returns>
        public ResponsePackNew GetChildLockSwitch(string deviceId)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("deviceId", deviceId);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetChildLockSwitch, requestJson);
        }
        /// <summary>
        /// 设置童锁开关
        /// </summary>
        /// <param name="deviceId"></param>
        /// <param name="enabled">童锁开关 0-关闭 1-开启</param>
        /// <returns></returns>
        public ResponsePackNew SetChildLockSwitch(string deviceId, int enabled)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("deviceId", deviceId);
            d.Add("enabled", enabled);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_SetChildLockSwitch, requestJson);
        }
        /// <summary>
        /// 查询反锁配置
        /// </summary>
        /// <param name="deviceId"></param>
        /// <returns></returns>
        public ResponsePackNew GetAntiLockCfg(string deviceId)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("deviceId", deviceId);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetAntiLockCfg, requestJson);
        }
        /// <summary>
        /// 设置反锁配置
        /// </summary>
        /// <param name="deviceId"></param>
        /// <param name="enabled"></param>
        /// <returns></returns>
        public ResponsePackNew SetAntiLockCfg(string deviceId, bool enabled)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("deviceId", deviceId);
            d.Add("enabled", enabled);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_SetAntiLockCfg, requestJson);
        }
        /// <summary>
        /// 查询布撤防状态
        /// </summary>
        /// <param name="deviceId"></param>
        /// <returns></returns>
        public ResponsePackNew GetDefenceStatus(string deviceId)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("deviceId", deviceId);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetDefenceStatus, requestJson);
        }
        /// <summary>
        /// 设置布撤防状态
        /// </summary>
        /// <param name="deviceId"></param>
        /// <param name="armStatus">布防状态 disarmed-撤防 armed-已布防</param>
        /// <param name="defenceMode">布防模式 global-全局 atHome-在家 outDoor-外出 sleep-睡眠</param>
        /// <returns></returns>
        public ResponsePackNew SetDefenceStatus(string deviceId, bool defance)//,string defenceMode)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("deviceId", deviceId);
            if(defance)
                d.Add("armStatus", "armed");
            else
                d.Add("armStatus", "disarmed");
            d.Add("defenceMode", "global");
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_SetDefenceStatus, requestJson);
        }
        /// <summary>
        /// 查询人脸开锁配置
        /// </summary>
        /// <param name="deviceId"></param>
        /// <returns></returns>
        public ResponsePackNew GetFaceUnlockCfg(string deviceId)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("deviceId", deviceId);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetFaceRecognitionUnlockCfg, requestJson);
        }
        /// <summary>
        /// 设置人脸开锁配置
        /// </summary>
        /// <param name="deviceId"></param>
        /// <param name="enabled"></param>
        /// <param name="mode">解锁方式 0-自动 1-手动</param>
        /// <returns></returns>
        public ResponsePackNew SetFaceUnlockCfg(string deviceId, bool enabled,int mode)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("deviceId", deviceId);
            d.Add("enabled", enabled);
            d.Add("mode", mode);//解锁方式 0-自动 1-手动
            d.Add("sensitivity", 0);//灵敏度 0-高 1-低
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_SetFaceRecognitionUnlockCfg, requestJson);
        }
        /// <summary>
        /// 查询门锁系统声音
        /// </summary>
        /// <param name="deviceId"></param>
        /// <returns></returns>
        public ResponsePackNew GetDoorLockSystemSound(string deviceId)
        {
            var d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("deviceId", deviceId);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetDoorLockSystemSound, requestJson);
        }
        /// <summary>
        /// 设置门锁系统声音
        /// </summary>
        /// <param name="deviceId"></param>
        /// <param name="sound"></param>
        /// <returns></returns>
        public ResponsePackNew SetDoorLockSystemSound(string deviceId,int sound)
        {
            var d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("deviceId", deviceId);
            d.Add("sound", sound);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_SetDoorLockSystemSound, requestJson);
        }
        /// <summary>
        /// 查询门铃提示音
        /// </summary>
        /// <param name="deviceId"></param>
        /// <returns></returns>
        public ResponsePackNew GetDoorBellTone(string deviceId)
        {
            var d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("deviceId", deviceId);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetDoorBellTone, requestJson);
        }
        /// <summary>
        /// 设置门铃提示音
        /// </summary>
        /// <param name="deviceId"></param>
        /// <param name="volume"></param>
        /// <returns></returns>
        public ResponsePackNew SetDoorBellTone(string deviceId, int volume)
        {
            var d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("deviceId", deviceId);
            d.Add("volume", volume);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_SetDoorBellTone, requestJson);
        }
        #endregion
        #endregion
        #region ■ 音箱语言控制相关_________________________
        /// <summary>
        /// 获取已授权的音箱列表
        /// </summary>
@@ -3034,7 +3543,7 @@
            var requestJson = HttpUtil.GetSignRequestJson(updateSpeakerDeviceListObj);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Speaker_DeviceList_Update, requestJson);
        }
#endregion
        #endregion
        /// <summary>
        /// 绑定source面板
@@ -3097,12 +3606,7 @@
        }
#region 光伏储能
        #region 光伏储能
        /// <summary>
        /// 获取住宅下逆变器列表
        /// </summary>
@@ -3127,7 +3631,155 @@
            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetInverter_StatisticsInfo, requestJson);
            return pack;
        }
#endregion
        #endregion
        #region 群控,组合调光
        /// <summary>
        /// 获取群控类型
        /// </summary>
        /// <param name="spk"></param>
        /// <returns></returns>
        public ResponsePackNew GetGroupControlTypes(string spk)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("spk", spk);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetGroupControlTypes, requestJson);
            return pack;
        }
        /// <summary>
        /// 获取群控列表
        /// </summary>
        /// <param name="spk"></param>
        /// <returns></returns>
        public ResponsePackNew GetGroupControlList()
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetGroupControlListByHome, requestJson);
            return pack;
        }
        /// <summary>
        /// 获取群控详情
        /// </summary>
        public ResponsePackNew GetGroupControInfo(string userDeviceGroupControlIds)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            var ids = new List<string>()
            {
                userDeviceGroupControlIds,
            };
            d.Add("userDeviceGroupControlIds", ids);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetGroupControlInfos, requestJson);
            return pack;
        }
        /// <summary>
        /// 获取群控详情
        /// </summary>
        public ResponsePackNew GetGroupControInfo(List<string> ids)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("userDeviceGroupControlIds", ids);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetGroupControlInfos, requestJson);
            return pack;
        }
        /// <summary>
        /// 添加群控列表
        /// </summary>
        public ResponsePackNew AddGroupControl(List<GroupControl> groupControls)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("gatewayId", DB_ResidenceData.Instance.HomeGateway.gatewayId);
            d.Add("infos", groupControls);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_AddGroupControl, requestJson);
            return pack;
        }
        /// <summary>
        /// 添加群控列表
        /// </summary>
        public ResponsePackNew DelGroupControl(string groupControlId)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("userDeviceGroupControlIds", new List<string>() { groupControlId });
            var requestJson = HttpUtil.GetSignRequestJson(d);
            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_DeleteGroupControl, requestJson);
            return pack;
        }
        /// <summary>
        /// 编辑群控列表
        /// </summary>
        /// <param name="spk"></param>
        /// <returns></returns>
        public ResponsePackNew EditGroupControl(List<GroupControl> groupControls)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            //d.Add("gatewayId", DB_ResidenceData.Instance.HomeGateway.gatewayId);
            d.Add("infos", groupControls);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_UpdateGroupControl, requestJson);
            return pack;
        }
        /// <summary>
        /// 群控控制
        /// </summary>
        public ResponsePackNew ControlGroupControl(string userDeviceGroupControlId, Dictionary<string, object> pair)
        {
            var d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("userDeviceGroupControlId", userDeviceGroupControlId);
            List<Dictionary<string, object>> dd = new List<Dictionary<string, object>>();
            dd.Add(pair);
            d.Add("status",dd);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_ControlGroupControl, requestJson);
            return pack;
        }
        /// <summary>
        /// 收藏群控
        /// </summary>
        public ResponsePackNew CollectGroupControl(string groupControlId)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("userDeviceGroupControlIds", new List<string>() { groupControlId });
            var requestJson = HttpUtil.GetSignRequestJson(d);
            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_CollectGroupControl, requestJson);
            return pack;
        }
        /// <summary>
        /// 取消收藏群控
        /// </summary>
        public ResponsePackNew CancelCollectGroupControl(string groupControlId)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("userDeviceGroupControlIds", new List<string>() { groupControlId });
            var requestJson = HttpUtil.GetSignRequestJson(d);
            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_CancelCollectGroupControl, requestJson);
            return pack;
        }
        #endregion
    }
}