修复SqlSugarSetup类名修改后,nlog不打印日志问题,日期时间转换类增加格式,暂存区块和字段关联

This commit is contained in:
2023-10-11 16:58:48 +08:00
parent e6dae7d1e2
commit 28c53b71ce
14 changed files with 118 additions and 82 deletions
@@ -1,4 +1,5 @@
using ZR.Admin.WebApi.Filters;
using ZR.ServiceCore.Model;
using ZR.ServiceCore.Model.Dto;
using ZR.ServiceCore.Services.IService;
@@ -47,4 +48,27 @@ public class SysFieldController : BaseController
[FromRoute] long roleId)
=> SUCCESS(await _sysRoleFieldService.InsertOrUpdateSysRoleField(sysFieldDtos, roleId));
[HttpPost("fieldDisplay")]
public async Task<IActionResult> FieldDisplay(string blockCode)
{
var info = JwtUtil.GetLoginUser(HttpContext);
var roleIds = info.Roles.Select(it => it.RoleId).ToList();
var list = await _sysFieldService.Queryable()
.LeftJoin<SysFieldBlock>((sf, sfb) => sf.Id == sfb.FieldId)
.LeftJoin<SysBlock>((sf, sfb, sb) => sfb.BlockId == sb.Id )
.LeftJoin<SysRoleField>((sf,sfb, sb, srf) => sf.Id == srf.FieldId)
.Where((sf,sfb, sb, srf) => roleIds.Contains(srf.RoleId))
.Where((sf,sfb, sb, srf) => sb.Code == blockCode)
.WithCache(10 * 60)
.Select((sf,sfb, sb, srf) => sf.FieldName)
.ToListAsync();
// var list = await _sysFieldService.Queryable()
// .LeftJoin<SysRoleField>((sf, srf) => sf.Id == srf.FieldId)
// .Where((sf, srf) => roleIds.Contains(srf.RoleId))
// .WithCache(10 * 60)
// .Select((sf, srf) => sf.FieldName)
// .ToListAsync();
return SUCCESS(list);
}
}
@@ -1,9 +1,7 @@
using Lazy.Captcha.Core;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using NETCore.Encrypt;
using ZR.Admin.WebApi.Filters;
using ZR.Model.System;
using ZR.Service.System;
using ZR.Service.System.IService;
using ZR.ServiceCore.Model;
@@ -66,8 +64,11 @@ namespace ZR.Admin.WebApi.Controllers.System
{
if (loginBody == null) { throw new CustomException("请求参数错误"); }
loginBody.LoginIP = HttpContextExtension.GetClientUserIp(HttpContext);
SysConfig sysConfig = sysConfigService.GetSysConfigByKey("sys.account.captchaOnOff");
if (sysConfig?.ConfigValue != "off" && !SecurityCodeHelper.Validate(loginBody.Uuid, loginBody.Code))
var sysConfig = sysConfigService.GetSysConfigByKey("sys.account.captchaOnOff");
var headers = HttpContext.Request.Headers;
var isRemoteInvoke = headers["Remote-Invoke"].FirstOrDefault().ParseToBool();
if (sysConfig?.ConfigValue != "off" && !SecurityCodeHelper.Validate(loginBody.Uuid, loginBody.Code)
&& !isRemoteInvoke)
{
return ToResponse(ResultCode.CAPTCHA_ERROR, "验证码错误");
}