From 0f8f6ad183a9595a82f3229029b16cbcf62bf8ff Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期五, 27 十一月 2020 13:35:31 +0800
Subject: [PATCH] 2020-11-27 1.更新
---
HDL_ON/Entity/UserInfo.cs | 146 ++++++++++++++++++++++++++++++++----------------
1 files changed, 98 insertions(+), 48 deletions(-)
diff --git a/HDL_ON/Entity/UserInfo.cs b/HDL_ON/Entity/UserInfo.cs
index 2ea0157..539297a 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>
@@ -17,10 +80,25 @@
/// 鐢ㄦ埛
/// </summary>
public string accountString = "";
- /// <summary>
- /// 鐢ㄦ埛瀵嗙爜
- /// </summary>
- public string password = "";
+ ///// <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");
+ // }
+ //}
/// <summary>
/// 鐢ㄦ埛鎵嬫満鍙风爜
/// </summary>
@@ -32,7 +110,7 @@
/// <summary>
/// 鐢ㄦ埛ID
/// </summary>
- public int ID;
+ public string ID;
/// <summary>
/// 鐢ㄦ埛閫夋嫨鏄剧ず鐨勮瑷�
/// </summary>
@@ -40,8 +118,7 @@
/// <summary>
/// 鐢ㄦ埛鍖哄煙
/// </summary>
- public int areaCode = 86;
-
+ public string areaCode = "86";
/// <summary>
/// 鐢ㄦ埛澶村儚鍥剧墖
/// </summary>
@@ -50,12 +127,10 @@
/// 鐢ㄦ埛澶村儚byte鏁版嵁
/// </summary>
public byte[] headImagePageBytes = null;
-
/// <summary>
/// 涓婁竴娆$櫥褰曟椂闂�
/// </summary>
public DateTime lastTime = DateTime.MinValue;
-
/// <summary>
/// 鏄惁鏄櫥褰曠姸鎬�
/// </summary>
@@ -66,24 +141,20 @@
return (DateTime.Now - lastTime).TotalDays < 7;
}
}
-
- public int accountType = 0;
-
- public int masterID = 0;
-
+ /// <summary>
+ ///
+ /// </summary>
public string loginTokenString;
- //{
- // get
- // {
- // var result = Encoding.UTF8.GetBytes(password);
- // var md5 = new System.Security.Cryptography.MD5CryptoServiceProvider();
- // var output = md5.ComputeHash(result);
- // var md5Password = BitConverter.ToString(output).Replace("-", "");
- // var account_md5Pssword = accountString + ":" + md5Password;
- // var tokenBytes = Encoding.UTF8.GetBytes(account_md5Pssword);
- // return Convert.ToBase64String(tokenBytes).Replace("=", "%3D");
- // }
- //}
+ /// <summary>
+ ///
+ /// </summary>
+ public string refreshToken;
+ /// <summary>
+ /// UserType B绔处鍙� C绔处鍙�
+ /// </summary>
+ public string userType = "USER_C";
+
+
/// <summary>
/// 鐢ㄦ埛浣忓畢鍒楄〃
/// </summary>
@@ -91,29 +162,8 @@
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)));
}
-
- /// <summary>
- /// 杞欢瑙i攣鐣岄潰
- /// 1:鍚姩鏃�
- /// 2:甯冮槻鎾ら槻鏃�
- /// 3:杩滅▼寮�閿佹椂
- /// </summary>
- public List<string> appUnlockPage = new List<string>();
- /// <summary>
- /// 杞欢瑙i攣鏂瑰紡
- /// 1:鏁板瓧瀵嗙爜
- /// 2:鎵嬪娍瀵嗙爜
- /// 3:鎸囩汗瀵嗙爜
- /// 4:闈㈠ID
- /// </summary>
- public List<string> appUnlockType = new List<string>();
- /// <summary>
- /// 杞欢瑙i攣瀵嗙爜
- /// </summary>
- //[Newtonsoft.Json.JsonIgnore]
- public string appUnlockPasswrod = "";
private byte[] convertByte(Image img)
--
Gitblit v1.8.0