From f60ce72c3c29c7d31a046795c88ec39a69e73d45 Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期三, 06 一月 2021 17:33:54 +0800 Subject: [PATCH] 2021-01-06 1.替换新云端前期准备相关接口,和修改相关参数。 --- Crabtree/SmartHome/HDL/Operation/UserConfig.cs | 147 ++++++++++++++++++++++++------------------------ 1 files changed, 73 insertions(+), 74 deletions(-) diff --git a/Crabtree/SmartHome/HDL/Operation/UserConfig.cs b/Crabtree/SmartHome/HDL/Operation/UserConfig.cs index 6074190..0679d27 100644 --- a/Crabtree/SmartHome/HDL/Operation/UserConfig.cs +++ b/Crabtree/SmartHome/HDL/Operation/UserConfig.cs @@ -32,7 +32,15 @@ } else { instance = temp; } - } catch{} + } catch{ + instance = new UserConfig { }; + instance.HideDeviceTypes.Add (SimpleControl.R.MyInternationalizationString.Projector); + instance.HideDeviceTypes.Add (SimpleControl.R.MyInternationalizationString.DoorLock); + instance.HideDeviceTypes.Add (SimpleControl.R.MyInternationalizationString.FreshAir); + instance.HideDeviceTypes.Add (SimpleControl.R.MyInternationalizationString.Sensor); + instance.HideDeviceTypes.Add (SimpleControl.R.MyInternationalizationString.Environmental); + instance.HideDeviceTypes.Add (SimpleControl.R.MyInternationalizationString.MusicModel); + } } return instance; } @@ -144,11 +152,17 @@ public Dictionary<string, string> RemoteDoorLockPasswordList = new Dictionary<string, string> (); //public string CountryCode = "CN"; + /// <summary> + /// + /// </summary> public int SkinCode = 1; - - + /// <summary> + /// 浣忓畢鍒楄〃 + /// </summary> public List<RegionInfoRes> HomeLists = new List<RegionInfoRes> (); - + /// <summary> + /// 褰撳墠浣忓畢 + /// </summary> RegionInfoRes currentRegion = new RegionInfoRes (); public RegionInfoRes CurrentRegion { set { @@ -156,77 +170,66 @@ CheckIfNeedGetMasterAccountToken (); //鍒囨崲浣忓畢 璁剧疆鏈湴鍔犲瘑Key SetLocalEncryptKey (); - - } get { if (currentRegion == null) { currentRegion = new RegionInfoRes (); } return currentRegion; - } - } - public bool CheckHomeGateways () + /// <summary> + /// 缃戝叧璇︾粏淇℃伅 + /// </summary> + public HomeGatewayInfo HomeGateway; + /// <summary> + /// 妫�娴嬩綇瀹呮槸鍚︾粦瀹氫簡缃戝叧 + /// gatewayId 鍒ょ┖ + /// </summary> + /// <returns></returns> + public bool CheckWhetherGatewayIdNotNull () { - if (CurrentRegion != null && CurrentRegion.HomeGateways != null && CurrentRegion.HomeGateways.Count > 0) { + if (HomeGateway != null && !string.IsNullOrEmpty (HomeGateway.gatewayId)) { return true; } else { return false; } } + /// <summary> + /// 妫�娴嬩綇瀹呮槸鍚︾粦瀹氫簡缃戝叧 + /// </summary> + /// <returns></returns> public bool CheckHomeGatewaysNotEmpty () { - if (CheckHomeGateways () && !string.IsNullOrEmpty (currentRegion.HomeGateways [0].GatewayUniqueId)) { + if (HomeGateway != null && !string.IsNullOrEmpty (HomeGateway.mac)) { return true; } else { return false; } } - public bool CheckThisHomeGatewaysNotEmpty (RegionInfoRes mRegionInfoRes) - { - if (mRegionInfoRes != null && mRegionInfoRes.HomeGateways != null && mRegionInfoRes.HomeGateways.Count > 0 && !string.IsNullOrEmpty (mRegionInfoRes.HomeGateways [0].GatewayUniqueId)) { - return true; - } else { - return false; - } - } - - //public List<GatewayRes> GatewayList = new List<GatewayRes> (); - - //public List<string> GatewayMACList { - // get { - // List<string> macList = new List<string> (); - // foreach (var mac in GatewayList) { - // macList.Add (mac.GatewayUniqueId); - // } - // return macList; - // } - //} - //public string GatewayMAC = ""; - + /// <summary> + /// + /// </summary> public string GatewayMAC { get { if (CheckHomeGatewaysNotEmpty ()) { - return currentRegion.HomeGateways [0].GatewayUniqueId; + return HomeGateway.mac; } else { return ""; } } set { - if (CheckHomeGateways ()) { - currentRegion.HomeGateways [0].GatewayUniqueId = value; + if (CheckHomeGatewaysNotEmpty()) { + HomeGateway.mac = value; } else { //2020-01-11 - if (currentRegion != null) { - var mHomeGateways = new HomeGateways () { GatewayUniqueId = value }; - var mList = new List<HomeGateways> (); - mList.Add (mHomeGateways); - currentRegion.HomeGateways = mList; + if (HomeGateway != null) { + HomeGateway.mac = value; + } else { + HomeGateway = new HomeGatewayInfo () { mac = value}; } } } @@ -248,7 +251,7 @@ mac.GatewayUniqueId = mGatewayRes.GatewayUniqueId; mMacList.Add (mac); } - currentRegion.HomeGateways = mMacList; + //HomeGateways = mMacList; } } } catch { @@ -256,10 +259,7 @@ } } - - - public List<string> RometoUserInfoKeys = new List<string> (); - + //public List<string> RometoUserInfoKeys = new List<string> (); /// <summary> /// 鏈湴閫氫俊鍔犲瘑Key @@ -271,7 +271,6 @@ /// 鏄惁鍔犲瘑瀵嗙爜楠岃瘉閫氳繃 /// </summary> public bool EncryptedPasswordCorrect = true; - /// <summary> /// 鏄惁鍔犲瘑 /// </summary> @@ -325,35 +324,35 @@ { if (bGetting) return; - //2020-01-08 鍒ゆ柇鏄惁鍒嗕韩杩囨潵鐨勪綇瀹� - if (currentRegion != null && currentRegion.IsOthreShare) { - //MainPage.IsAdministrator = UserConfig.Instance.CurrentRegion.IsOthreShare; - //璇锋眰涓昏处鍙穞oken - System.Threading.Tasks.Task.Run (() => { - try { - bGetting = true; - var requestObj = new GetSharedHomeApiControlObj () { - LoginAccessToken = MainPage.LoginUser.LoginTokenString, - MainAccountId = currentRegion.MainUserDistributedMark, - SharedHid = currentRegion.Id, + ////2020-01-08 鍒ゆ柇鏄惁鍒嗕韩杩囨潵鐨勪綇瀹� + //if (currentRegion != null && currentRegion.IsOthreShare) { + // //MainPage.IsAdministrator = UserConfig.Instance.CurrentRegion.IsOthreShare; + // //璇锋眰涓昏处鍙穞oken + // System.Threading.Tasks.Task.Run (() => { + // try { + // bGetting = true; + // var requestObj = new GetSharedHomeApiControlObj () { + // LoginAccessToken = MainPage.LoginUser.LoginTokenString, + // MainAccountId = currentRegion.MainUserDistributedMark, + // SharedHid = currentRegion.Id, - }; - var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject (requestObj); - var revertObj = MainPage.RequestHttps (API.GetSharedHomeApiControl, requestJson); - if (revertObj.StateCode.ToUpper () == "SUCCESS") { - var responseDataObj = Newtonsoft.Json.JsonConvert.DeserializeObject<MemberAdministratorResult> (revertObj.ResponseData.ToString ()); - if (responseDataObj != null) { - MasterAccountToken = responseDataObj.RequestToken; - MasterAccountRequestBaseUrl = responseDataObj.RequestBaseUrl; - } - } - } catch { + // }; + // var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject (requestObj); + // var revertObj = MainPage.RequestHttps (API.GetSharedHomeApiControl, requestJson); + // if (revertObj.StateCode.ToUpper () == StateCode.SUCCESS) { + // var responseDataObj = Newtonsoft.Json.JsonConvert.DeserializeObject<MemberAdministratorResult> (revertObj.ResponseData.ToString ()); + // if (responseDataObj != null) { + // MasterAccountToken = responseDataObj.RequestToken; + // MasterAccountRequestBaseUrl = responseDataObj.RequestBaseUrl; + // } + // } + // } catch { - } finally { - bGetting = false; - } - }); - } + // } finally { + // bGetting = false; + // } + // }); + //} } } -- Gitblit v1.8.0