统一转本地时间

This commit is contained in:
qianhao.xu
2025-02-19 13:37:58 +08:00
parent af71630882
commit f80aca492c
3 changed files with 29 additions and 23 deletions

View File

@@ -29,27 +29,35 @@ namespace DOAN.ServiceCore.Middleware
/// <returns></returns>
public override Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
{
string msg = string.Empty;
var values = context.ModelState.Values;
foreach (var item in values)
{
foreach (var err in item.Errors)
// 打印请求参数
string msg = string.Empty;
var values = context.ModelState.Values;
foreach (var item in values)
{
if (!string.IsNullOrEmpty(msg))
foreach (var err in item.Errors)
{
msg += " | ";
if (!string.IsNullOrEmpty(msg))
{
msg += " | ";
}
msg += err.ErrorMessage;
}
msg += err.ErrorMessage;
}
}
if (!string.IsNullOrEmpty(msg))
{
logger.Info($"请求参数错误,{msg}");
ApiResult response = new((int)ResultCode.PARAM_ERROR, msg);
if (!string.IsNullOrEmpty(msg))
{
logger.Info($"请求参数错误,{msg}");
ApiResult response = new((int)ResultCode.PARAM_ERROR, msg);
context.Result = new JsonResult(response);
}
context.Result = new JsonResult(response);
}
return base.OnActionExecutionAsync(context, next);
}