From 6af451b3d95627b745da9a9e334419b1b5d4ee4f Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期一, 30 三月 2026 11:53:07 +0800
Subject: [PATCH] fix(Dashboard): 添加错误处理,统一DateTime使用

---
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Http/HttpRequestHelper.cs |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Http/HttpRequestHelper.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Http/HttpRequestHelper.cs
index 74e4acf..62203ce 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Http/HttpRequestHelper.cs
+++ b/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 = "解析响应失败" };
         }
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3