|
@@ -0,0 +1,50 @@
|
|
|
+using NetTaste;
|
|
|
+using System.Text.Encodings.Web;
|
|
|
+using System.Text.Json;
|
|
|
+using System.Text.Unicode;
|
|
|
+
|
|
|
+namespace OASystem.API.Middlewares
|
|
|
+{
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public class FixedPromptMiddleware
|
|
|
+ {
|
|
|
+ private readonly RequestDelegate _next;
|
|
|
+
|
|
|
+ public FixedPromptMiddleware(RequestDelegate next)
|
|
|
+ {
|
|
|
+ _next = next;
|
|
|
+ }
|
|
|
+
|
|
|
+ public async Task InvokeAsync(HttpContext context)
|
|
|
+ {
|
|
|
+
|
|
|
+ if (context.Request.Path.StartsWithSegments("/api"))
|
|
|
+ {
|
|
|
+
|
|
|
+ context.Response.ContentType = "text/plain";
|
|
|
+
|
|
|
+
|
|
|
+ var response = new JsonView()
|
|
|
+ {
|
|
|
+ Code = 204,
|
|
|
+ Msg = "紧急通知:因明年接入AI接口,需服务器框架升级及数据库数据备份,OA系统pc端及手机端将暂停使用,我们尽量在48小时内升级完成并恢复使用。"
|
|
|
+
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+ await context.Response.WriteAsync(System.Text.Json.JsonSerializer.Serialize(response,new JsonSerializerOptions
|
|
|
+ {
|
|
|
+ Encoder = JavaScriptEncoder.Create(UnicodeRanges.All)
|
|
|
+ }));
|
|
|
+
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ await _next(context);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|