From c8253bb0831c66ce8df139d5568f87639667286d Mon Sep 17 00:00:00 2001 From: liguoyang Date: Sat, 13 Apr 2024 09:31:22 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8Dresponse=E5=86=99?= =?UTF-8?q?=E5=85=A5=E9=97=AE=E9=A2=98,=E7=A6=81=E7=94=A8=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E5=AF=BC=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Device/Services/Implements/DeviceService.cs | 2 ++ .../Organization/Filters/IgnoreDataCaseAttribute.cs | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Src/Dlhis.Basic/Device/Services/Implements/DeviceService.cs b/Src/Dlhis.Basic/Device/Services/Implements/DeviceService.cs index 176ed5b7..c75a2f15 100644 --- a/Src/Dlhis.Basic/Device/Services/Implements/DeviceService.cs +++ b/Src/Dlhis.Basic/Device/Services/Implements/DeviceService.cs @@ -139,6 +139,8 @@ public class DeviceService : IDeviceService /// public async Task> BulkUploadsAsync(ImportListRequest request) { + true.ThrowIfTrue("设备导入功能暂时停用."); + var errs = new List(); var lst = request.Imports; var places = await _dbContext.Queryable().ToListAsync(); diff --git a/Src/Dlhis.Basic/Organization/Filters/IgnoreDataCaseAttribute.cs b/Src/Dlhis.Basic/Organization/Filters/IgnoreDataCaseAttribute.cs index a86442cf..620e0843 100644 --- a/Src/Dlhis.Basic/Organization/Filters/IgnoreDataCaseAttribute.cs +++ b/Src/Dlhis.Basic/Organization/Filters/IgnoreDataCaseAttribute.cs @@ -7,6 +7,9 @@ using Newtonsoft.Json; namespace Dlhis.Basic.Organization.Filters; +/// +/// 忽略响应.Data的自动camelCase +/// [AttributeUsage(AttributeTargets.Method)] public class IgnoreDataCaseAttribute : Attribute, IAsyncResultFilter { @@ -29,6 +32,7 @@ public class IgnoreDataCaseAttribute : Attribute, IAsyncResultFilter var json = JsonConvert.SerializeObject(body); var bytes = Encoding.UTF8.GetBytes(json); + context.HttpContext.Response.StatusCode = 200; context.HttpContext.Response.ContentType = "application/json"; context.HttpContext.Response.ContentLength = bytes.Length; await context.HttpContext.Response.BodyWriter.WriteAsync(bytes); @@ -36,6 +40,7 @@ public class IgnoreDataCaseAttribute : Attribute, IAsyncResultFilter } } - await next(); + //eg:过滤器直接响应结果,此处进行短路 + //await next(); } }