From 6d73bf6e816570291865674bef8bce8972e4de3f Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期三, 01 十二月 2021 16:32:57 +0800
Subject: [PATCH] 2021-12-01-01

---
 HDL_ON/UI/UI0-Stan/Logic/HdlCheckLogic.cs |   72 ++++++++++++++++++++++++++++-------
 1 files changed, 57 insertions(+), 15 deletions(-)

diff --git a/HDL_ON/UI/UI0-Stan/Logic/HdlCheckLogic.cs b/HDL_ON/UI/UI0-Stan/Logic/HdlCheckLogic.cs
index 0397230..53f920a 100644
--- a/HDL_ON/UI/UI0-Stan/Logic/HdlCheckLogic.cs
+++ b/HDL_ON/UI/UI0-Stan/Logic/HdlCheckLogic.cs
@@ -30,6 +30,12 @@
                 return m_Current;
             }
         }
+
+        /// <summary>
+        /// 楠岃瘉璁よ瘉鐨勬鏁�
+        /// </summary>
+        private int checkSecurityCount = 3;
+
         #endregion
 
         #region 鈻� 楠岃瘉瑙i攣璁よ瘉_______________________
@@ -38,9 +44,9 @@
         /// 楠岃瘉瑙i攣璁よ瘉
         /// </summary>
         /// <param name="addTopFrame">楠岃瘉鐣岄潰鏄惁娣诲姞澶撮儴Frame(鍙鎵嬪娍瀵嗙爜鍜屾暟瀛楀瘑鐮佹湁鏁�)</param>
-        /// <param name="successEvent">楠岃瘉鎴愬姛涔嬪悗鐨勫洖璋冨嚱鏁�,澶辫触涓嶄細鍥炶皟</param>
+        /// <param name="successEvent">楠岃瘉鎴愬姛涔嬪悗鐨勫洖璋冨嚱鏁�,澶辫触涓嶄細鍥炶皟(0:娌℃湁璁剧疆鏈夐獙璇� 1:楠岃瘉鎴愬姛锛�</param>
         /// <param name="loadPageBeforEvent">鍔犺浇鎸囧畾瑙i攣璁よ瘉鐣岄潰涔嬪墠鐨勪簨浠�,0:鍙栨秷褰撳墠楠岃瘉骞跺垏鎹㈠埌鍏朵粬鏂瑰紡,1:鏁板瓧瀵嗙爜,2:鎵嬪娍瀵嗙爜,3:鎸囩汗瀵嗙爜,4:闈㈠ID</param>
-        public void CheckUnlockSecurity(bool addTopFrame, Action successEvent, Action<string> loadPageBeforEvent = null)
+        public void CheckUnlockSecurity(bool addTopFrame, Action<int> successEvent, Action<int> loadPageBeforEvent = null)
         {
             //楠岃瘉鎸囩汗鍜岄潰瀹筰d閮戒娇鐢ㄦ寚绾归獙璇�
             if (UserInfo.Current.appUnlockType.Contains("3") || UserInfo.Current.appUnlockType.Contains("4"))
@@ -52,15 +58,18 @@
                 if (type == TouchIDUtils.TouchIDSupperType.TouchID)
                 {
                     //閫氱煡浣跨敤鎸囩汗楠岃瘉
-                    loadPageBeforEvent?.Invoke("3");
+                    loadPageBeforEvent?.Invoke(3);
 
                     //Touch ID楠岃瘉
                     TouchIDUtils.Instance.OnHDLTouchIDStateBackEvent += (sender2, e2) =>
                     {
                         if (e2 == TouchIDUtils.TouchIDState.Success)
                         {
+                            //娆℃暟杩樺師
+                            this.checkSecurityCount = 3;
+
                             //TouchID楠岃瘉鎴愬姛
-                            successEvent?.Invoke();
+                            successEvent?.Invoke(1);
                             successEvent = null;
                             loadPageBeforEvent = null;
                             TouchIDUtils.Instance.OnHDLTouchIDStateBackEvent = null;
@@ -68,7 +77,7 @@
                         else if (e2 == TouchIDUtils.TouchIDState.InputPassword)
                         {
                             //閫氱煡鍙栨秷浜嗛獙璇�,鍒囨崲涓哄叾浠栭獙璇�
-                            loadPageBeforEvent?.Invoke("0");
+                            loadPageBeforEvent?.Invoke(0);
 
                             //浣跨敤瀵嗙爜鎴栬�呮墜鍔垮瘑鐮佽В閿佽璇�
                             this.CheckUnlockSecurityByPassword(addTopFrame, successEvent, loadPageBeforEvent);
@@ -97,14 +106,14 @@
         /// 浣跨敤瀵嗙爜鎴栬�呮墜鍔垮瘑鐮佽В閿佽璇�
         /// </summary>
         /// <param name="addTopFrame">楠岃瘉鐣岄潰鏄惁娣诲姞澶撮儴Frame(鍙鎵嬪娍瀵嗙爜鍜屾暟瀛楀瘑鐮佹湁鏁�)</param>
-        /// <param name="successEvent">楠岃瘉鎴愬姛涔嬪悗鐨勫洖璋冨嚱鏁�,澶辫触涓嶄細鍥炶皟</param>
+        /// <param name="successEvent">楠岃瘉鎴愬姛涔嬪悗鐨勫洖璋冨嚱鏁�,澶辫触涓嶄細鍥炶皟(0:娌℃湁璁剧疆鏈夐獙璇� 1:楠岃瘉鎴愬姛锛�</param>
         /// <param name="loadPageBeforEvent">鍔犺浇鎸囧畾瑙i攣璁よ瘉鐣岄潰涔嬪墠鐨勪簨浠�,1:鏁板瓧瀵嗙爜,2:鎵嬪娍瀵嗙爜,3:鎸囩汗瀵嗙爜,4:闈㈠ID</param>
-        private void CheckUnlockSecurityByPassword(bool addTopFrame, Action successEvent, Action<string> loadPageBeforEvent = null)
+        private void CheckUnlockSecurityByPassword(bool addTopFrame, Action<int> successEvent, Action<int> loadPageBeforEvent = null)
         {
             if (UserInfo.Current.appUnlockType.Contains("1"))
             {
                 //閫氱煡浣跨敤鏁板瓧瀵嗙爜楠岃瘉
-                loadPageBeforEvent?.Invoke("1");
+                loadPageBeforEvent?.Invoke(1);
 
                 //鏄剧ず鏁板瓧瀵嗙爜瑙i攣璁よ瘉鐣岄潰
                 this.ShowAppNumPasswordSecurityForm(addTopFrame, successEvent);
@@ -112,10 +121,16 @@
             else if (UserInfo.Current.appUnlockType.Contains("2"))
             {
                 //閫氱煡浣跨敤鎵嬪娍瀵嗙爜楠岃瘉
-                loadPageBeforEvent?.Invoke("2");
+                loadPageBeforEvent?.Invoke(2);
 
                 //鏄剧ず鎵嬪娍瀵嗙爜瑙i攣璁よ瘉鐣岄潰
                 this.ShowAppGestureSecurityForm(addTopFrame, successEvent);
+            }
+            else
+            {
+                //娌℃湁璁剧疆鏈夐獙璇�
+                successEvent?.Invoke(0);
+                successEvent = null;
             }
         }
 
@@ -123,8 +138,8 @@
         /// 鏄剧ず鏁板瓧瀵嗙爜瑙i攣璁よ瘉鐣岄潰
         /// </summary>
         /// <param name="addTopFrame">楠岃瘉鐣岄潰鏄惁娣诲姞澶撮儴Frame(鍙鎵嬪娍瀵嗙爜鍜屾暟瀛楀瘑鐮佹湁鏁�)</param>
-        /// <param name="successEvent">楠岃瘉鎴愬姛涔嬪悗鐨勫洖璋冨嚱鏁�,澶辫触涓嶄細鍥炶皟</param>
-        private void ShowAppNumPasswordSecurityForm(bool addTopFrame, Action successEvent)
+        /// <param name="successEvent">楠岃瘉鎴愬姛涔嬪悗鐨勫洖璋冨嚱鏁�,澶辫触涓嶄細鍥炶皟(0:娌℃湁璁剧疆鏈夐獙璇� 1:楠岃瘉鎴愬姛锛�</param>
+        private void ShowAppNumPasswordSecurityForm(bool addTopFrame, Action<int> successEvent)
         {
             var form = new AppNumPasswordSecurityForm();
             form.AddForm(addTopFrame, Language.StringByID(StringId.PlsEntryPassword), string.Empty);
@@ -136,13 +151,26 @@
                     //瀵嗙爜姝g‘
                     if (UserInfo.Current.appUnlockPasswrod == password)
                     {
+                        //娆℃暟杩樺師
+                        this.checkSecurityCount = 3;
+
                         form.CloseForm();
                         //鍥炶皟
-                        successEvent?.Invoke();
+                        successEvent?.Invoke(1);
                         successEvent = null;
                     }
                     else
                     {
+                        this.checkSecurityCount--;
+                        if (this.checkSecurityCount == 0)
+                        {
+                            //绠$悊鍛樿韩浠介獙璇佸け璐�,璇烽噸鏂扮櫥褰�
+                            HdlMessageLogic.Current.ShowMassage(ShowMsgType.Tip, Language.StringByID(StringId.CheckAdminFailAndLoginAgain));
+                            HDLCommon.Current.Logout();
+
+                            this.checkSecurityCount = 3;
+                            return;
+                        }
                         //楠岃瘉澶辫触锛屽瘑鐮侀敊璇�.
                         form.ShowErrorMsg(Language.StringByID(StringId.AuthenticationFailedPasswordError));
                     }
@@ -154,8 +182,8 @@
         /// 鏄剧ず鎵嬪娍瀵嗙爜瑙i攣璁よ瘉鐣岄潰
         /// </summary>
         /// <param name="addTopFrame">楠岃瘉鐣岄潰鏄惁娣诲姞澶撮儴Frame(鍙鎵嬪娍瀵嗙爜鍜屾暟瀛楀瘑鐮佹湁鏁�)</param>
-        /// <param name="successEvent">楠岃瘉鎴愬姛涔嬪悗鐨勫洖璋冨嚱鏁�,澶辫触涓嶄細鍥炶皟</param>
-        private void ShowAppGestureSecurityForm(bool addTopFrame, Action successEvent)
+        /// <param name="successEvent">楠岃瘉鎴愬姛涔嬪悗鐨勫洖璋冨嚱鏁�,澶辫触涓嶄細鍥炶皟(0:娌℃湁璁剧疆鏈夐獙璇� 1:楠岃瘉鎴愬姛锛�</param>
+        private void ShowAppGestureSecurityForm(bool addTopFrame, Action<int> successEvent)
         {
             var form = new AppGestureSecurityForm();
             form.AddForm(addTopFrame, Language.StringByID(StringId.VerifyGesturePassword), string.Empty);
@@ -168,13 +196,27 @@
                     //瀵嗙爜姝g‘
                     if (UserInfo.Current.appUnlockPasswrod == password)
                     {
+                        //娆℃暟杩樺師
+                        this.checkSecurityCount = 3;
+
                         form.CloseForm();
                         //鍥炶皟
-                        successEvent?.Invoke();
+                        successEvent?.Invoke(1);
                         successEvent = null;
                     }
                     else
                     {
+                        this.checkSecurityCount--;
+                        if (this.checkSecurityCount == 0)
+                        {
+                            //绠$悊鍛樿韩浠介獙璇佸け璐�,璇烽噸鏂扮櫥褰�
+                            HdlMessageLogic.Current.ShowMassage(ShowMsgType.Tip, Language.StringByID(StringId.CheckAdminFailAndLoginAgain));
+                            HDLCommon.Current.Logout();
+
+                            this.checkSecurityCount = 3;
+                            return;
+                        }
+
                         //楠岃瘉澶辫触锛屽瘑鐮侀敊璇�.
                         form.ShowErrorMsg(Language.StringByID(StringId.AuthenticationFailedPasswordError));
                     }

--
Gitblit v1.8.0