From d317a290c03d4c40687fcd01efc6c22304874e87 Mon Sep 17 00:00:00 2001 From: sunpengfei <i@angelzzz.com> Date: 星期五, 05 九月 2025 10:24:24 +0800 Subject: [PATCH] feat:开发 --- 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