From f8d23dcf8d6501482db1a5180325194232afe96c Mon Sep 17 00:00:00 2001 From: kazelee <1847801760@qq.com> Date: 星期五, 18 七月 2025 17:30:09 +0800 Subject: [PATCH] 封装部分业务代码,继续优化日志打印流程 --- util/HttpHelper.cs | 9 ++------- 1 files changed, 2 insertions(+), 7 deletions(-) diff --git a/util/HttpHelper.cs b/util/HttpHelper.cs index d509893..6efe80a 100644 --- a/util/HttpHelper.cs +++ b/util/HttpHelper.cs @@ -9,7 +9,7 @@ public class HttpHelper { public string WebPost(string url, string postData, string cotentType = "application/json") { - Console.WriteLine(url); + LogHelper.Info($"WebPost:璁块棶:{url}", "API"); WebRequest request = WebRequest.Create(url); request.Method = "POST"; //string postData = JsonConvert.SerializeObject(data); ; @@ -35,7 +35,7 @@ } catch (Exception e) { - LogHelper.Info($"WebPost res={e.Message}", "API"); + LogHelper.Info($"WebPost:寮傚父:{e.Message}\n\n{e.StackTrace}\n", "API"); return ""; } finally @@ -84,7 +84,6 @@ Stream stream = null; WebResponse rsp = null; try { - rsp = request.GetResponse(); stream = rsp.GetResponseStream(); reader = new StreamReader(stream); @@ -101,7 +100,6 @@ if (stream != null) stream.Close(); if (rsp != null) rsp.Close(); } - } public string Post(string url, string postData, string contentType = "application/json", string sessionId = "") { @@ -137,7 +135,6 @@ if (stream != null) stream.Close(); if (rsp != null) rsp.Close(); } - } public string Post(string url, Dictionary<string, string> dic) { @@ -173,7 +170,6 @@ } catch (Exception e) { - LogHelper.Info($"PostWithCookie res={e.Message}", "API"); return ""; } @@ -183,7 +179,6 @@ if (stream != null) stream.Close(); if (rsp != null) rsp.Close(); } - } public string Put(string url, string postData, string contentType = "application/json", string sessionId = "") -- Gitblit v1.9.1