From d1dc6aaa453c38c6282930d85c58388b89aac065 Mon Sep 17 00:00:00 2001 From: 啊鑫 <t2856754968@163.com> Date: 星期五, 29 八月 2025 14:28:28 +0800 Subject: [PATCH] 111 --- MES.Service/Dto/webApi/RealTimeInventory/HttpClientEx.cs | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/MES.Service/Dto/webApi/RealTimeInventory/HttpClientEx.cs b/MES.Service/Dto/webApi/RealTimeInventory/HttpClientEx.cs index 2ac48c6..e7311a2 100644 --- a/MES.Service/Dto/webApi/RealTimeInventory/HttpClientEx.cs +++ b/MES.Service/Dto/webApi/RealTimeInventory/HttpClientEx.cs @@ -4,25 +4,25 @@ namespace MES.Service.Dto.webApi.RealTimeInventory; -public +public // HTTP瀹㈡埛绔被锛岀敤浜庡彂閫佽姹傚拰鑾峰彇鍝嶅簲 class HttpClientEx { + private static readonly CookieContainer Cookie = new(); public string Url { get; set; } public string Content { get; set; } - static CookieContainer Cookie = new CookieContainer(); public string AsyncRequest() { - HttpWebRequest httpRequest = HttpWebRequest.Create(Url) as HttpWebRequest; + var httpRequest = HttpWebRequest.Create(Url) as HttpWebRequest; httpRequest.Method = "POST"; httpRequest.ContentType = "application/json"; httpRequest.CookieContainer = Cookie; httpRequest.Timeout = 1000 * 60 * 10; // 10鍒嗛挓瓒呮椂 - using (Stream reqStream = httpRequest.GetRequestStream()) + using (var reqStream = httpRequest.GetRequestStream()) { - JObject jObj = new JObject + var jObj = new JObject { { "format", 1 }, { "useragent", "ApiClient" }, @@ -32,7 +32,7 @@ { "v", "1.0" } }; - string sContent = jObj.ToString(); + var sContent = jObj.ToString(); var bytes = UnicodeEncoding.UTF8.GetBytes(sContent); reqStream.Write(bytes, 0, bytes.Length); reqStream.Flush(); @@ -46,4 +46,4 @@ } } } -} +} \ No newline at end of file -- Gitblit v1.9.3