From 695571c6009ecbc12e7d4a4fb147df7967a1260e Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期一, 07 七月 2025 20:21:19 +0800
Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/MeiRuiAn/HuaiAn
---
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Core/LogHelper/Logger.cs | 51 +++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 49 insertions(+), 2 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/LogHelper/Logger.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/LogHelper/Logger.cs"
index 3f5cc23..d833379 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/LogHelper/Logger.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/LogHelper/Logger.cs"
@@ -84,9 +84,9 @@
}
// row["Id"] = log.Id;
// 灏哛equestParam涓殑鎹㈣绗︽浛鎹负绌哄瓧绗︿覆
- row["RequestParam"] = log.RequestParam?.Replace("\r\n", "");
+ row["RequestParam"] = log.RequestParam?.Replace("\r\n", "").Replace("\n", "");
// 灏哛esponseParam涓殑鎹㈣绗︽浛鎹负绌哄瓧绗︿覆
- row["ResponseParam"] = log.ResponseParam?.Replace("\r\n", "");
+ row["ResponseParam"] = log.ResponseParam?.Replace("\r\n", "").Replace("\n", "");
//row["Success"] = log.Success ?? -1;
// 灏咮eginDate璁剧疆涓簂og鐨凚eginDate
row["BeginDate"] = log.BeginDate;
@@ -187,6 +187,53 @@
loggerQueueData.Enqueue(log);
}
+ public static void Add(string url, string requestParameter, string responseParameter, DateTime beginDate)
+ {
+ dynamic? log = null;
+ try
+ {
+ //鑾峰彇褰撳墠鐢ㄦ埛
+ IUser? user = App.User;
+ //鍒涘缓鏃ュ織瀵硅薄
+ log = new
+ {
+ //璇锋眰寮�濮嬫椂闂�
+ BeginDate = beginDate,
+ //璇锋眰缁撴潫鏃堕棿
+ EndDate = DateTime.Now,
+ //璇锋眰鍙傛暟
+ RequestParam = requestParameter,
+ //鍝嶅簲鍙傛暟
+ ResponseParam = responseParameter,
+ //璇锋眰URL
+ Url = url,
+ //瀹㈡埛绔疘P
+ UserIP = "",
+ //鐢ㄦ埛ID
+ UserId = user?.UserId,
+ //鐢ㄦ埛鍚�
+ UserName = user?.UserName
+ };
+ }
+ catch (Exception exception)
+ {
+ //濡傛灉鍙戠敓寮傚父锛屽垯鍒涘缓鏃ュ織瀵硅薄
+ log = log ?? new
+ {
+ //璇锋眰寮�濮嬫椂闂�
+ BeginDate = DateTime.Now,
+ //璇锋眰缁撴潫鏃堕棿
+ EndDate = DateTime.Now,
+ //璇锋眰鍙傛暟
+ RequestParam = requestParameter,
+ //鍝嶅簲鍙傛暟
+ ResponseParam = responseParameter,
+ };
+ }
+ //娣诲姞绯荤粺鏃ュ織
+ loggerQueueData.Enqueue(log);
+ }
+
public static string GetClientIP(HttpContext context)
{
// 鑾峰彇璇锋眰澶翠腑鐨刋-Forwarded-For瀛楁锛屽苟灏嗗叾杞崲涓哄瓧绗︿覆
--
Gitblit v1.9.3