wanshenmean
2026-03-18 5c766d7e5c969b7530a014ded771973e242f25e0
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Http/HttpRequestHelper.cs
@@ -1,5 +1,6 @@
using SqlSugar;
using System.Text;
using System.Text.Json;
using WIDESEAWCS_Code;
using WIDESEAWCS_Core.Helper;
@@ -166,17 +167,29 @@
        /// <summary>
        /// 按配置分类发送GET请求
        /// </summary>
        public static Task<string> HTTPGetAsync(string category, string? requestContent, string? configKey, int timeOut = 60)
        public static async Task<WebResponseContent> HTTPGetAsync(string category, string? requestContent, string? configKey, int timeOut = 60)
        {
            return SendAsync(requestContent, HttpMethod.Get, category, configKey, "application/json", timeOut);
            if (string.IsNullOrWhiteSpace(category) || string.IsNullOrWhiteSpace(requestContent) || string.IsNullOrWhiteSpace(configKey))
            {
                throw new ArgumentException("传入配置不能为空", nameof(category));
            }
            WebResponseContent content = new WebResponseContent();
            string result = await SendAsync(requestContent, HttpMethod.Get, category, configKey, "application/json", timeOut);
            return content = JsonSerializer.Deserialize<WebResponseContent>(result) ?? new WebResponseContent { Status = false, Message = "解析响应失败" };
        }
        /// <summary>
        /// 按配置分类发送POST请求
        /// </summary>
        public static Task<string> HTTPPostAsync(string category, string? requestContent, string? configKey, int timeOut = 60)
        public static async Task<WebResponseContent> HTTPPostAsync(string category, string? requestContent, string? configKey, int timeOut = 60)
        {
            return SendAsync(requestContent, HttpMethod.Post, category, configKey, "application/json", timeOut);
            if (string.IsNullOrWhiteSpace(category) || string.IsNullOrWhiteSpace(requestContent) || string.IsNullOrWhiteSpace(configKey))
            {
                throw new ArgumentException("传入配置不能为空", nameof(category));
            }
            WebResponseContent content = new WebResponseContent();
            string result = await SendAsync(requestContent, HttpMethod.Post, category, configKey, "application/json", timeOut);
            return content = JsonSerializer.Deserialize<WebResponseContent>(result) ?? new WebResponseContent { Status = false, Message = "解析响应失败" };
        }
    }
}