:zap:强退功能优化
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
using ZR.Model;
|
||||
using Infrastructure;
|
||||
using System;
|
||||
using ZR.Model;
|
||||
using ZR.Model.System;
|
||||
using ZR.Model.System.Dto;
|
||||
|
||||
namespace ZR.Service.System.IService
|
||||
{
|
||||
public interface ISysLoginService: IBaseService<SysLogininfor>
|
||||
public interface ISysLoginService : IBaseService<SysLogininfor>
|
||||
{
|
||||
/// <summary>
|
||||
/// 登录
|
||||
@@ -40,5 +42,7 @@ namespace ZR.Service.System.IService
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
public int DeleteLogininforByIds(long[] ids);
|
||||
|
||||
void CheckLockUser(string userName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace ZR.Service.System
|
||||
ClientInfo clientInfo = httpContextAccessor.HttpContext.GetClientInfo();
|
||||
logininfor.Browser = clientInfo.ToString();
|
||||
logininfor.Os = clientInfo.OS.ToString();
|
||||
|
||||
|
||||
if (user == null || user.UserId <= 0)
|
||||
{
|
||||
logininfor.Msg = "用户名或密码错误";
|
||||
@@ -121,5 +121,18 @@ namespace ZR.Service.System
|
||||
{
|
||||
return Delete(ids);
|
||||
}
|
||||
|
||||
public void CheckLockUser(string userName)
|
||||
{
|
||||
var lockTimeStamp = CacheService.GetLockUser(userName);
|
||||
var lockTime = DateTimeHelper.ToLocalTimeDateBySeconds(lockTimeStamp);
|
||||
var ts = lockTime - DateTime.Now;
|
||||
|
||||
if (lockTimeStamp > 0 && ts.TotalSeconds > 0)
|
||||
{
|
||||
throw new CustomException(ResultCode.LOGIN_ERROR, $"你的账号已被锁,剩余{Math.Round(ts.TotalMinutes, 0)}分钟");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user