mirror of
https://github.com/nsnail/NetAdmin.git
synced 2025-12-23 06:25:53 +08:00
@@ -6,13 +6,13 @@ namespace NetAdmin.Domain.Dto.Sys.Cache;
|
||||
public sealed record CacheStatisticsRsp : DataAbstraction
|
||||
{
|
||||
private static readonly Regex[] _regexes = [
|
||||
new Regex(@"keyspace_hits:(\d+)", RegexOptions.Compiled) //
|
||||
, new Regex(@"keyspace_misses:(\d+)", RegexOptions.Compiled) //
|
||||
, new Regex(@"uptime_in_seconds:(\d+)", RegexOptions.Compiled) //
|
||||
, new Regex(@"used_cpu_sys:([\d\\.]+)", RegexOptions.Compiled) //
|
||||
, new Regex(@"used_cpu_user:([\d\\.]+)", RegexOptions.Compiled) //
|
||||
, new Regex(@"used_memory:(\d+)", RegexOptions.Compiled) //
|
||||
, new Regex("redis_version:(.+)", RegexOptions.Compiled) //
|
||||
new(@"keyspace_hits:(\d+)", RegexOptions.Compiled) //
|
||||
, new(@"keyspace_misses:(\d+)", RegexOptions.Compiled) //
|
||||
, new(@"uptime_in_seconds:(\d+)", RegexOptions.Compiled) //
|
||||
, new(@"used_cpu_sys:([\d\\.]+)", RegexOptions.Compiled) //
|
||||
, new(@"used_cpu_user:([\d\\.]+)", RegexOptions.Compiled) //
|
||||
, new(@"used_memory:(\d+)", RegexOptions.Compiled) //
|
||||
, new("redis_version:(.+)", RegexOptions.Compiled) //
|
||||
];
|
||||
|
||||
/// <summary>
|
||||
@@ -25,13 +25,12 @@ public sealed record CacheStatisticsRsp : DataAbstraction
|
||||
/// </summary>
|
||||
public CacheStatisticsRsp(string redisResult)
|
||||
{
|
||||
KeyspaceHits = _regexes[0].Match(redisResult).Groups[1].Value.Trim().Int64Try(0);
|
||||
KeyspaceHits = _regexes[0].Match(redisResult).Groups[1].Value.Trim().Int64Try(0);
|
||||
KeyspaceMisses = _regexes[1].Match(redisResult).Groups[1].Value.Trim().Int64Try(0);
|
||||
UpTime = _regexes[2].Match(redisResult).Groups[1].Value.Trim().Int64Try(0);
|
||||
UsedCpu = _regexes[3].Match(redisResult).Groups[1].Value.Trim().DecTry(0) +
|
||||
_regexes[4].Match(redisResult).Groups[1].Value.Trim().DecTry(0);
|
||||
UpTime = _regexes[2].Match(redisResult).Groups[1].Value.Trim().Int64Try(0);
|
||||
UsedCpu = _regexes[3].Match(redisResult).Groups[1].Value.Trim().DecTry(0) + _regexes[4].Match(redisResult).Groups[1].Value.Trim().DecTry(0);
|
||||
UsedMemory = _regexes[5].Match(redisResult).Groups[1].Value.Trim().Int64Try(0);
|
||||
Version = _regexes[6].Match(redisResult).Groups[1].Value.Trim();
|
||||
Version = _regexes[6].Match(redisResult).Groups[1].Value.Trim();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -10,13 +10,21 @@ public record CreateDicContentReq : Sys_DicContent
|
||||
[Required(ErrorMessageResourceType = typeof(Ln), ErrorMessageResourceName = nameof(Ln.字典目录编号不能为空))]
|
||||
public override long CatalogId { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_DicContent.Key" />
|
||||
/// <inheritdoc cref="IFieldEnabled.Enabled" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override bool Enabled { get; init; } = true;
|
||||
|
||||
/// <inheritdoc cref="Sys_DicContent.Key" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
[Required(ErrorMessageResourceType = typeof(Ln), ErrorMessageResourceName = nameof(Ln.键名称不能为空))]
|
||||
public override string Key { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_DicContent.Summary" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string Summary { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_DicContent.Value" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
[Required(ErrorMessageResourceType = typeof(Ln), ErrorMessageResourceName = nameof(Ln.键值不能为空))]
|
||||
public override string Value { get; init; }
|
||||
}
|
||||
@@ -11,12 +11,24 @@ public sealed record ExportDicContentRsp : QueryDicContentRsp
|
||||
[CsvName(nameof(Ln.创建时间))]
|
||||
public override DateTime CreatedTime { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(3)]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.是否启用))]
|
||||
public override bool Enabled { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(0)]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.项名))]
|
||||
public override string Key { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(4)]
|
||||
[CsvIgnore(false)]
|
||||
[CsvName(nameof(Ln.备注))]
|
||||
public override string Summary { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[CsvIndex(1)]
|
||||
[CsvIgnore(false)]
|
||||
|
||||
@@ -13,10 +13,18 @@ public record QueryDicContentRsp : Sys_DicContent
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override DateTime CreatedTime { get; init; }
|
||||
|
||||
/// <inheritdoc cref="IFieldEnabled.Enabled" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override bool Enabled { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_DicContent.Key" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string Key { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_DicContent.Summary" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string Summary { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_DicContent.Value" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string Value { get; init; }
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace NetAdmin.Domain.Dto.Sys.Dic.Content;
|
||||
|
||||
/// <summary>
|
||||
/// 请求:设置字典内容启用状态
|
||||
/// </summary>
|
||||
public sealed record SetDicContentEnabledReq : Sys_DicContent
|
||||
{
|
||||
/// <inheritdoc cref="IFieldEnabled.Enabled" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override bool Enabled { get; init; }
|
||||
|
||||
/// <inheritdoc cref="IFieldVersion.Version" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override long Version { get; init; }
|
||||
}
|
||||
@@ -19,8 +19,7 @@ public record CreateJobReq : Sys_Job
|
||||
public override string ExecutionCron { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_Job.HttpMethod" />
|
||||
[EnumDataType(typeof(HttpMethods), ErrorMessageResourceType = typeof(Ln)
|
||||
, ErrorMessageResourceName = nameof(Ln.请求方法不正确))]
|
||||
[EnumDataType(typeof(HttpMethods), ErrorMessageResourceType = typeof(Ln), ErrorMessageResourceName = nameof(Ln.请求方法不正确))]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override HttpMethods HttpMethod { get; init; }
|
||||
|
||||
|
||||
@@ -15,8 +15,7 @@ public record QueryJobRsp : Sys_Job
|
||||
/// Cron 表达式描述
|
||||
/// </summary>
|
||||
[JsonInclude]
|
||||
public string CronDescription =>
|
||||
ExpressionDescriptor.GetDescription(ExecutionCron, new Options { Locale = "zh-CN" });
|
||||
public string CronDescription => ExpressionDescriptor.GetDescription(ExecutionCron, new Options { Locale = "zh-CN" });
|
||||
|
||||
/// <inheritdoc cref="Sys_Job.LastStatusCode" />
|
||||
[JsonInclude]
|
||||
|
||||
@@ -15,8 +15,7 @@ public sealed record MetaInfo : DataAbstraction
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MetaInfo" /> class.
|
||||
/// </summary>
|
||||
public MetaInfo(string color, bool fullPage, bool hidden, bool hiddenBreadCrumb, string icon, string tag
|
||||
, string title, MenuTypes type)
|
||||
public MetaInfo(string color, bool fullPage, bool hidden, bool hiddenBreadCrumb, string icon, string tag, string title, MenuTypes type)
|
||||
{
|
||||
Color = color;
|
||||
FullPage = fullPage;
|
||||
@@ -73,8 +72,7 @@ public sealed record MetaInfo : DataAbstraction
|
||||
/// <summary>
|
||||
/// 类型
|
||||
/// </summary>
|
||||
[EnumDataType(typeof(MenuTypes), ErrorMessageResourceType = typeof(Ln)
|
||||
, ErrorMessageResourceName = nameof(Ln.菜单类型不正确))]
|
||||
[EnumDataType(typeof(MenuTypes), ErrorMessageResourceType = typeof(Ln), ErrorMessageResourceName = nameof(Ln.菜单类型不正确))]
|
||||
[JsonInclude]
|
||||
public MenuTypes Type { get; init; }
|
||||
}
|
||||
@@ -18,8 +18,7 @@ public record CreateRoleReq : Sys_Role, IValidatableObject
|
||||
public override string DashboardLayout { get; set; }
|
||||
|
||||
/// <inheritdoc cref="Sys_Role.DataScope" />
|
||||
[EnumDataType(typeof(DataScopes), ErrorMessageResourceType = typeof(Ln)
|
||||
, ErrorMessageResourceName = nameof(Ln.角色数据范围不正确))]
|
||||
[EnumDataType(typeof(DataScopes), ErrorMessageResourceType = typeof(Ln), ErrorMessageResourceName = nameof(Ln.角色数据范围不正确))]
|
||||
public override DataScopes DataScope { get; init; } = DataScopes.All;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -20,8 +20,7 @@ public record CreateSiteMsgReq : Sys_SiteMsg
|
||||
public IReadOnlyCollection<long> DeptIds { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_SiteMsg.MsgType" />
|
||||
[EnumDataType(typeof(SiteMsgTypes), ErrorMessageResourceType = typeof(Ln)
|
||||
, ErrorMessageResourceName = nameof(Ln.站内信类型不正确))]
|
||||
[EnumDataType(typeof(SiteMsgTypes), ErrorMessageResourceType = typeof(Ln), ErrorMessageResourceName = nameof(Ln.站内信类型不正确))]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override SiteMsgTypes MsgType { get; init; }
|
||||
|
||||
|
||||
@@ -12,8 +12,7 @@ public record CreateSiteMsgFlagReq : Sys_SiteMsgFlag
|
||||
public override long SiteMsgId { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_SiteMsgFlag.UserSiteMsgStatus" />
|
||||
[EnumDataType(typeof(UserSiteMsgStatues), ErrorMessageResourceType = typeof(Ln)
|
||||
, ErrorMessageResourceName = nameof(Ln.站内信状态不正确))]
|
||||
[EnumDataType(typeof(UserSiteMsgStatues), ErrorMessageResourceType = typeof(Ln), ErrorMessageResourceName = nameof(Ln.站内信状态不正确))]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override UserSiteMsgStatues UserSiteMsgStatus { get; init; }
|
||||
}
|
||||
12
src/backend/NetAdmin.Domain/Dto/Sys/Tool/AesDecodeReq.cs
Normal file
12
src/backend/NetAdmin.Domain/Dto/Sys/Tool/AesDecodeReq.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace NetAdmin.Domain.Dto.Sys.Tool;
|
||||
|
||||
/// <summary>
|
||||
/// 请求:Aes解密
|
||||
/// </summary>
|
||||
public record AesDecodeReq : DataAbstraction
|
||||
{
|
||||
/// <summary>
|
||||
/// 密文
|
||||
/// </summary>
|
||||
public string CipherText { get; init; }
|
||||
}
|
||||
@@ -16,6 +16,14 @@ public record QueryUserRsp : Sys_User
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override DateTime CreatedTime { get; init; }
|
||||
|
||||
/// <inheritdoc cref="IFieldCreatedUser.CreatedUserId" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override long? CreatedUserId { get; init; }
|
||||
|
||||
/// <inheritdoc cref="IFieldCreatedUser.CreatedUserName" />
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public override string CreatedUserName { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_User.Dept" />
|
||||
public new virtual QueryDeptRsp Dept { get; init; }
|
||||
|
||||
|
||||
@@ -17,8 +17,7 @@ public record CreateUserProfileReq : Sys_UserProfile
|
||||
public override string CertificateNumber { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_UserProfile.CertificateType" />
|
||||
[EnumDataType(typeof(CertificateTypes), ErrorMessageResourceType = typeof(Ln)
|
||||
, ErrorMessageResourceName = nameof(Ln.证件类型不正确))]
|
||||
[EnumDataType(typeof(CertificateTypes), ErrorMessageResourceType = typeof(Ln), ErrorMessageResourceName = nameof(Ln.证件类型不正确))]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override CertificateTypes? CertificateType { get; init; }
|
||||
|
||||
@@ -39,8 +38,7 @@ public record CreateUserProfileReq : Sys_UserProfile
|
||||
public override string CompanyTelephone { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_UserProfile.Education" />
|
||||
[EnumDataType(typeof(Educations), ErrorMessageResourceType = typeof(Ln)
|
||||
, ErrorMessageResourceName = nameof(Ln.学历不正确))]
|
||||
[EnumDataType(typeof(Educations), ErrorMessageResourceType = typeof(Ln), ErrorMessageResourceName = nameof(Ln.学历不正确))]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override Educations? Education { get; init; }
|
||||
|
||||
@@ -82,8 +80,7 @@ public record CreateUserProfileReq : Sys_UserProfile
|
||||
public override string HomeTelephone { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_UserProfile.MarriageStatus" />
|
||||
[EnumDataType(typeof(MarriageStatues), ErrorMessageResourceType = typeof(Ln)
|
||||
, ErrorMessageResourceName = nameof(Ln.婚姻状况不正确))]
|
||||
[EnumDataType(typeof(MarriageStatues), ErrorMessageResourceType = typeof(Ln), ErrorMessageResourceName = nameof(Ln.婚姻状况不正确))]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override MarriageStatues? MarriageStatus { get; init; }
|
||||
|
||||
@@ -96,8 +93,7 @@ public record CreateUserProfileReq : Sys_UserProfile
|
||||
public new CreateDicContentReq NationArea { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_UserProfile.PoliticalStatus" />
|
||||
[EnumDataType(typeof(PoliticalStatues), ErrorMessageResourceType = typeof(Ln)
|
||||
, ErrorMessageResourceName = nameof(Ln.政治面貌不正确))]
|
||||
[EnumDataType(typeof(PoliticalStatues), ErrorMessageResourceType = typeof(Ln), ErrorMessageResourceName = nameof(Ln.政治面貌不正确))]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public override PoliticalStatues? PoliticalStatus { get; init; }
|
||||
|
||||
|
||||
@@ -14,8 +14,7 @@ public sealed record SendVerifyCodeReq : Sys_VerifyCode, IValidatableObject
|
||||
public override string DestDevice { get; init; }
|
||||
|
||||
/// <inheritdoc cref="Sys_VerifyCode.DeviceType" />
|
||||
[EnumDataType(typeof(VerifyCodeDeviceTypes), ErrorMessageResourceType = typeof(Ln)
|
||||
, ErrorMessageResourceName = nameof(Ln.验证码目标设备类型不正确))]
|
||||
[EnumDataType(typeof(VerifyCodeDeviceTypes), ErrorMessageResourceType = typeof(Ln), ErrorMessageResourceName = nameof(Ln.验证码目标设备类型不正确))]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
[Required(ErrorMessageResourceType = typeof(Ln), ErrorMessageResourceName = nameof(Ln.设备类型不能为空))]
|
||||
public override VerifyCodeDeviceTypes DeviceType { get; init; }
|
||||
@@ -24,8 +23,7 @@ public sealed record SendVerifyCodeReq : Sys_VerifyCode, IValidatableObject
|
||||
public override VerifyCodeStatues Status => VerifyCodeStatues.Waiting;
|
||||
|
||||
/// <inheritdoc cref="Sys_VerifyCode.Type" />
|
||||
[EnumDataType(typeof(VerifyCodeTypes), ErrorMessageResourceType = typeof(Ln)
|
||||
, ErrorMessageResourceName = nameof(Ln.验证码类型不正确))]
|
||||
[EnumDataType(typeof(VerifyCodeTypes), ErrorMessageResourceType = typeof(Ln), ErrorMessageResourceName = nameof(Ln.验证码类型不正确))]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
[Required(ErrorMessageResourceType = typeof(Ln), ErrorMessageResourceName = nameof(Ln.验证码类型不能为空))]
|
||||
public override VerifyCodeTypes Type { get; init; }
|
||||
@@ -43,22 +41,20 @@ public sealed record SendVerifyCodeReq : Sys_VerifyCode, IValidatableObject
|
||||
switch (DeviceType) {
|
||||
case VerifyCodeDeviceTypes.Email:
|
||||
validationResult = new EmailAttribute().GetValidationResult(DestDevice, validationContext);
|
||||
if (validationResult == null) {
|
||||
yield break;
|
||||
}
|
||||
|
||||
yield return new ValidationResult(validationResult.ErrorMessage, new[] { nameof(DestDevice) });
|
||||
break;
|
||||
case VerifyCodeDeviceTypes.Mobile:
|
||||
validationResult = new MobileAttribute().GetValidationResult(DestDevice, validationContext);
|
||||
if (validationResult == null) {
|
||||
yield break;
|
||||
}
|
||||
|
||||
yield return new ValidationResult(validationResult.ErrorMessage, new[] { nameof(DestDevice) });
|
||||
break;
|
||||
default:
|
||||
yield break;
|
||||
}
|
||||
|
||||
if (validationResult == null) {
|
||||
yield break;
|
||||
}
|
||||
|
||||
yield return new ValidationResult(validationResult.ErrorMessage, [nameof(DestDevice)]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user