Эх сурвалжийг харах

用户缓存添加展示名称参数

Jeremy 1 жил өмнө
parent
commit
5f2c375070

+ 22 - 0
Interfaces/Cache/IUserInfoManager.cs

@@ -1,6 +1,7 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Text.RegularExpressions;
 using System.Threading.Tasks;
 
 namespace WingServerCommon.Interfaces.Cache
@@ -160,6 +161,27 @@ namespace WingServerCommon.Interfaces.Cache
         /// </summary>
         /// <value></value>
         public LoginLockInfo LoginLockInfo { get; set; }
+
+        /// <summary>
+        /// 统一名字展示字段
+        /// </summary>
+        /// <value></value>
+        public string DisplayName
+        {
+            get
+            {
+                var name = string.IsNullOrWhiteSpace(FullName) ? UserName : FullName;
+                if(Regex.IsMatch(name,"[0-9A-Z]{32}") && !string.IsNullOrWhiteSpace(Phone))
+                {
+                    name = Phone;
+                }
+                if(Regex.IsMatch(name,"[0-9A-Z]{32}") && !string.IsNullOrWhiteSpace(Email))
+                {
+                    name = Email;
+                }
+                return name;
+            }
+        }
     }
 
     /// <summary>