From 0087dd7734e71dfcfd1bb54db394ad7855021ffd Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期五, 24 七月 2020 10:18:08 +0800 Subject: [PATCH] 新版本 --- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs | 108 +++++++++++++++++++++++++++++++---------------------- 1 files changed, 63 insertions(+), 45 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs index bf5c4b9..2f61f5d 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs @@ -22,15 +22,9 @@ /// <param name="checkAuthority">鏄惁妫�娴嬫潈闄愶紝璇ュ弬鏁颁笉鑳界渷鐣�</param> /// <param name="obj">涓�涓被</param> /// <param name="listNotShowError">涓嶉渶瑕佹樉绀洪敊璇殑閿欒绫诲埆(鎺ュ彛杩斿洖鐨勯敊璇被鍒�),濡傛灉鍖呭惈锛屽垯浼氳繑鍥炪�恡rue銆�</param> - /// <param name="setAgain">褰撳彂閫佸け璐ユ椂,鏄惁閲嶅彂,榛樿涓嶉噸鍙�</param> - public static bool GetResultStatuByRequestHttps(string RequestName, bool checkAuthority, object obj, List<string> listNotShowError = null, bool setAgain = false) + /// <param name="setAgain">褰撳彂閫佸け璐ユ椂,鏄惁閲嶅彂,榛樿閲嶅彂</param> + public static bool GetResultStatuByRequestHttps(string RequestName, bool checkAuthority, object obj, List<string> listNotShowError = null, bool setAgain = true) { - if (HdlWifiLogic.Current.CanAccessHttp == false && setAgain == false) - { - //褰撳墠鏃犳硶璁块棶缃戠粶(褰撻渶瑕侀噸鏂板彂閫佹椂,璺宠繃杩欎釜鍒ゆ柇) - ShowNotNetMsg(listNotShowError); - return false; - } //鑾峰彇鎺ュ彛鐨勮繛鎺ユā寮� var connectMode = GetHttpConnectMode(checkAuthority); //鑾峰彇浠庢帴鍙i偅閲屽彇鍒扮殑姣旂壒鏁版嵁 @@ -39,7 +33,8 @@ { if (setAgain == false) { - //涓嶆寚瀹氶噸鍙� + //褰撳墠鏃犳硶璁块棶缃戠粶 + ShowNotNetMsg(listNotShowError); return false; } byteData = ResetByteRequestHttps(RequestName, checkAuthority, obj); @@ -61,17 +56,10 @@ /// <param name="checkAuthority">鏄惁妫�娴嬫潈闄愶紝璇ュ弬鏁颁笉鑳界渷鐣�</param> /// <param name="obj">涓�涓被</param> /// <param name="listNotShowError">涓嶉渶瑕佹樉绀洪敊璇殑閿欒绫诲埆(鎺ュ彛杩斿洖鐨勯敊璇被鍒�),濡傛灉鍖呭惈锛屽垯浼氳繑鍥炪�恡rue銆�</param> - /// <param name="setAgain">褰撳彂閫佸け璐ユ椂,鏄惁閲嶅彂,榛樿涓嶉噸鍙�</param> + /// <param name="setAgain">褰撳彂閫佸け璐ユ椂,鏄惁閲嶅彂,榛樿閲嶅彂</param> /// </param> - public static string GetResultCodeByRequestHttps(string RequestName, bool checkAuthority, object obj, List<string> listNotShowError = null, bool setAgain = false) + public static string GetResultCodeByRequestHttps(string RequestName, bool checkAuthority, object obj, List<string> listNotShowError = null, bool setAgain = true) { - if (HdlWifiLogic.Current.CanAccessHttp == false && setAgain == false) - { - //褰撳墠鏃犳硶璁块棶缃戠粶(褰撻渶瑕侀噸鏂板彂閫佹椂,璺宠繃杩欎釜鍒ゆ柇) - ShowNotNetMsg(listNotShowError); - return "Error"; - } - //鑾峰彇鎺ュ彛鐨勮繛鎺ユā寮� var connectMode = GetHttpConnectMode(checkAuthority); //鑾峰彇浠庢帴鍙i偅閲屽彇鍒扮殑姣旂壒鏁版嵁 @@ -80,7 +68,8 @@ { if (setAgain == false) { - //涓嶆寚瀹氶噸鍙� + //褰撳墠鏃犳硶璁块棶缃戠粶 + ShowNotNetMsg(listNotShowError); return "Error"; } byteData = ResetByteRequestHttps(RequestName, checkAuthority, obj); @@ -105,16 +94,10 @@ /// <param name="checkAuthority">鏄惁妫�娴嬫潈闄愶紝璇ュ弬鏁颁笉鑳界渷鐣�</param> /// <param name="obj">涓�涓被</param> /// <param name="listNotShowError">涓嶉渶瑕佹樉绀洪敊璇殑閿欒绫诲埆(鎺ュ彛杩斿洖鐨勯敊璇被鍒�),濡傛灉鍖呭惈锛屽垯浼氳繑鍥炪�恡rue銆�</param> - /// <param name="setAgain">褰撳彂閫佸け璐ユ椂,鏄惁閲嶅彂,榛樿涓嶉噸鍙�</param> + /// <param name="setAgain">褰撳彂閫佸け璐ユ椂,鏄惁閲嶅彂,榛樿閲嶅彂</param> /// </param> - public static string GetResponseDataByRequestHttps(string RequestName, bool checkAuthority, object obj, List<string> listNotShowError = null, bool setAgain = false) + public static string GetResponseDataByRequestHttps(string RequestName, bool checkAuthority, object obj, List<string> listNotShowError = null, bool setAgain = true) { - if (HdlWifiLogic.Current.CanAccessHttp == false && setAgain == false) - { - //褰撳墠鏃犳硶璁块棶缃戠粶(褰撻渶瑕侀噸鏂板彂閫佹椂,璺宠繃杩欎釜鍒ゆ柇) - ShowNotNetMsg(listNotShowError); - return null; - } //鑾峰彇鎺ュ彛鐨勮繛鎺ユā寮� var connectMode = GetHttpConnectMode(checkAuthority); //鑾峰彇浠庢帴鍙i偅閲屽彇鍒扮殑姣旂壒鏁版嵁 @@ -123,7 +106,8 @@ { if (setAgain == false) { - //涓嶆寚瀹氶噸鍙� + //褰撳墠鏃犳硶璁块棶缃戠粶 + ShowNotNetMsg(listNotShowError); return null; } byteData = ResetByteRequestHttps(RequestName, checkAuthority, obj); @@ -154,15 +138,9 @@ /// <param name="checkAuthority">鏄惁妫�娴嬫潈闄愶紝璇ュ弬鏁颁笉鑳界渷鐣�</param> /// <param name="obj">涓�涓被</param> /// <param name="listNotShowError">涓嶉渶瑕佹樉绀洪敊璇殑閿欒绫诲埆(鎺ュ彛杩斿洖鐨勯敊璇被鍒�),濡傛灉鍖呭惈锛屽垯浼氳繑鍥炪�恡rue銆�</param> - /// <param name="setAgain">褰撳彂閫佸け璐ユ椂,鏄惁閲嶅彂,榛樿涓嶉噸鍙�</param> - public static byte[] GetByteResponseDataByRequestHttps(string RequestName, bool checkAuthority, object obj, List<string> listNotShowError = null, bool setAgain = false) + /// <param name="setAgain">褰撳彂閫佸け璐ユ椂,鏄惁閲嶅彂,榛樿閲嶅彂</param> + public static byte[] GetByteResponseDataByRequestHttps(string RequestName, bool checkAuthority, object obj, List<string> listNotShowError = null, bool setAgain = true) { - if (HdlWifiLogic.Current.CanAccessHttp == false && setAgain == false) - { - //褰撳墠鏃犳硶璁块棶缃戠粶(褰撻渶瑕侀噸鏂板彂閫佹椂,璺宠繃杩欎釜鍒ゆ柇) - ShowNotNetMsg(listNotShowError); - return null; - } //鑾峰彇鎺ュ彛鐨勮繛鎺ユā寮� var connectMode = GetHttpConnectMode(checkAuthority); //鑾峰彇浠庢帴鍙i偅閲屽彇鍒扮殑姣旂壒鏁版嵁 @@ -172,7 +150,8 @@ { if (setAgain == false) { - //涓嶆寚瀹氶噸鍙� + //褰撳墠鏃犳硶璁块棶缃戠粶 + ShowNotNetMsg(listNotShowError); return null; } revertObj = ResetByteRequestHttps(RequestName, checkAuthority, obj); @@ -537,7 +516,7 @@ //鏂紑杩滅▼Mqtt杩炴帴,閲嶆柊杩炴帴 HdlThreadLogic.Current.RunThread(async () => { - HdlGatewayLogic.Current.ClearAllRealGateway(); + HdlGatewayLogic.Current.ClearAllRealGatewayConection(true); await ZigBee.Device.ZbGateway.DisConnectRemoteMqttClient(); }, ShowErrorMode.NO); } @@ -582,11 +561,13 @@ { //璁惧畾涓�涓椂闂� Config.Instance.LoginDateTime = new DateTime(1970, 1, 1); + Config.Instance.Save(); //娓呯┖褰撳墠浣忓畢id Config.Instance.HomeId = string.Empty; - Config.Instance.Save(); //鏀惰捣宸﹁彍鍗� CommonPage.Instance.CloseLeftMenu(); + //鍏抽棴鍏ㄩ儴寮圭獥 + ShowMsgControl.CloseAllMsgDialog(); //鍏抽棴鎵�鏈夋墦寮�浜嗙殑鐣岄潰 CloseAllOpenForm(); @@ -616,7 +597,7 @@ //娓呯┖褰撳墠浣忓畢id Config.Instance.HomeId = string.Empty; - HdlGatewayLogic.Current.ClearAllRealGateway(); + HdlGatewayLogic.Current.ClearAllRealGatewayConection(false); //鏂紑杩滅▼Mqtt杩炴帴 HdlThreadLogic.Current.RunThread(async () => @@ -672,6 +653,8 @@ } else if (view is UserView.UserPage) { + //鍒锋柊涓婚〉 + UserView.UserPage.Instance.ReFreshControl(); return; } else @@ -792,6 +775,10 @@ if (Common.Config.Instance.HomeId != UserCenterResourse.AccountOption.OldHomeStringId || Common.Config.Instance.Account != UserCenterResourse.AccountOption.OldAccountId) { + //鍊熺敤涓�涓嬭繖涓彉閲�(妫�娴嬭兘鍚﹀箍鎾埌缃戝叧) + UserCenterResourse.DicReceiveGatewayTest = new Dictionary<string, ZigBee.Device.ZbGateway>(); + UserCenterResourse.HideOption.CheckCanReceiveGateway = 1; + //娓呯┖鎵�鏈夋垚鍛樼紦瀛� ClearAllMemberMemory(); @@ -804,6 +791,9 @@ //鍔犺浇浣忓畢閰嶇疆淇℃伅 UserCenterResourse.ResidenceOption = UserCenterResourse.ResidenceOption.Load(); + //棰勫垱寤轰釜浜轰腑蹇冨叏閮ㄧ殑鏂囦欢澶� + HdlFileLogic.Current.CreatAllUserCenterDirectory(); + //鍒濆鍖栫櫥闄嗚处鍙风殑淇℃伅 var hadNet = InitUserAccoutInfo(true); //濡傛灉鏈夌綉缁滅殑璇� @@ -814,8 +804,6 @@ //璇诲彇闅愬尶閰嶇疆 HdlBackupLogic.Current.LoadHideOption(); } - //棰勫垱寤轰釜浜轰腑蹇冨叏閮ㄧ殑鏂囦欢澶� - HdlFileLogic.Current.CreatAllUserCenterDirectory(); //鍏抽棴鎵�鏈夋帴鏀� HdlGatewayReceiveLogic.Current.RemoveAllEvent(); @@ -852,7 +840,7 @@ //鏂紑杩滅▼Mqtt杩炴帴,閲嶆柊杩炴帴 HdlThreadLogic.Current.RunThread(async () => { - HdlGatewayLogic.Current.ClearAllRealGateway(); + HdlGatewayLogic.Current.ClearAllRealGatewayConection(true); await ZigBee.Device.ZbGateway.DisConnectRemoteMqttClient(); }, ShowErrorMode.NO); @@ -867,6 +855,36 @@ } //鏄剧ず寮曞鐣岄潰 ShowGuideForm(result); + + //鍏抽棴debug骞挎挱 + UserCenterResourse.HideOption.CheckCanReceiveGateway = 0; + System.Threading.Thread.Sleep(30); + if (hadNet == 1) + { + try + { + bool canReceiveGw = false; + foreach (var gateway in UserCenterResourse.DicReceiveGatewayTest.Values) + { + if (gateway.HomeId == Config.Instance.Home.Id) + { + //鑳藉鎼滅储寰楀埌缃戝叧 + canReceiveGw = true; + break; + } + } + UserCenterResourse.DicReceiveGatewayTest = null; + //璁剧疆杩滅▼杩炴帴鐨勫垵濮嬪�� + ZigBee.Device.ZbGateway.IsRemote = canReceiveGw == false; + if (canReceiveGw == false) + { + //濡傛灉鏄繙绋嬬殑璇�,杩藉姞绛夊緟鏃堕棿 + System.Threading.Thread.Sleep(1500); + } + } + catch { } + } + UserCenterResourse.DicReceiveGatewayTest = null; } //APP缂撳瓨鍔犺浇瀹屾垚 UserCenterResourse.AccountOption.AppCanSignout = true; @@ -1022,7 +1040,7 @@ if (UserCenterResourse.UserInfo.HeadImage != null) { //鍐欏叆澶村儚鍐呭 - Shared.IO.FileUtils.WriteFileByBytes(UserCenterResourse.UserInfo.UserIconFile, UserCenterResourse.UserInfo.HeadImage); + HdlFileLogic.Current.SaveByteToFile(UserCenterResourse.UserInfo.UserIconFile, UserCenterResourse.UserInfo.HeadImage); } UserCenterResourse.UserInfo.HeadImage = null; //鎵嬪娍瀵嗙爜 @@ -1246,7 +1264,7 @@ { try { - if (strPsw == string.Empty) + if (string.IsNullOrEmpty(strPsw) == true) { return strPsw; } -- Gitblit v1.8.0