fix vali middleware
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace COMCMS.Web.Common
|
||||
{
|
||||
public static class JsonExtension
|
||||
{
|
||||
public static string ToJson<TEntity>(this TEntity entity) where TEntity : class
|
||||
{
|
||||
return JsonConvert.SerializeObject(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,9 +16,7 @@ namespace COMCMS.Web.Common
|
||||
{
|
||||
context.HttpContext.Request.ContentType = "application/json";
|
||||
context.HttpContext.Request.Headers["Accept"] = "application/json";
|
||||
ReJSON model = new ReJSON();
|
||||
model.code = 5001;
|
||||
model.message = "执行错误:"+ context.Exception.Message;
|
||||
ReJSON model = new ReJSON(5001, "执行错误:" + context.Exception.Message);
|
||||
context.Result = new JsonResult(model);
|
||||
base.OnException(context);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user