feat: 前端表格高级筛选 (#100)

* chore: 🔨 css 基础单位

[skip ci]

* fix: 🐛 ca2263 System.Enum.GetValues<TEnum>()

[skip ci]

* feat:  前端表格高级筛选

[skip ci]
This commit is contained in:
2024-04-22 21:16:53 +08:00
committed by GitHub
parent 1dc953a2b2
commit 3847d6fdbb
175 changed files with 1901 additions and 630 deletions

View File

@ -0,0 +1,44 @@
namespace NetAdmin.Host.Middlewares;
/// <summary>
/// 安全停机中间件
/// </summary>
/// <remarks>
/// 放在所有中间件最前面
/// </remarks>
public sealed class SafetyShopHostMiddleware(RequestDelegate next)
{
private static long _connections;
private static bool _hostStopping;
/// <summary>
/// 当前连接数
/// </summary>
public static long Connections => Interlocked.Read(ref _connections);
/// <summary>
/// 停机处理
/// </summary>
public static void OnStopping()
{
Volatile.Write(ref _hostStopping, true);
while (Interlocked.Read(ref _connections) > 0) {
Thread.Sleep(10);
}
}
/// <summary>
/// 主函数
/// </summary>
public async Task InvokeAsync(HttpContext context)
{
if (Volatile.Read(ref _hostStopping)) {
context.Response.StatusCode = (int)HttpStatusCode.ServiceUnavailable;
return;
}
_ = Interlocked.Increment(ref _connections);
await next(context).ConfigureAwait(false);
_ = Interlocked.Decrement(ref _connections);
}
}