From 0f2e0147e8990e913d16d99bc1b94fb6bc53abd7 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期四, 03 十二月 2020 15:35:42 +0800 Subject: [PATCH] 2020-12-03-1 --- HDL_ON/Entity/UserInfo.cs | 113 ++++++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 88 insertions(+), 25 deletions(-) diff --git a/HDL_ON/Entity/UserInfo.cs b/HDL_ON/Entity/UserInfo.cs index 70800be..9465064 100644 --- a/HDL_ON/Entity/UserInfo.cs +++ b/HDL_ON/Entity/UserInfo.cs @@ -3,12 +3,75 @@ using System.Text; using System.IO; using System.Drawing; +using HDL_ON.DAL; +using HDL_ON.DAL.Server; namespace HDL_ON { [System.Serializable] public class UserInfo { + public static readonly string ConfigFile = "UserInfo_File"; + /// <summary> + /// 閫氱敤鏂规硶 + /// </summary> + private static UserInfo m_Current = null; + /// <summary> + /// 閫氱敤鏂规硶 + /// </summary> + public static UserInfo Current + { + get + { + if (m_Current == null) + { + try + { + UserInfo temp = Newtonsoft.Json.JsonConvert.DeserializeObject<UserInfo>(System.Text.Encoding.UTF8.GetString(FileUtils.ReadFile(ConfigFile))); + if (temp == null) + { + m_Current = new UserInfo() { }; + Utlis.WriteLine("UserInfo null"); + } + else + { + m_Current = temp; + Utlis.WriteLine("UserInfo Current"); + } + } + catch + { + m_Current = new UserInfo() { }; + Utlis.WriteLine("UserInfo null"); + } + } + return m_Current; + } + } + + #region 鏂板淇濆瓨鍙傛暟 + /// <summary> + /// 璐﹀彿娉ㄥ唽鏈嶅姟鍣ㄤ俊鎭� + /// </summary> + public string RequestHttpsHost = "https://china.hdlcontrol.com"; + /// <summary> + /// + /// </summary> + public GlobalRegionListRes GlobalRegion; + + /// <summary> + /// 鏄惁鍚屾剰鍗忚 + /// </summary> + public bool isAgreePrivacyPolicy; + + /// <summary> + /// 蹇界暐鏇存柊鐨勭増鏈彿 + /// </summary> + public string IgnoreUpdateVersion = string.Empty; + #endregion + + + /// <summary> /// 鐢ㄦ埛鍚嶇О /// </summary> @@ -16,26 +79,26 @@ /// <summary> /// 鐢ㄦ埛 /// </summary> - public string accountString = ""; + public string AccountString = ""; ///// <summary> ///// 鐢ㄦ埛瀵嗙爜 ///// </summary> - //public string Password = ""; - string aesPassword = ""; - /// <summary> - /// 鐢ㄦ埛瀵嗙爜 - /// </summary> - public string password - { - get - { - return Shared.Securitys.EncryptionService.AesDecryptTopic(aesPassword, "85521566HDLONPRO"); - } - set - { - aesPassword = Shared.Securitys.EncryptionService.AesEncryptTopic(value, "85521566HDLONPRO"); - } - } + //public string password = ""; + //string aesPassword = ""; + ///// <summary> + ///// 鐢ㄦ埛瀵嗙爜 + ///// </summary> + //public string password + //{ + // get + // { + // return Shared.Securitys.EncryptionService.AesDecryptTopic(aesPassword, "85521566HDLONPRO"); + // } + // set + // { + // aesPassword = Shared.Securitys.EncryptionService.AesEncryptTopic(value, "85521566HDLONPRO"); + // } + //} /// <summary> /// 鐢ㄦ埛鎵嬫満鍙风爜 /// </summary> @@ -55,7 +118,7 @@ /// <summary> /// 鐢ㄦ埛鍖哄煙 /// </summary> - public int areaCode = 86; + public string areaCode = "86"; /// <summary> /// 鐢ㄦ埛澶村儚鍥剧墖 /// </summary> @@ -67,7 +130,7 @@ /// <summary> /// 涓婁竴娆$櫥褰曟椂闂� /// </summary> - public DateTime lastTime = DateTime.MinValue; + public DateTime LastTime = DateTime.MinValue; /// <summary> /// 鏄惁鏄櫥褰曠姸鎬� /// </summary> @@ -75,22 +138,22 @@ { get { - return (DateTime.Now - lastTime).TotalDays < 7; + return (DateTime.Now - LastTime).TotalDays < 7; } } /// <summary> /// /// </summary> - public string loginTokenString; + public string LoginTokenString; /// <summary> /// /// </summary> - public string refreshToken; + public string RefreshToken; /// <summary> /// UserType B绔处鍙� C绔处鍙� /// </summary> - public string userType = "C"; - + public string userType = "USER_C"; + /// <summary> /// 鐢ㄦ埛浣忓畢鍒楄〃 @@ -99,7 +162,7 @@ public void SaveUserInfo() { - FileUtils.WriteFileByBytes("UserInfo_File", Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this))); + FileUtils.WriteFileByBytes(ConfigFile, Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this))); } -- Gitblit v1.8.0