From c8b6903d85e7ceef504a198b4bdfc6b72a73fe19 Mon Sep 17 00:00:00 2001
From: sunpengfei <i@angelzzz.com>
Date: 星期五, 08 八月 2025 13:29:47 +0800
Subject: [PATCH] fix:bug

---
 FlexJobApi.Core/Utils/XmlDocUtils/XmlDocUtils.cs |   40 ++++++++++++++++++++++------------------
 1 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/FlexJobApi.Core/Utils/XmlDocUtils/XmlDocUtils.cs b/FlexJobApi.Core/Utils/XmlDocUtils/XmlDocUtils.cs
index bddb8ce..146d576 100644
--- a/FlexJobApi.Core/Utils/XmlDocUtils/XmlDocUtils.cs
+++ b/FlexJobApi.Core/Utils/XmlDocUtils/XmlDocUtils.cs
@@ -24,6 +24,8 @@
     {
         private const string cacheKey = "XmlDoc";
 
+        public static XmlDoc XmlDoc { get; set; }
+
         /// <summary>
         /// 鐢熸垚娉ㄩ噴鏂囨。
         /// </summary>
@@ -75,6 +77,8 @@
                 }
             }
 
+            XmlDoc = xmlDoc;
+
             if (xmlDoc.Members.Any())
             {
                 var json = JsonConvert.SerializeObject(xmlDoc);
@@ -90,17 +94,19 @@
         /// <returns></returns>
         public static async Task<XmlDoc> GetXmlDocAsync()
         {
-            XmlDoc xmlDoc = null;
-            var json = await App.GetService<IDistributedCache>().GetStringAsync(cacheKey);
-            if (!string.IsNullOrEmpty(json))
+            if (XmlDoc == null)
             {
-                xmlDoc = JsonConvert.DeserializeObject<XmlDoc>(json);
+                var json = await App.GetService<IDistributedCache>().GetStringAsync(cacheKey);
+                if (!string.IsNullOrEmpty(json))
+                {
+                    XmlDoc = JsonConvert.DeserializeObject<XmlDoc>(json);
+                }
+                if (XmlDoc == null)
+                {
+                    XmlDoc = await BuildXmlDocAsync();
+                }
             }
-            if (xmlDoc == null)
-            {
-                xmlDoc = await BuildXmlDocAsync();
-            }
-            return xmlDoc;
+            return XmlDoc;
         }
 
         /// <summary>
@@ -113,15 +119,7 @@
         {
             if (xmlDoc == null)
             {
-                var json = await App.GetService<IDistributedCache>().GetStringAsync(cacheKey);
-                if (!string.IsNullOrEmpty(json))
-                {
-                    xmlDoc = JsonConvert.DeserializeObject<XmlDoc>(json);
-                }
-            }
-            if (xmlDoc == null)
-            {
-                xmlDoc = await BuildXmlDocAsync();
+                xmlDoc = await GetXmlDocAsync();
             }
             if (xmlDoc != null && memberInfo != null)
             {
@@ -131,6 +129,12 @@
             return null;
         }
 
+        public static async Task<string> GetSummary(this MemberInfo memberInfo, XmlDoc xmlDoc = null)
+        {
+            var memberXmlDoc = await memberInfo.GetXmlDocMemberAsync(xmlDoc);
+            return memberXmlDoc?.Summary;
+        }
+
         private static string GetXmlDocMemberName(MemberInfo memberInfo)
         {
             if (memberInfo != null)

--
Gitblit v1.9.1