From 72c0f86c75c8a9a5eb7435d72b6ebece4c5382e8 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期二, 14 四月 2026 18:21:27 +0800
Subject: [PATCH] feat: 添加vue3-json-viewer并优化日志显示
---
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/BaseRepository/UnitOfWorks/UnitOfWorkManage.cs | 25 ++++++++++++-------------
1 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/BaseRepository/UnitOfWorks/UnitOfWorkManage.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/BaseRepository/UnitOfWorks/UnitOfWorkManage.cs
index e046f58..e6f58d7 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/BaseRepository/UnitOfWorks/UnitOfWorkManage.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/BaseRepository/UnitOfWorks/UnitOfWorkManage.cs
@@ -1,12 +1,7 @@
锘縰sing Microsoft.Extensions.Logging;
using SqlSugar;
-using System;
using System.Collections.Concurrent;
-using System.Collections.Generic;
-using System.Linq;
using System.Reflection;
-using System.Text;
-using System.Threading.Tasks;
using WIDESEAWCS_Core.Helper;
namespace WIDESEAWCS_Core.BaseRepository
@@ -15,13 +10,16 @@
{
// 瀹氫箟鏃ュ織璁板綍鍣�
private readonly ILogger<UnitOfWorkManage> _logger;
+
// 瀹氫箟SqlSugarClient
private readonly ISqlSugarClient _sqlSugarClient;
// 瀹氫箟浜嬪姟璁℃暟鍣�
private int _tranCount { get; set; }
+
// 瀹氫箟浜嬪姟璁℃暟鍣ㄧ殑鍙灞炴��
public int TranCount => _tranCount;
+
// 瀹氫箟浜嬪姟鏍�
public readonly ConcurrentStack<string> TranStack = new();
@@ -43,7 +41,6 @@
return _sqlSugarClient as SqlSugarClient;
}
-
// 鍒涘缓UnitOfWork
public UnitOfWork CreateUnitOfWork()
{
@@ -55,7 +52,7 @@
uow.Db.Open();
uow.Tenant.BeginTran();
-
+
_logger.LogDebug("UnitOfWork Begin");
return uow;
}
@@ -100,7 +97,7 @@
}
return content;
}
- catch(Exception ex)
+ catch (Exception ex)
{
RollbackTran();
return WebResponseContent.Instance.Error(ex.Message);
@@ -135,11 +132,11 @@
lock (this)
{
string result = "";
+ var spinner = new SpinWait();
while (!TranStack.IsEmpty && !TranStack.TryPeek(out result))
{
- Thread.Sleep(1);
+ spinner.SpinOnce();
}
-
if (result == method.GetFullName())
{
@@ -158,9 +155,10 @@
}
finally
{
+ var spinner2 = new SpinWait();
while (!TranStack.TryPop(out _))
{
- Thread.Sleep(1);
+ spinner2.SpinOnce();
}
_tranCount = TranStack.Count;
@@ -185,9 +183,10 @@
lock (this)
{
string result = "";
+ var spinner = new SpinWait();
while (!TranStack.IsEmpty && !TranStack.TryPeek(out result))
{
- Thread.Sleep(1);
+ spinner.SpinOnce();
}
if (result == method.GetFullName())
@@ -205,4 +204,4 @@
}
}
}
-}
+}
\ No newline at end of file
--
Gitblit v1.9.3