From 2aef482fa7431fb47eef94081ff23ec220f89820 Mon Sep 17 00:00:00 2001
From: hutongqing <hutongqing@hnkhzn.com>
Date: 星期五, 24 一月 2025 09:10:31 +0800
Subject: [PATCH] 1

---
 WIDESEAWCS_Server/WIDESEAWCS_Core/Middlewares/ApiLogMiddleware.cs |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/WIDESEAWCS_Server/WIDESEAWCS_Core/Middlewares/ApiLogMiddleware.cs b/WIDESEAWCS_Server/WIDESEAWCS_Core/Middlewares/ApiLogMiddleware.cs
index 37048b0..f599149 100644
--- a/WIDESEAWCS_Server/WIDESEAWCS_Core/Middlewares/ApiLogMiddleware.cs
+++ b/WIDESEAWCS_Server/WIDESEAWCS_Core/Middlewares/ApiLogMiddleware.cs
@@ -4,6 +4,7 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Net;
 using System.Text;
 using System.Text.RegularExpressions;
 using System.Threading.Tasks;
@@ -30,6 +31,21 @@
         //todo
         public async Task InvokeAsync(HttpContext context)
         {
+            if (App.ExpDateTime != null && (DateTime.Now - App.ExpDateTime.GetValueOrDefault()).TotalSeconds > 0)
+            {
+                context.Response.StatusCode = HttpStatusCode.InternalServerError.ObjToInt();
+                context.Response.ContentType = "application/json";
+
+                var json = new WebResponseContent();
+
+                json.Message = HttpStatusCode.InternalServerError.ToString();//閿欒淇℃伅
+                json.Code = 500;//500寮傚父 
+
+                StreamWriter streamWriter = new StreamWriter(context.Response.Body);
+                await streamWriter.WriteAsync(json.Serialize());
+                return;
+            }
+
             // 杩囨护锛屽彧鏈夋帴鍙�
             if (context.Request.Path.Value?.Contains("api") ?? false)
             {

--
Gitblit v1.9.3