From 25429f085093d89d543a0b90e30d0d62d1b7dac9 Mon Sep 17 00:00:00 2001
From: hxb <hxb@hdlchina.com.cn>
Date: 星期二, 30 八月 2022 09:37:38 +0800
Subject: [PATCH] 合并了IOS的代码

---
 ZigbeeApp/Shared/Phone/Login/Logic/AccountLogic.cs |  191 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 191 insertions(+), 0 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Login/Logic/AccountLogic.cs b/ZigbeeApp/Shared/Phone/Login/Logic/AccountLogic.cs
new file mode 100644
index 0000000..35cc3f0
--- /dev/null
+++ b/ZigbeeApp/Shared/Phone/Login/Logic/AccountLogic.cs
@@ -0,0 +1,191 @@
+锘縰sing System;
+using System.Text;
+using System.Text.RegularExpressions;
+using Shared.Common;
+
+namespace Shared.Phone.Login
+{
+    public class AccountLogic
+    {
+        #region 鈼� 鍙橀噺____________________________
+        /// <summary>
+        /// _instance
+        /// </summary>
+        private static AccountLogic _instance;
+        /// <summary>
+        /// Instance
+        /// </summary>
+        public static AccountLogic Instance
+        {
+            get
+            {
+                if(_instance==null)
+                {
+                    _instance = new AccountLogic();
+                }
+                return _instance;
+            }
+        }
+
+        #endregion
+
+        #region 鈼� 閭____________________________
+
+        /// <summary>
+        /// 妫�鏌ラ偖绠卞悎娉曟��
+        /// </summary>
+        /// <param name="email"></param>
+        /// <returns></returns>
+        public bool CheckEmail(string email)
+        {
+            var regex= new  Regex(CommonPage.EmailRegexStr);
+            return regex.IsMatch(email);
+        }
+
+
+
+        #endregion
+
+        #region 鈼� 鎵嬫満____________________________
+
+        /// <summary>
+        /// 妫�鏌ユ墜鏈哄彿鍚堟硶鎬�
+        /// </summary>
+        /// <param name="phone"></param>
+        /// <returns></returns>
+        public bool CheckPhone(string phone)
+        {
+            var regex = new Regex(CommonPage.PhoneForForeignRegexStr);
+            return regex.IsMatch(phone);
+        }
+
+        /// <summary>
+        /// 妫�鏌ユ墜鏈哄彿鍚堟硶鎬с�佸尯鍒嗗尯鍙�
+        /// </summary>
+        /// <param name="phone">鎵嬫満鍙�</param>
+        /// <param name="zoneCode">鍖哄彿</param>
+        /// <returns></returns>
+        public bool CheckPhoneWithZone(string phone, string zoneCode)
+        {
+            if (zoneCode == "86")
+            {
+                var regex = new Regex(CommonPage.PhoneRegexStr);
+                return regex.IsMatch(phone);
+            }
+            else
+            {
+                var regex = new Regex(CommonPage.PhoneForForeignRegexStr);
+                return regex.IsMatch(phone);
+            }
+        }
+
+        #endregion
+
+        #region 鈼� 瀵嗙爜____________________________
+
+        /// <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 鈼� 缁忕含搴_________________________
+        /// <summary>
+        /// ReceiveAppLatAndLon
+        /// </summary>
+        /// <param name="lat"></param>
+        /// <param name="lon"></param>
+        public async void ReceiveAppLatAndLon(string lon, string lat)
+        {
+            try
+            {
+                var requestObj = new SendDataToServer.ReceiveAppLatAndLonObj
+                {
+                    Longitude = lon,
+                    Latitude = lat
+                };
+                var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(requestObj);
+                var revertObj = RequestHttpsZigbeeAsync("ProcessRange/ReceiveAppLatAndLon", System.Text.Encoding.UTF8.GetBytes(requestJson));
+
+                if (UserCenter.UserCenterResourse.HideOption.WriteGpsPoint == 1)
+                {
+                    string flage = revertObj == null ? "false" : revertObj.StateCode;
+                    string txtvalue = "lon:" + lon + " lat:" + lat + " " + flage;
+                    HdlMessageLogic.Current.ShowMassage(ShowMsgType.Tip, txtvalue);
+                    UserCenter.HdlLogLogic.Current.WriteLog(-1, "缁忕含搴︿笂鎶�  " + txtvalue);
+                }
+            }
+            catch { }
+        }
+
+        /// <summary>
+        /// 璇锋眰鏈嶅姟鍣ㄦ柟娉�
+        /// 鎸囧畾涓�涓猆rl,鍜岃姹傛柟娉曪紝鏁版嵁锛孋ookie锛屽緱鍒板搷搴旂殑鏁版嵁
+        /// </summary>
+        /// <param name="requestUrl">璇锋眰Url</param>
+        /// <param name="byteData">璇锋眰鐨勭殑鏁版嵁</param>
+        /// <returns>寰楀埌鍝嶅簲鐨勬暟鎹�</returns>
+        public Shared.Common.ResponseEntity.ResponsePack RequestHttpsZigbeeAsync(string requestUrl, byte[] byteData)
+        {
+            string result = RequestHttpsZigbeeResultAsync(requestUrl, byteData);
+            if (result != null)
+            {
+                try
+                {
+                    var data = Newtonsoft.Json.JsonConvert.DeserializeObject<Shared.Common.ResponseEntity.ResponsePack>(result);
+                    return data;
+                }
+                catch (Exception ex)
+                {
+                    System.Console.WriteLine(ex.Message);
+                }
+            }
+            return null;
+        }
+
+        /// <summary>
+        /// 璇锋眰鏈嶅姟鍣ㄦ柟娉�
+        /// 鎸囧畾涓�涓猆rl,鍜岃姹傛柟娉曪紝鏁版嵁锛孋ookie锛屽緱鍒板搷搴旂殑鏁版嵁
+        /// </summary>
+        /// <param name="requestUrl">璇锋眰Url</param>
+        /// <param name="byteData">璇锋眰鐨勭殑鏁版嵁</param>
+        /// <returns>寰楀埌鍝嶅簲鐨勬暟鎹�</returns>
+        public string RequestHttpsZigbeeResultAsync(string requestUrl, byte[] byteData)
+        {
+            var result = RequestHttpsZigbeeBytesResultAsync(requestUrl, byteData);
+            if (result != null)
+            {
+                return Encoding.UTF8.GetString(result);
+            }
+            return null;
+        }
+
+        /// <summary>
+        /// 璇锋眰鏈嶅姟鍣ㄦ柟娉�
+        /// 鎸囧畾涓�涓猆rl,鍜岃姹傛柟娉曪紝鏁版嵁锛孋ookie锛屽緱鍒板搷搴旂殑鏁版嵁
+        /// </summary>
+        /// <param name="requestUrl">璇锋眰Url</param>
+        /// <param name="byteData">璇锋眰鐨勭殑鏁版嵁</param>
+        /// <param name="requestMethod">POST 鎴栬�� GET 绛夌瓑</param>
+        /// <returns>寰楀埌鍝嶅簲鐨勬暟鎹�</returns>
+        public byte[] RequestHttpsZigbeeBytesResultAsync(string requestUrl, byte[] byteData, string requestMethod = "POST")
+        {
+            //璇锋眰Url鐨勫畬鎴愯矾寰�
+            var requestHost = "https://global.hdlcontrol.com/GeofenceService";
+            var fullUrl = $"{requestHost}/{requestUrl}";
+            return CommonPage.Instance.DoRequestZigbeeHttpsInterface(fullUrl, byteData, Config.Instance.Token, requestMethod);
+        }
+
+        #endregion
+    }
+}

--
Gitblit v1.8.0