From 0d9f64668fd7350d6a21fd157e32009a96d98134 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期三, 16 十二月 2020 13:09:08 +0800 Subject: [PATCH] 新云端代码Ver1.2 --- ZigbeeApp/Shared/Phone/Common/Logic/HdlCheckLogic.cs | 76 +++++++++++++++++++++++++++++-------- 1 files changed, 59 insertions(+), 17 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlCheckLogic.cs b/ZigbeeApp/Shared/Phone/Common/Logic/HdlCheckLogic.cs similarity index 80% rename from ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlCheckLogic.cs rename to ZigbeeApp/Shared/Phone/Common/Logic/HdlCheckLogic.cs index 6a47baf..0da5903 100644 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlCheckLogic.cs +++ b/ZigbeeApp/Shared/Phone/Common/Logic/HdlCheckLogic.cs @@ -4,7 +4,7 @@ using System.Text; using System.Text.RegularExpressions; -namespace Shared.Phone.UserCenter +namespace Shared.Phone { public class HdlCheckLogic { @@ -84,7 +84,8 @@ /// <returns></returns> public bool CheckEmail(string email) { - Regex reg = new Regex(CommonPage.EmailRegexStr); + string emailRegexStr = "^\\s*([A-Za-z0-9_-]+(\\.\\w+)*@(\\w+\\.)+\\w{2,5})\\s*$"; + Regex reg = new Regex(emailRegexStr); return reg.IsMatch(email); } @@ -99,7 +100,7 @@ //鏍¢獙澶栧浗鎵嬫満鍙� if (areaCode != "86") { - Regex reg = new Regex(CommonPage.PhoneForForeignRegexStr); + Regex reg = new Regex("^[0-9]*$"); return reg.IsMatch(phoneNumber); } @@ -110,7 +111,7 @@ } else if (phoneNumber.Length == 11) { - Regex reg = new Regex(CommonPage.PhoneRegexStr); + Regex reg = new Regex("^[1][0-9]{10}$"); return reg.IsMatch(phoneNumber); } else @@ -138,9 +139,23 @@ return true; } + /// <summary> + /// 妫�鏌ュ瘑鐮侀暱搴﹀悎娉曟�� + /// </summary> + /// <param name="password"></param> + /// <returns></returns> + public bool CheckPwdLength(string password) + { + if (password.Trim().Length >= 6 && password.Trim().Length <= 13) + { + return true; + } + return false; + } + #endregion - #region 鈻� 妫�娴嬬綉鍏冲叡閫氶敊璇姸鎬佺爜_____________ + #region 鈻� 妫�娴嬬綉鍏抽敊璇姸鎬佺爜_________________ /// <summary> /// <para>妫�娴嬬綉鍏宠繑鍥炵殑鍏遍�氶敊璇姸鎬佺爜(杩斿洖null鍒欎唬琛ㄦ病鏈夐敊璇�),鏀寔鐘舵�佺爜涓�</para> @@ -152,7 +167,7 @@ /// </summary> /// <param name="resultData">缃戝叧杩斿洖鐨剅esultData,閲岄潰鏈夈�恊rrorResponData銆戣繖涓笢瑗跨殑閭g瀵硅薄</param> /// <returns></returns> - public string CheckCommonErrorCode(object resultData) + public string CheckGatewayErrorCode(object resultData) { if (resultData == null) { @@ -168,7 +183,7 @@ var code = type.InvokeMember("Error", System.Reflection.BindingFlags.GetField, null, errorObj, null); int errorCode = Convert.ToInt32(code); - return CheckCommonErrorCode(errorCode); + return CheckGatewayErrorCode(errorCode); } /// <summary> @@ -181,7 +196,7 @@ /// </summary> /// <param name="errorCode">閿欒浠g爜</param> /// <returns></returns> - public string CheckCommonErrorCode(int errorCode) + public string CheckGatewayErrorCode(int errorCode) { if (errorCode == 1) { @@ -191,24 +206,51 @@ else if (errorCode == 2) { //鍗忚皟鍣ㄦ鍦ㄥ崌绾ф垨澶囦唤鎴栨仮澶嶆暟鎹腑 - string msg = Language.StringByID(R.MyInternationalizationString.uCoordinatorIsUpOrBackupOrRecovering); + return Language.StringByID(R.MyInternationalizationString.uCoordinatorIsUpOrBackupOrRecovering); } else if (errorCode == 3) { //鐩爣璁惧涓嶅瓨鍦� - string msg = Language.StringByID(R.MyInternationalizationString.uTargetDeviceIsNotExsit); + return Language.StringByID(R.MyInternationalizationString.uTargetDeviceIsNotExsit); } else if (errorCode == 4) { //鍑虹幇鏈煡閿欒,璇风◢鍚庡啀璇� - string msg = Language.StringByID(R.MyInternationalizationString.uUnKnowErrorAndResetAgain); + return Language.StringByID(R.MyInternationalizationString.uUnKnowErrorAndResetAgain); } else if (errorCode == 5) { //鏁版嵁浼犺緭閿欒,璇风◢鍚庡啀璇� - string msg = Language.StringByID(R.MyInternationalizationString.uDataTransmissionFailAndResetAgain); + return Language.StringByID(R.MyInternationalizationString.uDataTransmissionFailAndResetAgain); } return null; + } + + #endregion + + #region 鈻� 妫�娴嬫帴鍙h繑鍥炵殑鐘舵�佺爜_______________ + + /// <summary> + /// 妫�娴嬫帴鍙h繑鍥炵殑鐘舵�佺爜 + /// </summary> + /// <param name="i_response">浜戠杩斿洖鐨勪笢瑗�</param> + /// <param name="i_mode">鏄惁鏄剧ず璁块棶鎺ュ彛澶辫触鐨則ip娑堟伅</param> + /// <returns></returns> + public bool CheckNetCode(ResponsePack i_response, ShowNetCodeMode i_mode) + { + //涓轰簡鑺傜渷浠g爜,杩欐牱鏁磋�屽凡 + if (i_response == null) + { + //缃戝叧杩炴帴澶辫触,璇风‘璁ょ綉缁� + HdlMessageLogic.Current.ShowNotNetTipMsg(i_mode); + return false; + } + if (i_response.Code != HttpMessageEnum.A鎴愬姛) + { + HdlMessageLogic.Current.ShowNetCodeTipMsg(i_mode, i_response); + return false; + } + return true; } #endregion @@ -256,7 +298,7 @@ TouchIDUtils.Instance.OnHDLTouchIDStateBackEvent = null; TouchIDUtils.TouchIDSupperType type = TouchIDUtils.getTouchIDSupperType(); - if (type == TouchIDUtils.TouchIDSupperType.TouchID && UserCenterResourse.AccountOption.FingerprintAuthentication == true) + if (type == TouchIDUtils.TouchIDSupperType.TouchID && HdlUserCenterResourse.AccountOption.FingerprintAuthentication == true) { //Touch ID楠岃瘉 TouchIDUtils.Instance.OnHDLTouchIDStateBackEvent += (sender2, e2) => @@ -271,13 +313,13 @@ else if (e2 == TouchIDUtils.TouchIDState.InputPassword) { //瀵嗙爜楠岃瘉 - if (string.IsNullOrEmpty(UserCenterResourse.AccountOption.PswAuthentication) == false) + if (string.IsNullOrEmpty(HdlUserCenterResourse.AccountOption.PswAuthentication) == false) { var form = new PswSecondarySecurityForm(); form.AddForm(i_TouchText, i_PasswordText, i_GestureText, SuccessAction); } //鎵嬪娍楠岃瘉 - else if (string.IsNullOrEmpty(UserCenterResourse.AccountOption.GestureAuthentication) == false) + else if (string.IsNullOrEmpty(HdlUserCenterResourse.AccountOption.GestureAuthentication) == false) { var form = new PswGestureSecirityForm(); form.AddForm(i_TouchText, i_PasswordText, i_GestureText, SuccessAction); @@ -293,14 +335,14 @@ TouchIDUtils.Instance.showTouchIDWithDescribe(null, null); NotSettionAction = null; } - else if (string.IsNullOrEmpty(UserCenterResourse.AccountOption.PswAuthentication) == false) + else if (string.IsNullOrEmpty(HdlUserCenterResourse.AccountOption.PswAuthentication) == false) { //瀵嗙爜楠岃瘉 var form = new PswSecondarySecurityForm(); form.AddForm(i_TouchText, i_PasswordText, i_GestureText, SuccessAction); NotSettionAction = null; } - else if (string.IsNullOrEmpty(UserCenterResourse.AccountOption.GestureAuthentication) == false) + else if (string.IsNullOrEmpty(HdlUserCenterResourse.AccountOption.GestureAuthentication) == false) { //鎵嬪娍楠岃瘉 var form = new PswGestureSecirityForm(); -- Gitblit v1.8.0