123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- 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 = 400,
- 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);
- }
- }
- }
|