维护用户登录区域
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
d5cd8dc338
commit
c68004b804
|
@ -1449,6 +1449,13 @@
|
||||||
</summary>
|
</summary>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:IRaCIS.Core.Application.Service.AuditDocumentService.CopyFileOrFolder(IRaCIS.Core.Application.ViewModel.MovieFileOrFolderInDto)">
|
||||||
|
<summary>
|
||||||
|
复制文件或者文件夹
|
||||||
|
</summary>
|
||||||
|
<param name="inDto"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:IRaCIS.Core.Application.Service.AuditDocumentService.GetHistoricalVersion(IRaCIS.Core.Application.ViewModel.GetHistoricalVersionInDto)">
|
<member name="M:IRaCIS.Core.Application.Service.AuditDocumentService.GetHistoricalVersion(IRaCIS.Core.Application.ViewModel.GetHistoricalVersionInDto)">
|
||||||
<summary>
|
<summary>
|
||||||
获取历史版本
|
获取历史版本
|
||||||
|
|
|
@ -1021,7 +1021,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//登录成功的,才会算异地登录
|
||||||
if (loginUser.Status == 0)
|
if (loginUser.Status == 0)
|
||||||
{
|
{
|
||||||
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = loginUser.IdentityUserId, ActionUserName = loginUser.UserName, OptType = UserOptType.LoginLockedAccount, IsLoginUncommonly = isLoginUncommonly }, true);
|
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = loginUser.IdentityUserId, ActionUserName = loginUser.UserName, OptType = UserOptType.LoginLockedAccount, IsLoginUncommonly = isLoginUncommonly }, true);
|
||||||
|
|
|
@ -97,7 +97,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
}
|
}
|
||||||
|
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
public async Task<IResponseOutput> NewIP([FromServices] IRepository<UserLog> _userLogRepository)
|
public async Task<IResponseOutput> NewIP([FromServices] IRepository<UserLog> _userLogRepository, [FromServices] IRepository<IdentityUser> _identityUserRepository)
|
||||||
{
|
{
|
||||||
var path = Path.Combine(AppContext.BaseDirectory, StaticData.Folder.Resources, "GeoLite2-City.mmdb");
|
var path = Path.Combine(AppContext.BaseDirectory, StaticData.Folder.Resources, "GeoLite2-City.mmdb");
|
||||||
|
|
||||||
|
@ -112,6 +112,20 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#region 用户表最后一次登录的ipRegion 需要维护
|
||||||
|
|
||||||
|
var userList = _identityUserRepository.Where(t => t.LastLoginIP != "").Select(t => new { t.Id, t.LastLoginIP, t.UpdateUserId }).ToList();
|
||||||
|
|
||||||
|
foreach (var user in userList)
|
||||||
|
{
|
||||||
|
var lastLoginRegion = _userLogRepository.Where(t => t.ActionIdentityUserId == user.Id && (t.OptType == UserOptType.Login || t.OptType == UserOptType.LoginLockedAccount)).OrderByDescending(t => t.CreateTime).Select(t => t.IPRegion).FirstOrDefault()??string.Empty;
|
||||||
|
|
||||||
|
await _identityUserRepository.BatchUpdateNoTrackingAsync(t => t.Id == user.Id, u => new Domain.Models.IdentityUser() { LastLoginIP = lastLoginRegion, UpdateUserId = user.UpdateUserId });
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
return ResponseOutput.Ok();
|
return ResponseOutput.Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue