修复SqlSugarSetup类名修改后,nlog不打印日志问题,日期时间转换类增加格式,暂存区块和字段关联
This commit is contained in:
parent
e6dae7d1e2
commit
28c53b71ce
@ -170,7 +170,7 @@ namespace Infrastructure.Extensions
|
||||
{
|
||||
try
|
||||
{
|
||||
return bool.Parse(str.ToString());
|
||||
return bool.Parse(str.ToString() ?? string.Empty);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@ -284,6 +284,9 @@ namespace Infrastructure.Extensions
|
||||
return DateTime.ParseExact(str, "yyyyMMddHH", System.Globalization.CultureInfo.CurrentCulture);
|
||||
case 12:
|
||||
return DateTime.ParseExact(str, "yyyyMMddHHmm", System.Globalization.CultureInfo.CurrentCulture);
|
||||
case 13:
|
||||
return DateTime.ParseExact(str, "yyyy.MM.dd ddd",
|
||||
System.Globalization.CultureInfo.CurrentCulture);
|
||||
case 14:
|
||||
return DateTime.ParseExact(str, "yyyyMMddHHmmss", System.Globalization.CultureInfo.CurrentCulture);
|
||||
default:
|
||||
|
||||
@ -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, "验证码错误");
|
||||
}
|
||||
|
||||
@ -84,7 +84,7 @@
|
||||
<!--<logger name="System.*" writeTo="blackhole" final="true" />-->
|
||||
<!-- Quartz -->
|
||||
<logger name="Quartz*" minlevel="Trace" maxlevel="Info" final="true" />
|
||||
<logger name="*.SqlSugar.SqlsugarSetup" final="true" writeTo="consoleSql,sqlfile"/>
|
||||
<logger name="*.SqlSugar.SqlSugarSetup" final="true" writeTo="consoleSql,sqlfile"/>
|
||||
<logger name="*" minLevel="Trace" writeTo="allfile" />
|
||||
<logger name="*.GlobalExceptionMiddleware" final="true" writeTo="consoleSql,errorfile"/>
|
||||
<logger name="ZR.Admin.WebApi.Middleware.CustomIpRateLimitMiddleware" final="true" writeTo="ipRateLimit" />
|
||||
|
||||
@ -3,17 +3,13 @@ using Infrastructure.Converter;
|
||||
using Microsoft.AspNetCore.DataProtection;
|
||||
using NLog.Web;
|
||||
using System.Text.Json;
|
||||
using BloomFilter;
|
||||
using BloomFilter.CSRedis.Configurations;
|
||||
using Microsoft.Extensions.Caching.Distributed;
|
||||
using Microsoft.Extensions.Caching.Redis;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Newtonsoft.Json;
|
||||
using ZR.Admin.WebApi.Extensions;
|
||||
using ZR.Infrastructure.Cache;
|
||||
using ZR.Infrastructure.Resolver;
|
||||
using ZR.Infrastructure.WebExtensions;
|
||||
using ZR.ServiceCore.Model;
|
||||
using ZR.ServiceCore.Services.IService;
|
||||
using ZR.ServiceCore.Signalr;
|
||||
using ZR.ServiceCore.SqlSugar;
|
||||
@ -184,58 +180,4 @@ using (var serviceScope = app.Services.CreateScope())
|
||||
pol.IpRules.AddRange(ipRateLimitPolicies.Adapt<List<IpRateLimitPolicy>>());
|
||||
await ipPolicyStore.SetAsync(optionsAccessor.Value.IpPolicyPrefix, pol);
|
||||
}
|
||||
|
||||
var serviceCoreModel = AppDomain.CurrentDomain
|
||||
.GetAssemblies()
|
||||
.First(it => it.FullName.Contains("ZR.ServiceCore"))
|
||||
.ExportedTypes
|
||||
.Where(p => p.FullName.StartsWith("ZR.ServiceCore.Model"))
|
||||
.ToList();
|
||||
// var geoEntityTypes = currentAssembly[0].ExportedTypes
|
||||
// .Where(p => p.FullName.StartsWith("ZR.ServiceCore.Model"))
|
||||
// .ToList();
|
||||
var model = AppDomain.CurrentDomain
|
||||
.GetAssemblies()
|
||||
.First(it => it.FullName.Contains("ZR.Model"))
|
||||
.ExportedTypes
|
||||
.ToList();
|
||||
foreach (var assembly in serviceCoreModel)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
var user = new SysUser
|
||||
{
|
||||
UserName = "admin",
|
||||
Password = "123456"
|
||||
};
|
||||
var props = new HashSet<string>
|
||||
{
|
||||
"Name",
|
||||
"Children"
|
||||
};
|
||||
var article = new Article
|
||||
{
|
||||
Title = "aadad",
|
||||
ArticleCategoryNav = new ArticleCategory
|
||||
{
|
||||
Name = "adsad",
|
||||
Children = new List<ArticleCategory>
|
||||
{
|
||||
new()
|
||||
{
|
||||
Name = "1213"
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
var apiResult = new ApiResult(200, "SUCCESS", article);
|
||||
var json = JsonConvert.SerializeObject(apiResult, new JsonSerializerSettings
|
||||
{
|
||||
ContractResolver = new JsonPropertyContractResolver(props)
|
||||
});
|
||||
var provider = builder.Services.BuildServiceProvider();
|
||||
var bf = provider.GetService<IBloomFilter>();
|
||||
bf.Add("Value");
|
||||
Console.WriteLine(bf.Contains("Value"));
|
||||
app.Run();
|
||||
@ -26,7 +26,7 @@ public class DataFieldFilter : ActionFilterAttribute
|
||||
|
||||
public Type ResultType { get; set; }
|
||||
|
||||
public string RulePath { get; set; }
|
||||
public string Path { get; set; }
|
||||
|
||||
public override void OnResultExecuting(ResultExecutingContext context)
|
||||
{
|
||||
|
||||
13
ZR.ServiceCore/Model/SysBlock.cs
Normal file
13
ZR.ServiceCore/Model/SysBlock.cs
Normal file
@ -0,0 +1,13 @@
|
||||
namespace ZR.ServiceCore.Model;
|
||||
[SugarTable("sys_block")]
|
||||
[Tenant("0")]
|
||||
public class SysBlock
|
||||
{
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
public long Id { get; set; }
|
||||
|
||||
public string Code { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
}
|
||||
@ -13,6 +13,4 @@ public class SysField
|
||||
public string FullName { get; set; }
|
||||
|
||||
public string FieldType { get; set; }
|
||||
|
||||
public string IsClass { get; set; }
|
||||
}
|
||||
11
ZR.ServiceCore/Model/SysFieldBlock.cs
Normal file
11
ZR.ServiceCore/Model/SysFieldBlock.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace ZR.ServiceCore.Model;
|
||||
[SugarTable("sys_field_block")]
|
||||
[Tenant("0")]
|
||||
public class SysFieldBlock
|
||||
{
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
public long BlockId { get; set; }
|
||||
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
public long FieldId { get; set; }
|
||||
}
|
||||
9
ZR.ServiceCore/Services/IService/ISysBlockService.cs
Normal file
9
ZR.ServiceCore/Services/IService/ISysBlockService.cs
Normal file
@ -0,0 +1,9 @@
|
||||
using ZR.Service;
|
||||
using ZR.ServiceCore.Model;
|
||||
|
||||
namespace ZR.ServiceCore.Services.IService;
|
||||
|
||||
public interface ISysBlockService : IBaseService<SysBlock>
|
||||
{
|
||||
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
using ZR.Service;
|
||||
using ZR.ServiceCore.Model;
|
||||
|
||||
namespace ZR.ServiceCore.Services.IService;
|
||||
|
||||
public interface ISysFieldBlockService : IBaseService<SysFieldBlock>
|
||||
{
|
||||
|
||||
}
|
||||
12
ZR.ServiceCore/Services/SysBlockService.cs
Normal file
12
ZR.ServiceCore/Services/SysBlockService.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using Infrastructure.Attribute;
|
||||
using ZR.Service;
|
||||
using ZR.ServiceCore.Model;
|
||||
using ZR.ServiceCore.Services.IService;
|
||||
|
||||
namespace ZR.ServiceCore.Services;
|
||||
|
||||
[AppService(ServiceType = typeof(ISysBlockService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class SysBlockService : BaseService<SysBlock>, ISysBlockService
|
||||
{
|
||||
|
||||
}
|
||||
12
ZR.ServiceCore/Services/SysFieldBlockService.cs
Normal file
12
ZR.ServiceCore/Services/SysFieldBlockService.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using Infrastructure.Attribute;
|
||||
using ZR.Service;
|
||||
using ZR.ServiceCore.Model;
|
||||
using ZR.ServiceCore.Services.IService;
|
||||
|
||||
namespace ZR.ServiceCore.Services;
|
||||
|
||||
[AppService(ServiceType = typeof(ISysFieldBlockService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class SysFieldBlockService : BaseService<SysFieldBlock>, ISysFieldBlockService
|
||||
{
|
||||
|
||||
}
|
||||
@ -19,11 +19,13 @@ public class SysFieldService : BaseService<SysField>, ISysFieldService
|
||||
{
|
||||
var fields = await Queryable()
|
||||
.Where(it => it.FullName == fullName)
|
||||
.WithCache(10 * 60)
|
||||
.ToListAsync();
|
||||
var roleFields = await _sysRoleFieldService
|
||||
.Queryable()
|
||||
.Where(it => it.RoleId == roleId)
|
||||
.Select(it => it.FieldId)
|
||||
.WithCache()
|
||||
.ToListAsync();
|
||||
var list = fields.Select(it => new SysFieldDto
|
||||
{
|
||||
@ -31,7 +33,7 @@ public class SysFieldService : BaseService<SysField>, ISysFieldService
|
||||
FieldType = it.FieldType,
|
||||
FullName = it.FullName,
|
||||
Id = it.Id,
|
||||
IsClass = it.IsClass,
|
||||
// IsClass = it.IsClass,
|
||||
IsPermission = !roleFields.Contains(it.Id)
|
||||
}).ToList();
|
||||
return list;
|
||||
@ -67,7 +69,7 @@ public class SysFieldService : BaseService<SysField>, ISysFieldService
|
||||
FieldName = property.FieldName,
|
||||
FullName = serviceCoreModel.FullName,
|
||||
FieldType = property.FieldType,
|
||||
IsClass = property.IsClass ? "1" : "0"
|
||||
// IsClass = property.IsClass ? "1" : "0"
|
||||
}).ToList();
|
||||
await Deleteable()
|
||||
.Where(it =>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user