update 修改所有datetimeoffset类型为datetime
This commit is contained in:
@@ -115,10 +115,14 @@ namespace Ewide.Core.Service
|
||||
var httpContext = App.GetService<IHttpContextAccessor>().HttpContext;
|
||||
var loginOutput = user.Adapt<LoginOutput>();
|
||||
|
||||
loginOutput.LastLoginTime = user.LastLoginTime = DateTimeOffset.Now;
|
||||
loginOutput.LastLoginTime = user.LastLoginTime = DateTime.Now;
|
||||
var ip = httpContext.Request.Headers["X-Real-IP"].FirstOrDefault();
|
||||
loginOutput.LastLoginIp = user.LastLoginIp = string.IsNullOrEmpty(user.LastLoginIp) ? httpContext.GetRemoteIpAddressToIPv4() : ip;
|
||||
|
||||
///如果真实ip为空的话,就获取客户端主机IPv4地址
|
||||
if (string.IsNullOrEmpty(ip))
|
||||
{
|
||||
loginOutput.LastLoginIp = httpContext.GetRemoteIpAddressToIPv4();
|
||||
}
|
||||
//var ipInfo = IpTool.Search(loginOutput.LastLoginIp);
|
||||
//loginOutput.LastLoginAddress = ipInfo.Country + ipInfo.Province + ipInfo.City + "[" + ipInfo.NetworkOperator + "][" + ipInfo.Latitude + ipInfo.Longitude + "]";
|
||||
|
||||
@@ -174,14 +178,34 @@ namespace Ewide.Core.Service
|
||||
{
|
||||
_httpContextAccessor.SignoutToSwagger();
|
||||
//_httpContextAccessor.HttpContext.Response.Headers["access-token"] = "invalid token";
|
||||
var user = _userManager.User;
|
||||
var userId = user.Id;
|
||||
|
||||
var httpContext = App.GetService<IHttpContextAccessor>().HttpContext;
|
||||
var loginOutput = user.Adapt<LoginOutput>();
|
||||
|
||||
|
||||
var ip = httpContext.Request.Headers["X-Real-IP"];
|
||||
var LastLoginIp = user.LastLoginIp = string.IsNullOrEmpty(user.LastLoginIp) ? httpContext.GetRemoteIpAddressToIPv4() : ip;
|
||||
var clent = Parser.GetDefault().Parse(httpContext.Request.Headers["User-Agent"]);
|
||||
loginOutput.LastLoginBrowser = clent.UA.Family + clent.UA.Major;
|
||||
///如果真实ip为空的话,就获取客户端主机IPv4地址
|
||||
if (string.IsNullOrEmpty(ip))
|
||||
{
|
||||
LastLoginIp = httpContext.GetRemoteIpAddressToIPv4();
|
||||
}
|
||||
// 增加退出日志
|
||||
await new SysLogVis
|
||||
{
|
||||
Name = "退出",
|
||||
VisTime = DateTime.Now,
|
||||
Success = true,
|
||||
Message = "退出成功",
|
||||
VisType = 2
|
||||
VisType = 2,
|
||||
Browser = loginOutput.LastLoginBrowser,
|
||||
Os = loginOutput.LastLoginOs,
|
||||
Ip = LastLoginIp,
|
||||
Account = loginOutput.Account
|
||||
}.InsertAsync();
|
||||
|
||||
await Task.CompletedTask;
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Ewide.Core.Service
|
||||
/// <summary>
|
||||
/// 生日
|
||||
/// </summary>
|
||||
public DateTimeOffset Birthday { get; set; }
|
||||
public DateTime? Birthday { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 性别(字典 1男 2女)
|
||||
@@ -73,7 +73,7 @@ namespace Ewide.Core.Service
|
||||
/// <summary>
|
||||
/// 最后登陆时间
|
||||
/// </summary>
|
||||
public DateTimeOffset LastLoginTime { get; set; }
|
||||
public DateTime LastLoginTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最后登陆地址
|
||||
|
||||
Reference in New Issue
Block a user