From 7f162ab11684a2afddd2773c476b8df0248c6849 Mon Sep 17 00:00:00 2001
From: sunpengfei <i@angelzzz.com>
Date: 星期五, 01 八月 2025 15:54:32 +0800
Subject: [PATCH] feat:文档开发

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

diff --git a/FlexJobApi.Core/Utils/XmlDocUtils/XmlDocUtils.cs b/FlexJobApi.Core/Utils/XmlDocUtils/XmlDocUtils.cs
index bddb8ce..ea7cf5f 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)
             {

--
Gitblit v1.9.1