update 修改所有datetimeoffset类型为datetime

This commit is contained in:
2021-04-30 11:35:08 +08:00
parent a2589676cb
commit df2e5c51fc
29 changed files with 72 additions and 47 deletions

View File

@@ -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;

View File

@@ -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>
/// 最后登陆地址

View File

@@ -85,7 +85,7 @@ namespace Ewide.Core.Service
/// <summary>
/// 操作时间
/// </summary>
public DateTimeOffset OpTime { get; set; }
public DateTime OpTime { get; set; }
/// <summary>
/// 操作人

View File

@@ -50,7 +50,7 @@ namespace Ewide.Core.Service
/// <summary>
/// 访问时间
/// </summary>
public DateTimeOffset VisTime { get; set; }
public DateTime VisTime { get; set; }
/// <summary>
/// 访问人

View File

@@ -45,12 +45,12 @@ namespace Ewide.Core.Service
/// <summary>
/// 发布时间
/// </summary>
public DateTimeOffset PublicTime { get; set; }
public DateTime PublicTime { get; set; }
/// <summary>
/// 撤回时间
/// </summary>
public DateTimeOffset CancelTime { get; set; }
public DateTime CancelTime { get; set; }
/// <summary>
/// 状态(字典 0草稿 1发布 2撤回 3删除

View File

@@ -39,6 +39,6 @@ namespace Ewide.Core.Service
/// <summary>
/// 阅读时间
/// </summary>
public DateTimeOffset ReadTime { get; set; }
public DateTime ReadTime { get; set; }
}
}

View File

@@ -20,6 +20,6 @@ namespace Ewide.Core.Service
/// <summary>
/// 阅读时间
/// </summary>
public DateTimeOffset ReadTime { get; set; }
public DateTime ReadTime { get; set; }
}
}

View File

@@ -70,7 +70,7 @@ namespace Ewide.Core.Service.Notice
await UpdatePublicInfo(notice);
// 如果是发布,则设置发布时间
if (input.Status == (int)NoticeStatus.PUBLIC)
notice.PublicTime = DateTimeOffset.Now;
notice.PublicTime = DateTime.Now;
var newItem = await notice.InsertNowAsync();
// 通知到的人
@@ -113,7 +113,7 @@ namespace Ewide.Core.Service.Notice
var notice = input.Adapt<SysNotice>();
if (input.Status == (int)NoticeStatus.PUBLIC)
{
notice.PublicTime = DateTimeOffset.Now;
notice.PublicTime = DateTime.Now;
await UpdatePublicInfo(notice);
}
await notice.UpdateAsync();
@@ -179,11 +179,11 @@ namespace Ewide.Core.Service.Notice
if (input.Status == (int)NoticeStatus.CANCEL)
{
notice.CancelTime = DateTimeOffset.Now;
notice.CancelTime = DateTime.Now;
}
else if (input.Status == (int)NoticeStatus.PUBLIC)
{
notice.PublicTime = DateTimeOffset.Now;
notice.PublicTime = DateTime.Now;
}
await notice.UpdateAsync();
}

View File

@@ -82,7 +82,7 @@ namespace Ewide.Core.Service.Notice
if (noticeUser != null)
{
noticeUser.ReadStatus = status;
noticeUser.ReadTime = DateTimeOffset.Now;
noticeUser.ReadTime = DateTime.Now;
await noticeUser.UpdateAsync();
}
}

View File

@@ -24,13 +24,13 @@ namespace Ewide.Core.Service
/// <summary>
/// 开始时间
/// </summary>
public DateTimeOffset BeginTime { get; set; } = DateTimeOffset.Now;
public DateTime BeginTime { get; set; } = DateTime.Now;
/// <summary>
/// 结束时间
/// </summary>
/// <example>null</example>
public DateTimeOffset? EndTime { get; set; }
public DateTime? EndTime { get; set; }
/// <summary>
/// Cron表达式

View File

@@ -35,7 +35,7 @@ namespace Ewide.Core.Service
/// <summary>
/// 生日
/// </summary>
public virtual DateTimeOffset Birthday { get; set; }
public virtual DateTime? Birthday { get; set; }
/// <summary>
/// 性别-男_1、女_2

View File

@@ -158,6 +158,7 @@ namespace Ewide.Core.Service
var user = input.Adapt<SysUser>();
await user.UpdateExcludeAsync(new[] { nameof(SysUser.Password), nameof(SysUser.Status), nameof(SysUser.AdminType) }, true);
user.UpdateIncludeNow(new[] { nameof(SysUser.Birthday) });
input.SysEmpParam.Id = user.Id.ToString();
// 更新员工及附属机构职位信息
await _sysEmpService.AddOrUpdate(input.SysEmpParam);