wxr
2021-07-01 b409ece9569247d7e7b44fc15e8a02556ca05a57
HDL_ON/DAL/Server/HttpServerRequest.cs
@@ -51,7 +51,7 @@
            d.Add("type", qType);
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("deviceId",  deviceId );
            d.Add("key",  "value" );
            d.Add("key",  deviceKey );
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_EnvironmentalSensorHistoricalData, requestJson);
@@ -74,8 +74,20 @@
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_ArmSensorHistoricalData, requestJson);
        }
        /// <summary>
        /// 读取最近一个月的数据
        /// </summary>
        /// <returns></returns>
        public ResponsePackNew GetLastMonthHistory(string deviceId,string key)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("deviceId", deviceId);
            d.Add("key", key);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_SensorLastMonthHistoricalData, requestJson);
        }
        #endregion
@@ -452,13 +464,25 @@
            return HttpUtil.RequestHttpsPost(NewAPI.API_POST_Member_UnbindWithAccount, requestJson).Code;
        }
        /// <summary>
        /// 根据账号,获取账号信息
        /// </summary>
        /// <param name="i_account">指定账号</param>
        /// <returns></returns>
        public ResponsePackNew GetMemberInfoByAccount(string i_account)
        {
            var pra = new { account = i_account };
            var requestJson = HttpUtil.GetSignRequestJson(pra);
            return HttpUtil.RequestHttpsPost(NewAPI.API_POST_Member_GetMemberInfoByAccount, requestJson);
        }
        #endregion
        #region 住宅部分
        /// <summary>
        /// 获取住宅列表
        /// </summary>
        public string GetHomePager(HomeTypeEnum homeType = HomeTypeEnum.ALL)
        public string GetHomePager(HomeTypeEnum homeType = HomeTypeEnum.ALL,string homeId = "")
        {
            var requestJson = HttpUtil.GetSignRequestJson(new GetHomeListObj() { homeType = homeType.ToString() });
            var resultObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_Gethomepager, requestJson);
@@ -473,28 +497,17 @@
                {
                    foreach (var home in homeList)
                    {
                        //var home = new RegionInfoRes()
                        //{
                        //    RegionID = mHome.Id,
                        //    Name = mHome.homeName,
                        //    IsOthreShare = mHome.IsOtherShare,
                        //    accountType = mHome.accountType,
                        //    isRemoteControl = mHome.isRemoteControl,
                        //    isBindGateway = mHome.isBindGateway,
                        //    longitude = mHome.longitude,
                        //    latitude = mHome.latitude,
                        //    deliverstatus = mHome.deliverstatus,
                        //    homeType = mHome.homeType,
                        //    regionUrl = mHome.regionUrl,
                        //    emqUrl = mHome.emqUrl,
                        //    homeRegionName = mHome.homeRegionName,
                        //    homeRegionId = mHome.homeRegionId,
                        //    Address = mHome.homeAddress,
                        //    isAllowCreateScene = mHome.isAllowCreateScene,
                        //};
                        if (home.isBindGateway)
                        {
                            UserInfo.Current.regionList.Add(home);
                            //新绑定的住宅,直接切换到新住宅
                            if (!string.IsNullOrEmpty(homeId))
                            {
                                if (homeId.Contains(home.id))
                                {
                                    DB_ResidenceData.Instance.CurrentRegion = home;
                                }
                            }
                        }
                    }
                    if(UserInfo.Current.regionList.Count== 0)
@@ -696,6 +709,24 @@
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Child_Update, requestJson);
        }
        /// <summary>
        /// 过户
        /// </summary>
        /// <param name="i_account">对方账号</param>
        /// <returns></returns>
        public bool TransferResidence(string i_account)
        {
            var pra2 = new
            {
                homeId = Entity.DB_ResidenceData.Instance.CurrentRegion.id,
                account = i_account
            };
            var requestJson = HttpUtil.GetSignRequestJson(pra2);
            var result = HttpUtil.RequestHttpsPost(NewAPI.API_Post_TransferResidence, requestJson);
            return result != null && result.Code == StateCode.SUCCESS;
        }
        #region 新数据分享
        /// <summary>
        /// 添加分享
@@ -885,8 +916,9 @@
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("debugPerm", debugPerm);
            string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_Post_Home_UpdateDebugPerm, jsonString);
            var jsonString = HttpUtil.GetSignRequestJson(d,d);
            var pack = HttpUtil.RequestHttpsPost(NewAPI.API_Post_Home_UpdateDebugPerm, jsonString);
            return pack;
        }
@@ -1013,7 +1045,8 @@
            var requestJson = HttpUtil.GetSignRequestJson(new GetMessageListObj()
            {
                pushId = OnAppConfig.Instance.PushId,
                pushType = pushType
                pushType = pushType,
                homeId = DB_ResidenceData.Instance.CurrentRegion.id,
            });
            return HttpUtil.RequestHttpsPost(NewAPI.API_POST_PushSerivce_Getpushmessagelist, requestJson);
        }
@@ -1278,6 +1311,9 @@
                            MainPage.cityInfo.pm25 = jt.GetValue("Air_Quality").ToString();
                            MainPage.cityInfo.windLevel = jt.GetValue("WindLevel").ToString();
                            MainPage.cityInfo.weather = jt.GetValue("Weather").ToString();
                            MainPage.cityInfo.lowestTemperature = jt.GetValue("lowestTemperature").ToString();
                            MainPage.cityInfo.highestTemperature = jt.GetValue("highestTemperature").ToString();
                            break;
                        }
                        catch (Exception ex)
@@ -1805,7 +1841,10 @@
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("productPlatform", productPlatform);
            d.Add("productBrand", productBrand);
            d.Add("networkConfig", true);
            if (productBrand != "MegaHealth")
            {
                d.Add("networkConfig", true);
            }
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetDevcieList, requestJson);
@@ -1824,10 +1863,29 @@
            d.Add("productBrand", productBrand);
            d.Add("networkConfig", true);
            
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Get3tyBrandDevcieList, requestJson);
        }
        /// <summary>
        /// 注册第三方设备
        /// </summary>
        /// <param name="productPlatform"></param>
        /// <param name="productBrand"></param>
        /// <returns></returns>
        public ResponsePackNew IndependentRegister3TyDevcie(string spk,string extDevId,string deviceName)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("spk", spk);
            d.Add("extDevId", extDevId);
            d.Add("name", deviceName);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_IndependentRegister3TyDevcie, requestJson);
        }
        /// <summary>
        /// 获取设备详情
@@ -2418,7 +2476,7 @@
        }
        #endregion
        #region ■ 门锁历史记录________________________
        #region ■ 门锁相关____________________________
        /// <summary>
        /// 获取门锁历史记录(按日期降序)
@@ -2427,6 +2485,19 @@
        /// <returns></returns>
        public List<Stan.DoorHistoryLog> GetDoorHistoryLogs(Function i_device)
        {
            //var dicPra = new Dictionary<string, object>();
            //dicPra.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            //dicPra.Add("deviceId", i_device.deviceId);
            //dicPra.Add("logType", "OPEN_DOOR");
            //dicPra.Add("pageSize", "200");
            //var requestJson = HttpUtil.GetSignRequestJson(dicPra);
            //var packData = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_DoorHistory, requestJson);
            //if (packData.Code != StateCode.SUCCESS)
            //{
            //    return null;
            //}
            //测试
            var listLog = new List<Stan.DoorHistoryLog>();
            for (int i = 1; i <= 3; i++)