From b23844a9f56182bf47a0e32c0d6f05d55a8c2b27 Mon Sep 17 00:00:00 2001 From: admin Date: Tue, 19 Jan 2021 11:49:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=BF=94=E5=9B=9E=E5=AF=B9?= =?UTF-8?q?=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NX.ERP.WebAPi/Filters/ExceptionFilter.cs | 4 ++-- NX.ERP.WebAPi/ResultModel.cs | 11 ++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/NX.ERP.WebAPi/Filters/ExceptionFilter.cs b/NX.ERP.WebAPi/Filters/ExceptionFilter.cs index 6ce227d..78787dc 100644 --- a/NX.ERP.WebAPi/Filters/ExceptionFilter.cs +++ b/NX.ERP.WebAPi/Filters/ExceptionFilter.cs @@ -18,8 +18,8 @@ namespace NX.ERP.WebAPi.Filters var ex = actionExecutedContext.Exception; actionExecutedContext.Response = new System.Net.Http.HttpResponseMessage(); - actionExecutedContext.Response.Content = new System.Net.Http.ObjectContent(typeof(ResultModel), - new ResultModel { ErrCode = 500, ErrMsg = ex.Message, Data = null }, + actionExecutedContext.Response.Content = new System.Net.Http.ObjectContent(typeof(ResultModel), + new ResultModel { ErrCode = 500, ErrMsg = ex.Message }, GlobalConfiguration.Configuration.Formatters.JsonFormatter); return Task.FromResult(0); diff --git a/NX.ERP.WebAPi/ResultModel.cs b/NX.ERP.WebAPi/ResultModel.cs index 20596e7..d95b83f 100644 --- a/NX.ERP.WebAPi/ResultModel.cs +++ b/NX.ERP.WebAPi/ResultModel.cs @@ -5,10 +5,19 @@ using System.Web; namespace NX.ERP.WebAPi { - public class ResultModel + + + public class ResultModel { + public int ErrCode { get; set; } public string ErrMsg { get; set; } = ""; + } + + + public class ResultModel : ResultModel + { + public T Data { get; set; } } } \ No newline at end of file