From 0d5d4a8c55b562090f1a1ac48cda7fcab943979b Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期三, 15 十月 2025 15:48:40 +0800
Subject: [PATCH] 更新二进制文件及新增异步POST方法
---
CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_Common/HttpClient/HttpsClient.cs | 36 ++++++++++++++++++++++++++++++++++++
1 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_Common/HttpClient/HttpsClient.cs b/CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_Common/HttpClient/HttpsClient.cs
index f1afa5f..4c93915 100644
--- a/CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_Common/HttpClient/HttpsClient.cs
+++ b/CodeManagement/WMS/WIDESEA_WMSServer/WIDESEA_Common/HttpClient/HttpsClient.cs
@@ -122,6 +122,42 @@
}
}
+ public static async Task<string> PostNotLimitAsync(string url, Dictionary<string, object> parameters)
+ {
+
+ // 璁板綍璇锋眰鍙傛暟
+ LogRequestParameters(parameters, url);
+
+ // 鍒涘缓HttpClient瀹炰緥
+ using (HttpClient client = new HttpClient())
+ {
+ // 灏嗗弬鏁拌浆鎹负FormUrlEncodedContent
+ string content = JsonConvert.SerializeObject(parameters);
+
+ //client.Timeout = TimeSpan.from;
+
+ var request = new HttpRequestMessage(HttpMethod.Post, url);
+
+ request.Content = new StringContent(content, Encoding.UTF8, "application/json");
+ //var content = new FormUrlEncodedContent(ConvertToKeyValuePairs(parameters));
+ //// 鍙戦�丳OST璇锋眰骞惰幏鍙栧搷搴�
+ //HttpResponseMessage response = await client.PostAsync(url, content);
+ HttpResponseMessage response = await client.SendAsync(request);
+
+ // 纭繚鍝嶅簲鎴愬姛
+ response.EnsureSuccessStatusCode();
+
+ // 璇诲彇鍝嶅簲鍐呭
+ string responseBody = await response.Content.ReadAsStringAsync();
+
+ // 璁板綍鍝嶅簲鍙傛暟
+ LogResponseParameters(responseBody, url);
+
+ // 杩斿洖鍝嶅簲鍐呭
+ return responseBody;
+ }
+ }
+
private static void LogRequestParameters(Dictionary<string, object> parameters, string url = "")
{
StringBuilder builder = new StringBuilder();
--
Gitblit v1.9.3