diff --git a/assets/res/Enums.ln b/assets/res/Enums.ln index a62df084..d42bcc60 100644 --- a/assets/res/Enums.ln +++ b/assets/res/Enums.ln @@ -4,7 +4,6 @@ 不包含 不排序 不等于 -管理模块 丧偶 中专 中共党员 @@ -26,6 +25,7 @@ 发送失败 同步数据库结构 外国人居留证 +外部错误 大专 大于 大于等于 @@ -39,7 +39,6 @@ 已校验 已读 并且 -意外错误 成功 或者 手机 @@ -50,6 +49,7 @@ 无效操作 无效输入 日期范围 +未处理异常 未婚 未读 本人数据 @@ -68,6 +68,7 @@ 空闲 等于 等待发送 +管理模块 系统模块 绑定手机号码 结果非预期 diff --git a/assets/res/Statements.ln b/assets/res/Statements.ln index 1138bfd3..9265dfc6 100644 --- a/assets/res/Statements.ln +++ b/assets/res/Statements.ln @@ -60,7 +60,6 @@ XML注释文件不存在 用户名长度4位以上 用户头像不能为空 用户编号不存在 -用户编号不能为空 目标设备不能为空 短信验证请求不能为空 站内信不存在 diff --git a/src/backend/NetAdmin.AdmServer.Tests/AllTests.cs b/src/backend/NetAdmin.AdmServer.Tests/AllTests.cs index 988e0d6b..d119c8b6 100644 --- a/src/backend/NetAdmin.AdmServer.Tests/AllTests.cs +++ b/src/backend/NetAdmin.AdmServer.Tests/AllTests.cs @@ -1371,6 +1371,22 @@ public class AllTests(WebApplicationFactory factory, ITestOutputHelper return default; } + /// + [InlineData(default)] + [Theory] + public Task SetEnabledAsync(SetDeptEnabledReq req) + { + return default; + } + + /// + [InlineData(default)] + [Theory] + public Task SetEnabledAsync(SetRoleEnabledReq req) + { + return default; + } + /// [InlineData(default)] [Theory] diff --git a/src/backend/NetAdmin.Domain/DbMaps/Sys/Sys_JobRecord.cs b/src/backend/NetAdmin.Domain/DbMaps/Sys/Sys_JobRecord.cs index ca171f8d..835abc87 100644 --- a/src/backend/NetAdmin.Domain/DbMaps/Sys/Sys_JobRecord.cs +++ b/src/backend/NetAdmin.Domain/DbMaps/Sys/Sys_JobRecord.cs @@ -7,6 +7,8 @@ namespace NetAdmin.Domain.DbMaps.Sys; /// 计划作业执行记录表 /// [Index($"{Chars.FLG_DB_INDEX_PREFIX}{nameof(JobId)}_{nameof(TimeId)}", $"{nameof(JobId)},{nameof(TimeId)}", true)] +[Index(Chars.FLG_DB_INDEX_PREFIX + nameof(CreatedTime), nameof(CreatedTime), false)] +[Index(Chars.FLG_DB_INDEX_PREFIX + nameof(JobId), nameof(JobId), false)] [Table(Name = Chars.FLG_DB_TABLE_NAME_PREFIX + nameof(Sys_JobRecord))] public record Sys_JobRecord : LiteImmutableEntity { diff --git a/src/backend/NetAdmin.Domain/DbMaps/Sys/Sys_RequestLog.cs b/src/backend/NetAdmin.Domain/DbMaps/Sys/Sys_RequestLog.cs index ed9692dc..6416cae8 100644 --- a/src/backend/NetAdmin.Domain/DbMaps/Sys/Sys_RequestLog.cs +++ b/src/backend/NetAdmin.Domain/DbMaps/Sys/Sys_RequestLog.cs @@ -6,8 +6,9 @@ namespace NetAdmin.Domain.DbMaps.Sys; /// /// 请求日志表 /// -[Index(Chars.FLG_DB_INDEX_PREFIX + nameof(ApiId), nameof(ApiId), false)] -[Index(Chars.FLG_DB_INDEX_PREFIX + nameof(CreatedTime), nameof(CreatedTime), false)] +[Index(Chars.FLG_DB_INDEX_PREFIX + nameof(ApiId), nameof(ApiId), false)] +[Index(Chars.FLG_DB_INDEX_PREFIX + nameof(CreatedTime), nameof(CreatedTime), false)] +[Index(Chars.FLG_DB_INDEX_PREFIX + nameof(HttpStatusCode), nameof(HttpStatusCode), false)] [Table(Name = Chars.FLG_DB_TABLE_NAME_PREFIX + nameof(Sys_RequestLog))] public record Sys_RequestLog : ImmutableEntity, IFieldCreatedClient { diff --git a/src/backend/NetAdmin.Domain/Dto/Sys/Dept/SetDeptEnabledReq.cs b/src/backend/NetAdmin.Domain/Dto/Sys/Dept/SetDeptEnabledReq.cs new file mode 100644 index 00000000..cca5973c --- /dev/null +++ b/src/backend/NetAdmin.Domain/Dto/Sys/Dept/SetDeptEnabledReq.cs @@ -0,0 +1,23 @@ +using NetAdmin.Domain.DbMaps.Dependency; +using NetAdmin.Domain.DbMaps.Dependency.Fields; +using NetAdmin.Domain.DbMaps.Sys; + +namespace NetAdmin.Domain.Dto.Sys.Dept; + +/// +/// 请求:启用/禁用部门 +/// +public sealed record SetDeptEnabledReq : Sys_Dept +{ + /// + [JsonIgnore(Condition = JsonIgnoreCondition.Never)] + public override bool Enabled { get; init; } + + /// + [JsonIgnore(Condition = JsonIgnoreCondition.Never)] + public override long Id { get; init; } + + /// + [JsonIgnore(Condition = JsonIgnoreCondition.Never)] + public override long Version { get; init; } +} \ No newline at end of file diff --git a/src/backend/NetAdmin.Domain/Dto/Sys/Role/SetRoleEnabledReq.cs b/src/backend/NetAdmin.Domain/Dto/Sys/Role/SetRoleEnabledReq.cs new file mode 100644 index 00000000..adb8f04a --- /dev/null +++ b/src/backend/NetAdmin.Domain/Dto/Sys/Role/SetRoleEnabledReq.cs @@ -0,0 +1,23 @@ +using NetAdmin.Domain.DbMaps.Dependency; +using NetAdmin.Domain.DbMaps.Dependency.Fields; +using NetAdmin.Domain.DbMaps.Sys; + +namespace NetAdmin.Domain.Dto.Sys.Role; + +/// +/// 请求:启用/禁用角色 +/// +public sealed record SetRoleEnabledReq : Sys_Role +{ + /// + [JsonIgnore(Condition = JsonIgnoreCondition.Never)] + public override bool Enabled { get; init; } + + /// + [JsonIgnore(Condition = JsonIgnoreCondition.Never)] + public override long Id { get; init; } + + /// + [JsonIgnore(Condition = JsonIgnoreCondition.Never)] + public override long Version { get; init; } +} \ No newline at end of file diff --git a/src/backend/NetAdmin.Domain/Dto/Sys/User/SetUserEnabledReq.cs b/src/backend/NetAdmin.Domain/Dto/Sys/User/SetUserEnabledReq.cs index d562b0fc..8fdf5328 100644 --- a/src/backend/NetAdmin.Domain/Dto/Sys/User/SetUserEnabledReq.cs +++ b/src/backend/NetAdmin.Domain/Dto/Sys/User/SetUserEnabledReq.cs @@ -15,7 +15,6 @@ public sealed record SetUserEnabledReq : Sys_User /// [JsonIgnore(Condition = JsonIgnoreCondition.Never)] - [Required(ErrorMessageResourceType = typeof(Ln), ErrorMessageResourceName = nameof(Ln.用户编号不能为空))] public override long Id { get; init; } /// diff --git a/src/backend/NetAdmin.Infrastructure/Enums/ErrorCodes.cs b/src/backend/NetAdmin.Infrastructure/Enums/ErrorCodes.cs index 12749243..49ff76f1 100644 --- a/src/backend/NetAdmin.Infrastructure/Enums/ErrorCodes.cs +++ b/src/backend/NetAdmin.Infrastructure/Enums/ErrorCodes.cs @@ -15,9 +15,9 @@ public enum ErrorCodes , /// - /// 意外错误 + /// 未处理异常 /// - [ResourceDescription(nameof(Ln.意外错误))] + [ResourceDescription(nameof(Ln.未处理异常))] Unhandled = 9000 , @@ -43,4 +43,12 @@ public enum ErrorCodes /// [ResourceDescription(nameof(Ln.无效操作))] InvalidOperation = 9300 + + , + + /// + /// 外部错误 + /// + [ResourceDescription(nameof(Ln.外部错误))] + ExternalError = 9400 } \ No newline at end of file diff --git a/src/backend/NetAdmin.Infrastructure/Enums/LogLevels.cs b/src/backend/NetAdmin.Infrastructure/Enums/LogLevels.cs index 28cafeb0..c1d221e6 100644 --- a/src/backend/NetAdmin.Infrastructure/Enums/LogLevels.cs +++ b/src/backend/NetAdmin.Infrastructure/Enums/LogLevels.cs @@ -3,6 +3,7 @@ namespace NetAdmin.Infrastructure.Enums; /// /// 日志等级 /// +[Export] public enum LogLevels { /// diff --git a/src/backend/NetAdmin.Infrastructure/Exceptions/NetAdminException.cs b/src/backend/NetAdmin.Infrastructure/Exceptions/NetAdminException.cs index 17899376..ed254852 100644 --- a/src/backend/NetAdmin.Infrastructure/Exceptions/NetAdminException.cs +++ b/src/backend/NetAdmin.Infrastructure/Exceptions/NetAdminException.cs @@ -4,14 +4,9 @@ namespace NetAdmin.Infrastructure.Exceptions; /// NetAdmin异常基类 /// #pragma warning disable RCS1194 -public abstract class NetAdminException : Exception +public abstract class NetAdminException(string message, Exception innerException) : Exception(message, innerException) #pragma warning restore RCS1194 { - /// - /// Initializes a new instance of the class. - /// - protected NetAdminException() { } - /// /// Initializes a new instance of the class. /// @@ -21,12 +16,6 @@ public abstract class NetAdminException : Exception Code = code; } - /// - /// Initializes a new instance of the class. - /// - protected NetAdminException(string message, Exception innerException) // - : base(message, innerException) { } - /// /// 错误码 /// diff --git a/src/backend/NetAdmin.Infrastructure/Exceptions/NetAdminExternalErrorException.cs b/src/backend/NetAdmin.Infrastructure/Exceptions/NetAdminExternalErrorException.cs new file mode 100644 index 00000000..8532406e --- /dev/null +++ b/src/backend/NetAdmin.Infrastructure/Exceptions/NetAdminExternalErrorException.cs @@ -0,0 +1,12 @@ +namespace NetAdmin.Infrastructure.Exceptions; + +/// +/// 外部错误异常 +/// +/// +/// 外部接口调用未得到预期的结果 +/// +#pragma warning disable RCS1194 +public sealed class NetAdminExternalErrorException(string message, Exception innerException = null) + #pragma warning restore RCS1194 + : NetAdminException(ErrorCodes.ExternalError, message, innerException) { } \ No newline at end of file diff --git a/src/backend/NetAdmin.Infrastructure/Exceptions/NetAdminGetLockerException.cs b/src/backend/NetAdmin.Infrastructure/Exceptions/NetAdminGetLockerException.cs index bc97519a..7a53bf6c 100644 --- a/src/backend/NetAdmin.Infrastructure/Exceptions/NetAdminGetLockerException.cs +++ b/src/backend/NetAdmin.Infrastructure/Exceptions/NetAdminGetLockerException.cs @@ -3,6 +3,9 @@ namespace NetAdmin.Infrastructure.Exceptions; /// /// 加锁失败异常 /// +/// +/// 并发执行时锁竞争失败 +/// #pragma warning disable RCS1194 -public sealed class NetAdminGetLockerException : NetAdminException; +public sealed class NetAdminGetLockerException() : NetAdminInvalidOperationException(null) { } #pragma warning restore RCS1194 \ No newline at end of file diff --git a/src/backend/NetAdmin.Infrastructure/Exceptions/NetAdminInvalidInputException.cs b/src/backend/NetAdmin.Infrastructure/Exceptions/NetAdminInvalidInputException.cs index 84ab8869..4286f747 100644 --- a/src/backend/NetAdmin.Infrastructure/Exceptions/NetAdminInvalidInputException.cs +++ b/src/backend/NetAdmin.Infrastructure/Exceptions/NetAdminInvalidInputException.cs @@ -8,6 +8,5 @@ namespace NetAdmin.Infrastructure.Exceptions; /// #pragma warning disable RCS1194 public sealed class NetAdminInvalidInputException(string message = null, Exception innerException = null) - : NetAdminException(ErrorCodes.InvalidInput, message, innerException) -#pragma warning restore RCS1194 -{ } \ No newline at end of file + #pragma warning restore RCS1194 + : NetAdminException(ErrorCodes.InvalidInput, message, innerException) { } \ No newline at end of file diff --git a/src/backend/NetAdmin.Infrastructure/Exceptions/NetAdminInvalidOperationException.cs b/src/backend/NetAdmin.Infrastructure/Exceptions/NetAdminInvalidOperationException.cs index 6b2117f2..0f84c508 100644 --- a/src/backend/NetAdmin.Infrastructure/Exceptions/NetAdminInvalidOperationException.cs +++ b/src/backend/NetAdmin.Infrastructure/Exceptions/NetAdminInvalidOperationException.cs @@ -6,19 +6,7 @@ namespace NetAdmin.Infrastructure.Exceptions; /// /// 非正常的业务流程或逻辑 /// -#pragma warning disable RCS1194, DesignedForInheritance -public class NetAdminInvalidOperationException : NetAdminException -#pragma warning restore DesignedForInheritance, RCS1194 -{ - /// - /// Initializes a new instance of the class. - /// - public NetAdminInvalidOperationException(string message, Exception innerException = null) // - : this(ErrorCodes.InvalidOperation, message, innerException) { } - - /// - /// Initializes a new instance of the class. - /// - protected NetAdminInvalidOperationException(ErrorCodes errorCode, string message, Exception innerException) // - : base(errorCode, message, innerException) { } -} \ No newline at end of file +#pragma warning disable DesignedForInheritance, RCS1194 +public class NetAdminInvalidOperationException(string message, Exception innerException = null) + #pragma warning restore RCS1194, DesignedForInheritance + : NetAdminException(ErrorCodes.InvalidOperation, message, innerException) { } \ No newline at end of file diff --git a/src/backend/NetAdmin.Infrastructure/Exceptions/NetAdminUnexpectedException.cs b/src/backend/NetAdmin.Infrastructure/Exceptions/NetAdminUnexpectedException.cs index 391e7a74..72830a6e 100644 --- a/src/backend/NetAdmin.Infrastructure/Exceptions/NetAdminUnexpectedException.cs +++ b/src/backend/NetAdmin.Infrastructure/Exceptions/NetAdminUnexpectedException.cs @@ -6,25 +6,7 @@ namespace NetAdmin.Infrastructure.Exceptions; /// /// 运行结果是非预期的,例如事务失败回滚 /// -#pragma warning disable RCS1194, DesignedForInheritance -public class NetAdminUnexpectedException : NetAdminException -#pragma warning restore DesignedForInheritance, RCS1194 -{ - /// - /// Initializes a new instance of the class. - /// - public NetAdminUnexpectedException(string message) // - : this(ErrorCodes.Unexpected, message) { } - - /// - /// Initializes a new instance of the class. - /// - public NetAdminUnexpectedException() // - : this(string.Empty) { } - - /// - /// Initializes a new instance of the class. - /// - protected NetAdminUnexpectedException(ErrorCodes errorCode, string message) // - : base(errorCode, message) { } -} \ No newline at end of file +#pragma warning disable RCS1194 +public sealed class NetAdminUnexpectedException(string message, Exception innerException = null) + #pragma warning restore RCS1194 + : NetAdminException(ErrorCodes.Unexpected, message, innerException); \ No newline at end of file diff --git a/src/backend/NetAdmin.Infrastructure/Exceptions/NetAdminValidateException.cs b/src/backend/NetAdmin.Infrastructure/Exceptions/NetAdminValidateException.cs index e00e8ca1..b3264d75 100644 --- a/src/backend/NetAdmin.Infrastructure/Exceptions/NetAdminValidateException.cs +++ b/src/backend/NetAdmin.Infrastructure/Exceptions/NetAdminValidateException.cs @@ -8,8 +8,8 @@ namespace NetAdmin.Infrastructure.Exceptions; /// #pragma warning disable RCS1194 public sealed class NetAdminValidateException(Dictionary validateResults) - : NetAdminException(ErrorCodes.InvalidInput) -#pragma warning restore RCS1194 + #pragma warning restore RCS1194 + : NetAdminInvalidOperationException(null) { /// /// 验证结果 diff --git a/src/backend/NetAdmin.Infrastructure/Extensions/HttpResponseMessageExtensions.cs b/src/backend/NetAdmin.Infrastructure/Extensions/HttpResponseMessageExtensions.cs index ba6e4f14..a03650e2 100644 --- a/src/backend/NetAdmin.Infrastructure/Extensions/HttpResponseMessageExtensions.cs +++ b/src/backend/NetAdmin.Infrastructure/Extensions/HttpResponseMessageExtensions.cs @@ -37,6 +37,6 @@ public static class HttpResponseMessageExtensions Header = me?.ToString() , RequestHeader = me?.RequestMessage?.Headers , Body = bodyHandle is null ? body : bodyHandle(body) - }.ToJson(); + }.Json(); } } \ No newline at end of file diff --git a/src/backend/NetAdmin.Infrastructure/GlobalStatic.cs b/src/backend/NetAdmin.Infrastructure/GlobalStatic.cs index 360c80eb..b6b84253 100644 --- a/src/backend/NetAdmin.Infrastructure/GlobalStatic.cs +++ b/src/backend/NetAdmin.Infrastructure/GlobalStatic.cs @@ -24,6 +24,11 @@ public static class GlobalStatic #endif ; + /// + /// 日志保存跳过的API编号 + /// + public static string[] LogSavingSkipApiIds => ["api/probe/health.check", "api/adm/device.log/create"]; + /// /// 系统内部密钥 /// diff --git a/src/backend/NetAdmin.SysComponent.Application/Modules/Sys/IDeptModule.cs b/src/backend/NetAdmin.SysComponent.Application/Modules/Sys/IDeptModule.cs index 54a3e87e..21f0ce00 100644 --- a/src/backend/NetAdmin.SysComponent.Application/Modules/Sys/IDeptModule.cs +++ b/src/backend/NetAdmin.SysComponent.Application/Modules/Sys/IDeptModule.cs @@ -16,4 +16,9 @@ public interface IDeptModule : ICrudModule Task EditAsync(EditDeptReq req); + + /// + /// 启用/禁用部门 + /// + Task SetEnabledAsync(SetDeptEnabledReq req); } \ No newline at end of file diff --git a/src/backend/NetAdmin.SysComponent.Application/Modules/Sys/IRoleModule.cs b/src/backend/NetAdmin.SysComponent.Application/Modules/Sys/IRoleModule.cs index 36a46256..621dd45e 100644 --- a/src/backend/NetAdmin.SysComponent.Application/Modules/Sys/IRoleModule.cs +++ b/src/backend/NetAdmin.SysComponent.Application/Modules/Sys/IRoleModule.cs @@ -16,4 +16,9 @@ public interface IRoleModule : ICrudModule Task EditAsync(EditRoleReq req); + + /// + /// 启用/禁用角色 + /// + Task SetEnabledAsync(SetRoleEnabledReq req); } \ No newline at end of file diff --git a/src/backend/NetAdmin.SysComponent.Application/Services/Sys/DeptService.cs b/src/backend/NetAdmin.SysComponent.Application/Services/Sys/DeptService.cs index 1c029ce4..aa811ea1 100644 --- a/src/backend/NetAdmin.SysComponent.Application/Services/Sys/DeptService.cs +++ b/src/backend/NetAdmin.SysComponent.Application/Services/Sys/DeptService.cs @@ -119,6 +119,13 @@ public sealed class DeptService(BasicRepository rpo) // .ConfigureAwait(false)).Adapt>(); } + /// + public Task SetEnabledAsync(SetDeptEnabledReq req) + { + req.ThrowIfInvalid(); + return UpdateAsync(req, [nameof(req.Enabled)]); + } + private ISelect QueryInternal(QueryReq req, bool asTreeCte = false) { var ret = Rpo.Select.WhereDynamicFilter(req.DynamicFilter) diff --git a/src/backend/NetAdmin.SysComponent.Application/Services/Sys/JobService.cs b/src/backend/NetAdmin.SysComponent.Application/Services/Sys/JobService.cs index 24f7f7be..f752c7c7 100644 --- a/src/backend/NetAdmin.SysComponent.Application/Services/Sys/JobService.cs +++ b/src/backend/NetAdmin.SysComponent.Application/Services/Sys/JobService.cs @@ -75,8 +75,8 @@ public sealed class JobService(BasicRepository rpo, IJobRecordSer .Set(a => a.RequestBody == req.RequestBody) .Set(a => a.RequestUrl == req.RequestUrl) .Set(a => a.UserId == req.UserId) - .Where(a => a.Id == req.Id) - .Where(a => a.Version == req.Version); + .Set(a => a.Summary == req.Summary) + .Where(a => a.Id == req.Id); #if DBTYPE_SQLSERVER return (await update.ExecuteUpdatedAsync().ConfigureAwait(false)).FirstOrDefault()?.Adapt(); @@ -276,11 +276,22 @@ public sealed class JobService(BasicRepository rpo, IJobRecordSer } /// - public Task ReleaseStuckTaskAsync() + public async Task ReleaseStuckTaskAsync() { - return UpdateAsync( // - new Sys_Job { Status = JobStatues.Idle }, [nameof(Sys_Job.Status)], null - , a => a.Status == JobStatues.Running && a.LastExecTime < DateTime.Now.AddSeconds(-Numbers.SECS_TIMEOUT_JOB)); + var ret1 = await UpdateAsync( // 运行中,运行时间超过超时设定;置为空闲状态 + new Sys_Job { Status = JobStatues.Idle }, [nameof(Sys_Job.Status)], null + , a => a.Status == JobStatues.Running && + a.LastExecTime < DateTime.Now.AddSeconds(-Numbers.SECS_TIMEOUT_JOB) + , true) + .ConfigureAwait(false); + + var ret2 = await UpdateAsync( // 空闲中,下次执行时间在当前时间减去超时时间以前;将下次执行时间调整到现在 + new Sys_Job { NextExecTime = DateTime.Now, NextTimeId = DateTime.Now.TimeUnixUtc() } + , [nameof(Sys_Job.NextExecTime), nameof(Sys_Job.NextTimeId)], null + , a => a.Status == JobStatues.Idle && a.NextExecTime < DateTime.Now.AddSeconds(-Numbers.SECS_TIMEOUT_JOB) + , true) + .ConfigureAwait(false); + return ret1 + ret2; } /// diff --git a/src/backend/NetAdmin.SysComponent.Application/Services/Sys/RoleService.cs b/src/backend/NetAdmin.SysComponent.Application/Services/Sys/RoleService.cs index 6734745d..3000a878 100644 --- a/src/backend/NetAdmin.SysComponent.Application/Services/Sys/RoleService.cs +++ b/src/backend/NetAdmin.SysComponent.Application/Services/Sys/RoleService.cs @@ -123,6 +123,13 @@ public sealed class RoleService(BasicRepository rpo) // return ret.Adapt>(); } + /// + public Task SetEnabledAsync(SetRoleEnabledReq req) + { + req.ThrowIfInvalid(); + return UpdateAsync(req, [nameof(req.Enabled)]); + } + private ISelect QueryInternal(QueryReq req) { var ret = Rpo.Select.IncludeMany(a => a.Depts.Select(b => new Sys_Dept { Id = b.Id })) diff --git a/src/backend/NetAdmin.SysComponent.Cache/Sys/DeptCache.cs b/src/backend/NetAdmin.SysComponent.Cache/Sys/DeptCache.cs index 98a5ade1..dbb2a453 100644 --- a/src/backend/NetAdmin.SysComponent.Cache/Sys/DeptCache.cs +++ b/src/backend/NetAdmin.SysComponent.Cache/Sys/DeptCache.cs @@ -63,4 +63,10 @@ public sealed class DeptCache(IDistributedCache cache, IDeptService service) // { return Service.QueryAsync(req); } + + /// + public Task SetEnabledAsync(SetDeptEnabledReq req) + { + return Service.SetEnabledAsync(req); + } } \ No newline at end of file diff --git a/src/backend/NetAdmin.SysComponent.Cache/Sys/RoleCache.cs b/src/backend/NetAdmin.SysComponent.Cache/Sys/RoleCache.cs index 3ab6ce64..3279dd85 100644 --- a/src/backend/NetAdmin.SysComponent.Cache/Sys/RoleCache.cs +++ b/src/backend/NetAdmin.SysComponent.Cache/Sys/RoleCache.cs @@ -63,4 +63,10 @@ public sealed class RoleCache(IDistributedCache cache, IRoleService service) // { return Service.QueryAsync(req); } + + /// + public Task SetEnabledAsync(SetRoleEnabledReq req) + { + return Service.SetEnabledAsync(req); + } } \ No newline at end of file diff --git a/src/backend/NetAdmin.SysComponent.Host/Controllers/Sys/DeptController.cs b/src/backend/NetAdmin.SysComponent.Host/Controllers/Sys/DeptController.cs index 8b7916ff..b658cc13 100644 --- a/src/backend/NetAdmin.SysComponent.Host/Controllers/Sys/DeptController.cs +++ b/src/backend/NetAdmin.SysComponent.Host/Controllers/Sys/DeptController.cs @@ -91,4 +91,12 @@ public sealed class DeptController(IDeptCache cache) : ControllerBase + /// 启用/禁用部门 + /// + public Task SetEnabledAsync(SetDeptEnabledReq req) + { + return Cache.SetEnabledAsync(req); + } } \ No newline at end of file diff --git a/src/backend/NetAdmin.SysComponent.Host/Controllers/Sys/RoleController.cs b/src/backend/NetAdmin.SysComponent.Host/Controllers/Sys/RoleController.cs index 480f8228..bd9ce0d0 100644 --- a/src/backend/NetAdmin.SysComponent.Host/Controllers/Sys/RoleController.cs +++ b/src/backend/NetAdmin.SysComponent.Host/Controllers/Sys/RoleController.cs @@ -90,4 +90,12 @@ public sealed class RoleController(IRoleCache cache) : ControllerBase + /// 启用/禁用角色 + /// + public Task SetEnabledAsync(SetRoleEnabledReq req) + { + return Cache.SetEnabledAsync(req); + } } \ No newline at end of file diff --git a/src/backend/NetAdmin.SysComponent.Host/Subscribers/OperationLogger.cs b/src/backend/NetAdmin.SysComponent.Host/Subscribers/OperationLogger.cs index 1bcac7db..d65abbe9 100644 --- a/src/backend/NetAdmin.SysComponent.Host/Subscribers/OperationLogger.cs +++ b/src/backend/NetAdmin.SysComponent.Host/Subscribers/OperationLogger.cs @@ -20,8 +20,10 @@ public sealed class OperationLogger : IEventSubscriber return; } - // 跳过心跳请求 - if (operationEvent.Data.ApiId.Equals("api/probe/health.check", StringComparison.OrdinalIgnoreCase)) { + // 跳过指定的请求 + if (Array.Exists( // + GlobalStatic.LogSavingSkipApiIds + , x => x.Equals(operationEvent.Data.ApiId, StringComparison.OrdinalIgnoreCase))) { return; } diff --git a/src/frontend/admin/src/api/sys/dept.js b/src/frontend/admin/src/api/sys/dept.js index ed41b83a..7460e4bf 100644 --- a/src/frontend/admin/src/api/sys/dept.js +++ b/src/frontend/admin/src/api/sys/dept.js @@ -81,4 +81,15 @@ export default { return await http.post(this.url, data, config) }, }, + + /** + * 启用/禁用部门 + */ + setEnabled: { + url: `${config.API_URL}/api/sys/dept/set.enabled`, + name: `启用/禁用部门`, + post: async function (data = {}, config = {}) { + return await http.post(this.url, data, config) + }, + }, } \ No newline at end of file diff --git a/src/frontend/admin/src/api/sys/role.js b/src/frontend/admin/src/api/sys/role.js index 70287e14..b49b2f9b 100644 --- a/src/frontend/admin/src/api/sys/role.js +++ b/src/frontend/admin/src/api/sys/role.js @@ -92,4 +92,15 @@ export default { return await http.post(this.url, data, config) }, }, + + /** + * 启用/禁用角色 + */ + setEnabled: { + url: `${config.API_URL}/api/sys/role/set.enabled`, + name: `启用/禁用角色`, + post: async function (data = {}, config = {}) { + return await http.post(this.url, data, config) + }, + }, } \ No newline at end of file diff --git a/src/frontend/admin/src/components/naArea/index.vue b/src/frontend/admin/src/components/naArea/index.vue index 89fd59b8..51f8d2f1 100644 --- a/src/frontend/admin/src/components/naArea/index.vue +++ b/src/frontend/admin/src/components/naArea/index.vue @@ -14,8 +14,8 @@ - - + + diff --git a/src/frontend/admin/src/components/naColIndicator/index.vue b/src/frontend/admin/src/components/naColIndicator/index.vue index 6a121cf7..f28e00c0 100644 --- a/src/frontend/admin/src/components/naColIndicator/index.vue +++ b/src/frontend/admin/src/components/naColIndicator/index.vue @@ -1,17 +1,17 @@ - - - + + + diff --git a/src/frontend/admin/src/components/scForm/items/tableselect.vue b/src/frontend/admin/src/components/scForm/items/tableselect.vue index 29131323..90851625 100644 --- a/src/frontend/admin/src/components/scForm/items/tableselect.vue +++ b/src/frontend/admin/src/components/scForm/items/tableselect.vue @@ -6,12 +6,7 @@ :props="item.options.props" :table-width="60" style="width: 100%"> - + diff --git a/src/frontend/admin/src/components/scTable/index.vue b/src/frontend/admin/src/components/scTable/index.vue index 93c743db..3ebc7269 100644 --- a/src/frontend/admin/src/components/scTable/index.vue +++ b/src/frontend/admin/src/components/scTable/index.vue @@ -46,7 +46,7 @@ - + diff --git a/src/frontend/admin/src/components/scTableSelect/index.vue b/src/frontend/admin/src/components/scTableSelect/index.vue index 4ae5b9d9..3d835df4 100644 --- a/src/frontend/admin/src/components/scTableSelect/index.vue +++ b/src/frontend/admin/src/components/scTableSelect/index.vue @@ -36,7 +36,7 @@ @select-all="selectAll" max-height="30rem" ref="table"> - + - + diff --git a/src/frontend/admin/src/views/sys/api/index.vue b/src/frontend/admin/src/views/sys/api/index.vue index 509b8bcc..3733b6f3 100644 --- a/src/frontend/admin/src/views/sys/api/index.vue +++ b/src/frontend/admin/src/views/sys/api/index.vue @@ -16,8 +16,8 @@ row-key="id" show-summary stripe> - - + + - - + sortable="custom" + width="100" /> + diff --git a/src/frontend/admin/src/views/sys/cache/index.vue b/src/frontend/admin/src/views/sys/cache/index.vue index bd0c8f65..ad1f532a 100644 --- a/src/frontend/admin/src/views/sys/cache/index.vue +++ b/src/frontend/admin/src/views/sys/cache/index.vue @@ -5,7 +5,7 @@ - + @@ -13,7 +13,7 @@ @@ -21,7 +21,7 @@ @@ -31,13 +31,13 @@ - + @@ -45,7 +45,7 @@ diff --git a/src/frontend/admin/src/views/sys/config/index.vue b/src/frontend/admin/src/views/sys/config/index.vue index 74db2b1f..fba1efad 100644 --- a/src/frontend/admin/src/views/sys/config/index.vue +++ b/src/frontend/admin/src/views/sys/config/index.vue @@ -1,31 +1,39 @@