Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is passing
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -48,7 +48,7 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||
{
|
||||
public Guid? TrialId { get; set; }
|
||||
|
||||
public List<UserOptType> OptTypeList { get; set; }
|
||||
public List<UserOptType>? OptTypeList { get; set; }
|
||||
|
||||
public string? IP { get; set; }
|
||||
|
||||
|
||||
@@ -850,7 +850,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
.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))
|
||||
.WhereIf(trialCreateTime != null, t => t.CreateTime >= trialCreateTime)
|
||||
.WhereIf(inQuery.OptTypeList != null && inQuery.OptTypeList.Count>0, t => inQuery.OptTypeList.Contains(t.OptType))
|
||||
.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)
|
||||
@@ -958,29 +958,31 @@ namespace IRaCIS.Core.Application.Service
|
||||
//账号在系统存在
|
||||
if (isExistAccount || loginUser != null)
|
||||
{
|
||||
var ipinfo = _searcher.Search(_userInfo.IP);
|
||||
//var ipinfo = _searcher.Search(_userInfo.IP);
|
||||
|
||||
var iPRegion = string.Join('|', ipinfo.Split('|').TakeLast(3));
|
||||
//var iPRegion = string.Join('|', ipinfo.Split('|').TakeLast(3));
|
||||
|
||||
string SplitAndConcatenate(string input)
|
||||
//string SplitAndConcatenate(string input)
|
||||
//{
|
||||
// string[] parts = input.Split('|');
|
||||
// return parts.Length >= 3 ? parts[0] + parts[1] : string.Join("", parts);
|
||||
//}
|
||||
|
||||
var iPRegion = IPCityHelper.GetCityResponse(_userInfo.IP);
|
||||
|
||||
//设置本次登录的IP
|
||||
await _identityUserRepository.BatchUpdateNoTrackingAsync(x => x.Id == existUserLoginInfo.Id, x => new IdentityUser()
|
||||
{
|
||||
string[] parts = input.Split('|');
|
||||
return parts.Length >= 3 ? parts[0] + parts[1] : string.Join("", parts);
|
||||
}
|
||||
LastLoginIP = iPRegion,
|
||||
LastLoginTime = DateTime.Now
|
||||
|
||||
});
|
||||
|
||||
if (existUserLoginInfo.LastLoginIP != string.Empty)
|
||||
{
|
||||
//设置上次登录的IP
|
||||
await _identityUserRepository.BatchUpdateNoTrackingAsync(x => x.Id == existUserLoginInfo.Id, x => new IdentityUser()
|
||||
{
|
||||
LastLoginIP = iPRegion,
|
||||
LastLoginTime = DateTime.Now
|
||||
|
||||
});
|
||||
|
||||
|
||||
// 与上一次区域不一致
|
||||
if (SplitAndConcatenate(existUserLoginInfo.LastLoginIP) != SplitAndConcatenate(iPRegion))
|
||||
//if (SplitAndConcatenate(existUserLoginInfo.LastLoginIP) != SplitAndConcatenate(iPRegion))
|
||||
if (existUserLoginInfo.LastLoginIP != iPRegion)
|
||||
{
|
||||
|
||||
isLoginUncommonly = true;
|
||||
@@ -1019,7 +1021,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
}
|
||||
|
||||
|
||||
//登录成功的,才会算异地登录
|
||||
if (loginUser.Status == 0)
|
||||
{
|
||||
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = loginUser.IdentityUserId, ActionUserName = loginUser.UserName, OptType = UserOptType.LoginLockedAccount, IsLoginUncommonly = isLoginUncommonly }, true);
|
||||
|
||||
Reference in New Issue
Block a user