mirror of
https://github.com/nsnail/NetAdmin.git
synced 2025-12-29 00:55:48 +08:00
feat: ✨ 登录日志独立存储 (#161)
请求日志自动分表 [skip ci] Co-authored-by: tk <fiyne1a@dingtalk.com>
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
using NetAdmin.Domain.Dto.Dependency;
|
||||
using NetAdmin.Domain.Dto.Sys.Cache;
|
||||
using NetAdmin.Host.Controllers;
|
||||
using NetAdmin.SysComponent.Application.Modules.Sys;
|
||||
@@ -24,8 +23,16 @@ public sealed class CacheController(ICacheCache cache) : ControllerBase<ICacheCa
|
||||
/// <summary>
|
||||
/// 获取所有缓存项
|
||||
/// </summary>
|
||||
public Task<PagedQueryRsp<GetAllEntriesRsp>> GetAllEntriesAsync(PagedQueryReq<GetAllEntriesReq> req)
|
||||
public Task<IEnumerable<GetEntryRsp>> GetAllEntriesAsync(GetAllEntriesReq req)
|
||||
{
|
||||
return Cache.GetAllEntriesAsync(req);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取缓存项
|
||||
/// </summary>
|
||||
public Task<GetEntryRsp> GetEntryAsync(GetEntriesReq req)
|
||||
{
|
||||
return Cache.GetEntryAsync(req);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
using NetAdmin.Domain.Dto.Dependency;
|
||||
using NetAdmin.Domain.Dto.Sys.LoginLog;
|
||||
using NetAdmin.Host.Attributes;
|
||||
using NetAdmin.Host.Controllers;
|
||||
using NetAdmin.SysComponent.Application.Modules.Sys;
|
||||
using NetAdmin.SysComponent.Application.Services.Sys.Dependency;
|
||||
using NetAdmin.SysComponent.Cache.Sys.Dependency;
|
||||
|
||||
namespace NetAdmin.SysComponent.Host.Controllers.Sys;
|
||||
|
||||
/// <summary>
|
||||
/// 登录日志服务
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(nameof(Sys), Module = nameof(Sys))]
|
||||
public sealed class LoginLogController(ILoginLogCache cache) : ControllerBase<ILoginLogCache, ILoginLogService>(cache)
|
||||
, ILoginLogModule
|
||||
{
|
||||
/// <summary>
|
||||
/// 批量删除登录日志
|
||||
/// </summary>
|
||||
[Transaction]
|
||||
public Task<int> BulkDeleteAsync(BulkReq<DelReq> req)
|
||||
{
|
||||
return Cache.BulkDeleteAsync(req);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 登录日志计数
|
||||
/// </summary>
|
||||
public Task<long> CountAsync(QueryReq<QueryLoginLogReq> req)
|
||||
{
|
||||
return Cache.CountAsync(req);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建登录日志
|
||||
/// </summary>
|
||||
[Transaction]
|
||||
public Task<QueryLoginLogRsp> CreateAsync(CreateLoginLogReq req)
|
||||
{
|
||||
return Cache.CreateAsync(req);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除登录日志
|
||||
/// </summary>
|
||||
[Transaction]
|
||||
public Task<int> DeleteAsync(DelReq req)
|
||||
{
|
||||
return Cache.DeleteAsync(req);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 登录日志是否存在
|
||||
/// </summary>
|
||||
public Task<bool> ExistAsync(QueryReq<QueryLoginLogReq> req)
|
||||
{
|
||||
return Cache.ExistAsync(req);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导出登录日志
|
||||
/// </summary>
|
||||
public Task<IActionResult> ExportAsync(QueryReq<QueryLoginLogReq> req)
|
||||
{
|
||||
return Cache.ExportAsync(req);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取单个登录日志
|
||||
/// </summary>
|
||||
public Task<QueryLoginLogRsp> GetAsync(QueryLoginLogReq req)
|
||||
{
|
||||
return Cache.GetAsync(req);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分页查询登录日志
|
||||
/// </summary>
|
||||
public Task<PagedQueryRsp<QueryLoginLogRsp>> PagedQueryAsync(PagedQueryReq<QueryLoginLogReq> req)
|
||||
{
|
||||
return Cache.PagedQueryAsync(req);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询登录日志
|
||||
/// </summary>
|
||||
public Task<IEnumerable<QueryLoginLogRsp>> QueryAsync(QueryReq<QueryLoginLogReq> req)
|
||||
{
|
||||
return Cache.QueryAsync(req);
|
||||
}
|
||||
}
|
||||
@@ -13,8 +13,8 @@ namespace NetAdmin.SysComponent.Host.Controllers.Sys;
|
||||
/// 请求日志服务
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(nameof(Sys), Module = nameof(Sys))]
|
||||
public sealed class LogController(IRequestLogCache cache) : ControllerBase<IRequestLogCache, IRequestLogService>(cache)
|
||||
, IRequestLogModule
|
||||
public sealed class RequestLogController(IRequestLogCache cache)
|
||||
: ControllerBase<IRequestLogCache, IRequestLogService>(cache), IRequestLogModule
|
||||
{
|
||||
/// <summary>
|
||||
/// 批量删除请求日志
|
||||
Reference in New Issue
Block a user