优化实体统一首字母大写

This commit is contained in:
不做码农
2022-09-01 21:54:53 +08:00
parent 401338eadb
commit c372c9a9e2
17 changed files with 184 additions and 185 deletions

View File

@@ -192,11 +192,11 @@ namespace ZR.Admin.WebApi.Controllers.System
ClientInfo clientInfo = context.GetClientInfo();
SysLogininfor sysLogininfor = new()
{
browser = clientInfo.Device.Family,
os = clientInfo.OS.ToString(),
ipaddr = ipAddr,
userName = context.GetName(),
loginLocation = ip_info.Province + "-" + ip_info.City
Browser = clientInfo.Device.Family,
Os = clientInfo.OS.ToString(),
Ipaddr = ipAddr,
UserName = context.GetName(),
LoginLocation = ip_info?.Province + "-" + ip_info?.City
};
return sysLogininfor;

View File

@@ -106,11 +106,11 @@ namespace ZR.Admin.WebApi.Controllers.System
.NameMatchingStrategy(NameMatchingStrategy.IgnoreCase);//忽略字段名称的大小写;//忽略除以上配置的所有字段
var modal = menuDto.Adapt<SysMenu>(config).ToUpdate(HttpContext);
if (UserConstants.YES_FRAME.Equals(modal.isFrame) && !modal.path.StartsWith("http"))
if (UserConstants.YES_FRAME.Equals(modal.IsFrame) && !modal.Path.StartsWith("http"))
{
return ToResponse(ApiResult.Error($"修改菜单'{modal.MenuName}'失败地址必须以http(s)://开头"));
}
if (modal.MenuId.Equals(modal.parentId))
if (modal.MenuId.Equals(modal.ParentId))
{
return ToResponse(ApiResult.Error($"修改菜单'{modal.MenuName}'失败,上级菜单不能选择自己"));
}
@@ -141,7 +141,7 @@ namespace ZR.Admin.WebApi.Controllers.System
{
return ToResponse(ApiResult.Error($"新增菜单'{menu.MenuName}'失败,菜单名称已存在"));
}
if (UserConstants.YES_FRAME.Equals(menu.isFrame) && !menu.path.StartsWith("http"))
if (UserConstants.YES_FRAME.Equals(menu.IsFrame) && !menu.Path.StartsWith("http"))
{
return ToResponse(ApiResult.Error($"新增菜单'{menu.MenuName}'失败地址必须以http(s)://开头"));
}
@@ -189,7 +189,7 @@ namespace ZR.Admin.WebApi.Controllers.System
MenuDto MenuDto = new()
{
MenuId = id,
orderNum = value
OrderNum = value
};
if (MenuDto == null) { return ToResponse(ApiResult.Error(101, "请求参数错误")); }

View File

@@ -87,7 +87,7 @@ namespace ZR.Admin.WebApi.Controllers.monitor
logininfoDto.BeginTime = DateTimeHelper.GetBeginTime(logininfoDto.BeginTime, -1);
logininfoDto.EndTime = DateTimeHelper.GetBeginTime(logininfoDto.EndTime, 1);
var exp = Expressionable.Create<SysLogininfor>()
.And(it => it.loginTime >= logininfoDto.BeginTime && it.loginTime <= logininfoDto.EndTime);
.And(it => it.LoginTime >= logininfoDto.BeginTime && it.LoginTime <= logininfoDto.EndTime);
var list = sysLoginService.Queryable().Where(exp.ToExpression())
.ToList();

View File

@@ -134,7 +134,7 @@ namespace ZR.Admin.WebApi.Extensions
/// <param name="context"></param>
public static void GetRequestValue(this HttpContext context, SysOperLog operLog)
{
string reqMethod = operLog.requestMethod;
string reqMethod = operLog.RequestMethod;
string param;
if (HttpMethods.IsPost(reqMethod) || HttpMethods.IsPut(reqMethod))
@@ -148,7 +148,7 @@ namespace ZR.Admin.WebApi.Extensions
{
param = context.Request.QueryString.Value.ToString();
}
operLog.operParam = param;
operLog.OperParam = param;
}
}

View File

@@ -95,31 +95,31 @@ namespace ZR.Admin.WebApi.Filters
SysOperLog sysOperLog = new()
{
status = 0,
operName = userName,
operIp = ip,
operUrl = HttpContextExtension.GetRequestUrl(context.HttpContext),
requestMethod = method,
jsonResult = jsonResult,
operLocation = ip_info.Province + " " + ip_info.City,
method = controller + "." + action + "()",
Status = 0,
OperName = userName,
OperIp = ip,
OperUrl = HttpContextExtension.GetRequestUrl(context.HttpContext),
RequestMethod = method,
JsonResult = jsonResult,
OperLocation = ip_info.Province + " " + ip_info.City,
Method = controller + "." + action + "()",
//Elapsed = _stopwatch.ElapsedMilliseconds,
operTime = DateTime.Now
OperTime = DateTime.Now
};
HttpContextExtension.GetRequestValue(context.HttpContext, sysOperLog);
if (logAttribute != null)
{
sysOperLog.title = logAttribute?.Title;
sysOperLog.businessType = (int)logAttribute?.BusinessType;
sysOperLog.operParam = logAttribute.IsSaveRequestData ? sysOperLog.operParam : "";
sysOperLog.jsonResult = logAttribute.IsSaveResponseData ? sysOperLog.jsonResult : "";
sysOperLog.Title = logAttribute?.Title;
sysOperLog.BusinessType = (int)logAttribute?.BusinessType;
sysOperLog.OperParam = logAttribute.IsSaveRequestData ? sysOperLog.OperParam : "";
sysOperLog.JsonResult = logAttribute.IsSaveResponseData ? sysOperLog.JsonResult : "";
}
LogEventInfo ei = new(NLog.LogLevel.Info, "GlobalActionMonitor", "");
ei.Properties["jsonResult"] = !HttpMethods.IsGet(method) ? jsonResult : "";
ei.Properties["requestParam"] = sysOperLog.operParam;
ei.Properties["requestParam"] = sysOperLog.OperParam;
ei.Properties["user"] = userName;
logger.Log(ei);

View File

@@ -84,15 +84,15 @@ namespace ZR.Admin.WebApi.Middleware
SysOperLog sysOperLog = new()
{
status = 1,
operIp = ip,
operUrl = HttpContextExtension.GetRequestUrl(context),
requestMethod = context.Request.Method,
jsonResult = responseResult,
errorMsg = string.IsNullOrEmpty(error) ? msg : error,
operName = HttpContextExtension.GetName(context) ,
operLocation = ip_info.Province + " " + ip_info.City,
operTime = DateTime.Now
Status = 1,
OperIp = ip,
OperUrl = HttpContextExtension.GetRequestUrl(context),
RequestMethod = context.Request.Method,
JsonResult = responseResult,
ErrorMsg = string.IsNullOrEmpty(error) ? msg : error,
OperName = context.User.Identity.Name,
OperLocation = ip_info.Province + " " + ip_info.City,
OperTime = DateTime.Now
};
HttpContextExtension.GetRequestValue(context, sysOperLog);
var endpoint = GetEndpoint(context);
@@ -101,10 +101,10 @@ namespace ZR.Admin.WebApi.Middleware
var logAttribute = endpoint.Metadata.GetMetadata<LogAttribute>();
if (logAttribute != null)
{
sysOperLog.businessType = (int)logAttribute?.BusinessType;
sysOperLog.title = logAttribute?.Title;
sysOperLog.operParam = logAttribute.IsSaveRequestData ? sysOperLog.operParam : "";
sysOperLog.jsonResult = logAttribute.IsSaveResponseData ? sysOperLog.jsonResult : "";
sysOperLog.BusinessType = (int)logAttribute?.BusinessType;
sysOperLog.Title = logAttribute?.Title;
sysOperLog.OperParam = logAttribute.IsSaveRequestData ? sysOperLog.OperParam : "";
sysOperLog.JsonResult = logAttribute.IsSaveResponseData ? sysOperLog.JsonResult : "";
}
}
LogEventInfo ei = new(logLevel, "GlobalExceptionMiddleware", error)
@@ -114,13 +114,13 @@ namespace ZR.Admin.WebApi.Middleware
};
ei.Properties["status"] = 1;//走正常返回都是通过走GlobalExceptionFilter不通过
ei.Properties["jsonResult"] = responseResult;
ei.Properties["requestParam"] = sysOperLog.operParam;
ei.Properties["requestParam"] = sysOperLog.OperParam;
ei.Properties["user"] = HttpContextExtension.GetName(context);
Logger.Log(ei);
context.Response.ContentType = "text/json;charset=utf-8";
await context.Response.WriteAsync(responseResult, System.Text.Encoding.UTF8);
WxNoticeHelper.SendMsg("系统出错", sysOperLog.errorMsg);
WxNoticeHelper.SendMsg("系统出错", sysOperLog.ErrorMsg);
SysOperLogService.InsertOperlog(sysOperLog);
}