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/ZigBee/Common/Config.cs |   92 ++++++++++++++++++++++++++++++++++-----------
 1 files changed, 69 insertions(+), 23 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/ZigBee/Common/Config.cs b/ZigbeeApp/Shared/Phone/ZigBee/Common/Config.cs
index 7c83759..d068161 100755
--- a/ZigbeeApp/Shared/Phone/ZigBee/Common/Config.cs
+++ b/ZigbeeApp/Shared/Phone/ZigBee/Common/Config.cs
@@ -6,8 +6,9 @@
     [System.Serializable]
     public class Config
     {
-        static readonly string fileName = "Config.json";
-        static Config config;
+        private const string fileName = "Config.json";
+
+        private static Config config = null;
         public static Config Instance
         {
             get
@@ -28,11 +29,11 @@
         /// <summary>
         /// 璐︽埛鐧诲綍鎴愬姛鏃剁殑鏃堕棿
         /// </summary>
-        public DateTime LoginDateTime = DateTime.MinValue;
+        public DateTime LoginDateTime = DateTime.MinValue;
         /// <summary>
-        /// Gets a value indicating whether this <see cref="T:Shared.Common.Config"/> is login.
+        /// 
         /// </summary>
-        /// <value><c>true</c> if is login; otherwise, <c>false</c>.</value>
+        [Newtonsoft.Json.JsonIgnore]
         public bool IsLogin
         {
             get
@@ -40,16 +41,6 @@
                 return (DateTime.Now - LoginDateTime).Days < 7;
             }
         }
-
-        /// <summary>
-        /// 璐︽埛鐧诲綍鎴愬姛鐨勮处鎴风被鍨�
-        /// </summary>
-        public int AccountType = 0;
-        /// <summary>
-        /// 璐︽埛鐧诲綍鎴愬姛鐨勪富ID
-        /// </summary>
-        public int MasterID = 0;
-
 
         public static void ReFresh()
         {
@@ -65,8 +56,18 @@
                 //瑙e瘑
                 config.Password = Phone.UserCenter.UserCenterLogic.DecryptPassword("hD1(La3o", config.PasswordEncrypt);
             }
+            if (config.Md5pwdEncrypt != string.Empty)
+            {
+                //瑙e瘑
+                config.MD5PWD = Phone.UserCenter.UserCenterLogic.DecryptPassword("hD1(La3o", config.Md5pwdEncrypt);
+            }
         }
 
+        /// <summary>
+        /// 璐︽埛鐧诲綍鎴愬姛鐨勮处鎴风被鍨�(姝ゅ彉閲忛粯璁や负0,骞朵笖涓嶈祴鍊�)
+        /// </summary>
+        [Newtonsoft.Json.JsonIgnore]
+        public int AccountType = 0;
         /// <summary>
         /// 褰撳墠鐧诲綍鐨勫笎鍙�
         /// </summary>
@@ -83,7 +84,12 @@
         /// <summary>
         /// 鐭俊鐧诲綍杩斿洖鐨刴d5鍚庣殑瀵嗙爜
         /// </summary>
+        [Newtonsoft.Json.JsonIgnore]
         public string MD5PWD = string.Empty;
+        /// <summary>
+        /// 鐭俊鐧诲綍杩斿洖鐨刴d5鍚庣殑鍔犲瘑瀵嗙爜
+        /// </summary>
+        public string Md5pwdEncrypt = string.Empty;
         /// <summary>
         /// 鐧婚檰璐﹀彿鐨凣uid
         /// </summary>
@@ -91,25 +97,37 @@
         /// <summary>
         /// 鎴愬憳璇锋眰鎺у埗涓诲笎鍙锋浣忓畢鏃惰姹傚熀鍦板潃
         /// </summary>
+        [Newtonsoft.Json.JsonIgnore]
         public string AdminRequestBaseUrl = string.Empty;
         /// <summary>
         /// 鎴愬憳璇锋眰鎺у埗涓诲笎鍙锋浣忓畢鏃惰姹傚熀鍦板潃鐨凩oginAccessToken鐨勫��
         /// </summary>
+        [Newtonsoft.Json.JsonIgnore]
         public string AdminRequestToken = string.Empty;
         /// <summary>
         /// 杩滅▼杩炴帴鐨凪qtt鐨勫鎴风ID
         /// </summary>
         [Newtonsoft.Json.JsonIgnore]
-        public string ConnEmqClientId = string.Empty;
-
-        [Newtonsoft.Json.JsonIgnore]
+        public string ConnEmqClientId = string.Empty;
+        /// <summary>
+        /// 褰撳墠鐧诲綍鐨勮处鍙锋槸涓嶆槸涔嬪墠鐨勮处鍙�
+        /// </summary>
+        [Newtonsoft.Json.JsonIgnore]
+        public bool TheSameLoginAccount = false;
+
         /// <summary>
         /// 褰撳墠甯愬彿鐨凾oken
         /// </summary>
+        [Newtonsoft.Json.JsonIgnore]
         public string Token
         {
             get
             {
+                if (Shared.Phone.UserCenter.HdlExperienceAccountLogic.Current.IsExperience == true)
+                {
+                    //浣撻獙璐﹀彿鐨凾oken
+                    return this.TokenExperience;
+                }
                 string md5Password;
                 if (string.IsNullOrEmpty(Password))
                 {
@@ -128,16 +146,43 @@
                 return Convert.ToBase64String(tokenBytes).Replace("=", "%3D");
             }
 
+        }
+
+        /// <summary>
+        /// 浣撻獙璐﹀彿鐨凾oken
+        /// </summary>
+        [Newtonsoft.Json.JsonIgnore]
+        private string m_TokenExperience = null;
+        [Newtonsoft.Json.JsonIgnore]
+        public string TokenExperience
+        {
+            get
+            {
+                if (m_TokenExperience != null) { return m_TokenExperience; }
+
+                var result = System.Text.Encoding.UTF8.GetBytes("123456");
+                var md5 = new System.Security.Cryptography.MD5CryptoServiceProvider();
+                var output = md5.ComputeHash(result);
+                var md5Password = BitConverter.ToString(output).Replace("-", "");
+                var account_md5Pssword = "ceyir277@163.com:" + md5Password;
+                var tokenBytes = System.Text.Encoding.UTF8.GetBytes(account_md5Pssword);
+                m_TokenExperience = Convert.ToBase64String(tokenBytes).Replace("=", "%3D");
+                return m_TokenExperience;
+            }
         }
 
         /// <summary>
-        /// 鐧诲綍鏃禩oken
+        /// 鐧诲綍鏃禩oken(鐩墠杩欎笢瑗挎病鐢�)
         /// </summary>
+        [Newtonsoft.Json.JsonIgnore]
         public string LoginToken = string.Empty;
 
-        public List<string> HomeFilePathList = new List<string> { };
-
         public string HomeId = string.Empty;
+
+        /// <summary>
+        /// 浣忓畢鏂囦欢鍒楄〃
+        /// </summary>
+        public List<string> HomeFilePathList = new List<string>();
 
         [Newtonsoft.Json.JsonIgnore]
         private House m_Home = null;
@@ -154,7 +199,7 @@
                 {
                     return m_Home;
                 }
-                m_Home = House.GetHouseByHouseId(HomeId);
+                m_Home = Phone.UserCenter.HdlResidenceLogic.Current.GetHouseByHouseId(HomeId);
                 if (m_Home == null)
                 {
                     m_Home = new House();
@@ -188,9 +233,10 @@
         {
             //鍔犲瘑,涓嶈兘淇濆瓨鏄庣爜
             this.PasswordEncrypt = Phone.UserCenter.UserCenterLogic.EncryptPassword("hD1(La3o", this.Password);
+            this.Md5pwdEncrypt = Phone.UserCenter.UserCenterLogic.EncryptPassword("hD1(La3o", this.MD5PWD);
+
             var bytes = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this));
             Shared.IO.FileUtils.WriteFileByBytes(fileName, bytes);
-            ReFresh();
         }
     }
 }

--
Gitblit v1.8.0