fix:自定义异常返回中文乱码
This commit is contained in:
parent
79b5015091
commit
ac134308ed
@ -106,16 +106,18 @@ namespace ZR.Admin.WebApi.Middleware
|
|||||||
sysOperLog.jsonResult = logAttribute.IsSaveResponseData ? sysOperLog.jsonResult : "";
|
sysOperLog.jsonResult = logAttribute.IsSaveResponseData ? sysOperLog.jsonResult : "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LogEventInfo ei = new(logLevel, "GlobalExceptionMiddleware", error);
|
LogEventInfo ei = new(logLevel, "GlobalExceptionMiddleware", error)
|
||||||
|
{
|
||||||
ei.Exception = ex;
|
Exception = ex,
|
||||||
ei.Message = error;
|
Message = error
|
||||||
|
};
|
||||||
ei.Properties["status"] = 1;//走正常返回都是通过走GlobalExceptionFilter不通过
|
ei.Properties["status"] = 1;//走正常返回都是通过走GlobalExceptionFilter不通过
|
||||||
ei.Properties["jsonResult"] = responseResult;
|
ei.Properties["jsonResult"] = responseResult;
|
||||||
ei.Properties["requestParam"] = sysOperLog.operParam;
|
ei.Properties["requestParam"] = sysOperLog.operParam;
|
||||||
ei.Properties["user"] = HttpContextExtension.GetName(context);
|
ei.Properties["user"] = HttpContextExtension.GetName(context);
|
||||||
|
|
||||||
Logger.Log(ei);
|
Logger.Log(ei);
|
||||||
|
context.Response.ContentType = "text/json;charset=utf-8";
|
||||||
await context.Response.WriteAsync(responseResult, System.Text.Encoding.UTF8);
|
await context.Response.WriteAsync(responseResult, System.Text.Encoding.UTF8);
|
||||||
|
|
||||||
SysOperLogService.InsertOperlog(sysOperLog);
|
SysOperLogService.InsertOperlog(sysOperLog);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user