This commit is contained in:
he
2025-04-09 09:45:49 +08:00
parent 8213c6d10f
commit 68d69181a9
8 changed files with 19247 additions and 14 deletions
@@ -27,6 +27,7 @@ namespace IRaCIS.Core.Application.ViewModel
public bool IsLoginUncommonly { get; set; }
public bool IsIgnoreUncommonly { get; set; }
public string JsonObj { get; set; }
@@ -43,6 +44,13 @@ namespace IRaCIS.Core.Application.ViewModel
public UserMFAType MFAType { get; set; } = UserMFAType.Login;
}
public class SetIsIgnoreUncommonlyInDto
{
public Guid Id { get; set; }
public bool IsIgnoreUncommonly { get; set; }
}
///<summary>UserLogQuery 列表查询参数模型</summary>
public class UserLogQuery : PageInput
{
@@ -50,10 +58,13 @@ namespace IRaCIS.Core.Application.ViewModel
public List<UserOptType>? OptTypeList { get; set; }
public List<UserOptType> OptTypeList { get; set; } = new List<UserOptType>();
public string? IP { get; set; }
public string? LoginFaildName { get; set; }
public string? LoginUserName { get; set; }
public DateTime? BeginDate { get; set; }
@@ -835,7 +835,17 @@ namespace IRaCIS.Core.Application.Service
return ResponseOutput.Ok();
}
/// <summary>
/// 设置是否忽略异地登录
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
[HttpPost]
public async Task<IResponseOutput> SetIsIgnoreUncommonly(SetIsIgnoreUncommonlyInDto inDto)
{
await _userLogRepository.UpdatePartialFromQueryAsync(inDto.Id, x => new UserLog() { IsIgnoreUncommonly = inDto.IsIgnoreUncommonly }, true);
return ResponseOutput.Ok();
}
[HttpPost]
public async Task<PageOutput<UserLogView>> GetUserLogList(UserLogQuery inQuery)
@@ -846,6 +856,7 @@ namespace IRaCIS.Core.Application.Service
var userLogQueryable =
_userLogRepository.AsQueryable().IgnoreQueryFilters()
.WhereIf(inQuery.OptTypeList.Count()>0, t => inQuery.OptTypeList.Contains(t.OptType))
.WhereIf(inQuery.IdentityUserId != null, t => t.ActionIdentityUserId == inQuery.IdentityUserId)
.WhereIf(inQuery.TargetIdentityUserId != null, t => t.TargetIdentityUserId == inQuery.TargetIdentityUserId)
.WhereIf(inQuery.TrialId != null, t => t.ActionIdentityUser.UserTrialList.Any(c => c.TrialId == inQuery.TrialId) || t.TargetIdentityUser.UserTrialList.Any(c => c.TrialId == inQuery.TrialId))
@@ -853,7 +864,8 @@ namespace IRaCIS.Core.Application.Service
.WhereIf(inQuery.OptTypeList != null && inQuery.OptTypeList.Count > 0, t => inQuery.OptTypeList.Contains(t.OptType))
.WhereIf(inQuery.BeginDate != null, t => t.CreateTime >= inQuery.BeginDate)
.WhereIf(inQuery.EndDate != null, t => t.CreateTime <= inQuery.EndDate)
.WhereIf(inQuery.IsLoginUncommonly != null, t => t.IsLoginUncommonly == inQuery.IsLoginUncommonly)
.WhereIf(inQuery.IsLoginUncommonly != null && inQuery.IsLoginUncommonly.Value, t => t.IsLoginUncommonly&&!t.IsIgnoreUncommonly)
.WhereIf(inQuery.IsLoginUncommonly != null && !inQuery.IsLoginUncommonly.Value, t => !t.IsLoginUncommonly || t.IsIgnoreUncommonly)
.WhereIf(!string.IsNullOrEmpty(inQuery.LoginUserName), t => t.ActionUserName.Contains(inQuery.LoginUserName!))
.WhereIf(!string.IsNullOrEmpty(inQuery.LoginFaildName), t => t.ActionUserName.Contains(inQuery.LoginFaildName!))
.WhereIf(!string.IsNullOrEmpty(inQuery.IP), t => t.IP.Contains(inQuery.IP!))