update 修改所有datetimeoffset类型为datetime
This commit is contained in:
@@ -25,13 +25,13 @@ namespace Ewide.Core
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
[Comment("创建时间")]
|
||||
public virtual DateTimeOffset? CreatedTime { get; set; }
|
||||
public virtual DateTime? CreatedTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
/// </summary>
|
||||
[Comment("更新时间")]
|
||||
public virtual DateTimeOffset? UpdatedTime { get; set; }
|
||||
public virtual DateTime? UpdatedTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建者Id
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace Ewide.Core
|
||||
/// 操作时间
|
||||
/// </summary>
|
||||
[Comment("操作时间")]
|
||||
public DateTimeOffset CreatedTime { get; set; }
|
||||
public DateTime CreatedTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作人Id
|
||||
|
||||
@@ -106,7 +106,7 @@ namespace Ewide.Core
|
||||
/// 操作时间
|
||||
/// </summary>
|
||||
[Comment("操作时间")]
|
||||
public DateTimeOffset OpTime { get; set; }
|
||||
public DateTime OpTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作人
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace Ewide.Core
|
||||
/// 访问时间
|
||||
/// </summary>
|
||||
[Comment("访问时间")]
|
||||
public DateTimeOffset VisTime { get; set; }
|
||||
public DateTime VisTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 访问人
|
||||
|
||||
@@ -59,13 +59,13 @@ namespace Ewide.Core
|
||||
/// 发布时间
|
||||
/// </summary>
|
||||
[Comment("发布时间")]
|
||||
public DateTimeOffset PublicTime { get; set; }
|
||||
public DateTime PublicTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 撤回时间
|
||||
/// </summary>
|
||||
[Comment("撤回时间")]
|
||||
public DateTimeOffset CancelTime { get; set; }
|
||||
public DateTime CancelTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态(字典 0草稿 1发布 2撤回 3删除)
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Ewide.Core
|
||||
/// 阅读时间
|
||||
/// </summary>
|
||||
[Comment("阅读时间")]
|
||||
public DateTimeOffset ReadTime { get; set; }
|
||||
public DateTime ReadTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态(字典 0未读 1已读)
|
||||
|
||||
@@ -30,14 +30,14 @@ namespace Ewide.Core
|
||||
/// 开始时间
|
||||
/// </summary>
|
||||
[Comment("开始时间")]
|
||||
public DateTimeOffset BeginTime { get; set; } = DateTimeOffset.Now;
|
||||
public DateTime BeginTime { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// 结束时间
|
||||
/// </summary>
|
||||
/// <example>null</example>
|
||||
[Comment("结束时间")]
|
||||
public DateTimeOffset? EndTime { get; set; }
|
||||
public DateTime? EndTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Cron表达式
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace Ewide.Core
|
||||
/// 生日
|
||||
/// </summary>
|
||||
[Comment("生日")]
|
||||
public DateTimeOffset Birthday { get; set; }
|
||||
public DateTime? Birthday { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 性别-男_1、女_2
|
||||
@@ -93,7 +93,7 @@ namespace Ewide.Core
|
||||
/// 最后登录时间
|
||||
/// </summary>
|
||||
[Comment("最后登录时间")]
|
||||
public DateTimeOffset LastLoginTime { get; set; }
|
||||
public DateTime LastLoginTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理员类型-超级管理员_1、非管理员_2
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Ewide.Core
|
||||
//Param = JsonSerializerUtility.Serialize(context.ActionArguments),
|
||||
//Result = JsonSerializerUtility.Serialize(actionContext.Result),
|
||||
ElapsedTime = sw.ElapsedMilliseconds,
|
||||
OpTime = DateTimeOffset.Now,
|
||||
OpTime = DateTime.Now,
|
||||
Account = httpContext.User?.FindFirstValue(ClaimConst.CLAINM_ACCOUNT)
|
||||
};
|
||||
await sysOpLog.InsertAsync();
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Ewide.Core
|
||||
{
|
||||
return new[]
|
||||
{
|
||||
new SysTimer{Id="971bc338-0c03-46d4-8113-c7738d54ea18", JobName="百度api", JobGroup="默认分组", BeginTime=DateTimeOffset.Parse("2021-03-21 00:00:00+08:00"), Interval=30, TriggerType=TriggerTypeEnum.Simple, RequestUrl="https://www.baidu.com", RequestType=RequestTypeEnum.Post, IsDeleted=false }, // 142307070910556
|
||||
new SysTimer{Id="971bc338-0c03-46d4-8113-c7738d54ea18", JobName="百度api", JobGroup="默认分组", BeginTime=DateTime.Parse("2021-03-21 00:00:00+08:00"), Interval=30, TriggerType=TriggerTypeEnum.Simple, RequestUrl="https://www.baidu.com", RequestType=RequestTypeEnum.Post, IsDeleted=false }, // 142307070910556
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,9 +20,9 @@ namespace Ewide.Core
|
||||
{
|
||||
return new[]
|
||||
{
|
||||
new SysUser{Id="d0ead3dc-5096-4e15-bc6d-f640be5301ec", Account="superAdmin", Name="superAdmin", Password="e10adc3949ba59abbe56e057f20f883e", AdminType=AdminType.SuperAdmin, Birthday=DateTimeOffset.Parse("1986-07-26 00:00:00"), Phone="18020030720", Sex=1, IsDeleted=false }, // 142307070910551
|
||||
new SysUser{Id="5398fb9a-2209-4ce7-a2c1-b6a983e502b5", Account="admin", Name="admin", Password="e10adc3949ba59abbe56e057f20f883e", AdminType=AdminType.SuperAdmin, Birthday=DateTimeOffset.Parse("1986-07-26 00:00:00"), Phone="18020030720", Sex=2, IsDeleted=false }, // 142307070910552
|
||||
new SysUser{Id="16a74726-e156-499f-9942-0e0e24ad0c3f", Account="zuohuaijun", Name="zuohuaijun", Password="e10adc3949ba59abbe56e057f20f883e", AdminType=AdminType.None, Birthday=DateTimeOffset.Parse("1986-07-26 00:00:00"), Phone="18020030720", Sex=1, IsDeleted=false } // 142307070910553
|
||||
new SysUser{Id="d0ead3dc-5096-4e15-bc6d-f640be5301ec", Account="superAdmin", Name="superAdmin", Password="e10adc3949ba59abbe56e057f20f883e", AdminType=AdminType.SuperAdmin, Birthday=DateTime.Parse("1986-07-26 00:00:00"), Phone="18020030720", Sex=1, IsDeleted=false }, // 142307070910551
|
||||
new SysUser{Id="5398fb9a-2209-4ce7-a2c1-b6a983e502b5", Account="admin", Name="admin", Password="e10adc3949ba59abbe56e057f20f883e", AdminType=AdminType.SuperAdmin, Birthday=DateTime.Parse("1986-07-26 00:00:00"), Phone="18020030720", Sex=2, IsDeleted=false }, // 142307070910552
|
||||
new SysUser{Id="16a74726-e156-499f-9942-0e0e24ad0c3f", Account="zuohuaijun", Name="zuohuaijun", Password="e10adc3949ba59abbe56e057f20f883e", AdminType=AdminType.None, Birthday=DateTime.Parse("1986-07-26 00:00:00"), Phone="18020030720", Sex=1, IsDeleted=false } // 142307070910553
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
/// 最后登陆地址
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace Ewide.Core.Service
|
||||
/// <summary>
|
||||
/// 操作时间
|
||||
/// </summary>
|
||||
public DateTimeOffset OpTime { get; set; }
|
||||
public DateTime OpTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作人
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace Ewide.Core.Service
|
||||
/// <summary>
|
||||
/// 访问时间
|
||||
/// </summary>
|
||||
public DateTimeOffset VisTime { get; set; }
|
||||
public DateTime VisTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 访问人
|
||||
|
||||
@@ -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删除)
|
||||
|
||||
@@ -39,6 +39,6 @@ namespace Ewide.Core.Service
|
||||
/// <summary>
|
||||
/// 阅读时间
|
||||
/// </summary>
|
||||
public DateTimeOffset ReadTime { get; set; }
|
||||
public DateTime ReadTime { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,6 @@ namespace Ewide.Core.Service
|
||||
/// <summary>
|
||||
/// 阅读时间
|
||||
/// </summary>
|
||||
public DateTimeOffset ReadTime { get; set; }
|
||||
public DateTime ReadTime { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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表达式
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -120,7 +120,7 @@ namespace Ewide.Core
|
||||
/// <returns></returns>
|
||||
private static string GetRunTime()
|
||||
{
|
||||
return FormatTime((long)(DateTimeOffset.Now - Process.GetCurrentProcess().StartTime).TotalMilliseconds);
|
||||
return FormatTime((long)(DateTime.Now - Process.GetCurrentProcess().StartTime).TotalMilliseconds);
|
||||
//return DateTimeUtil.FormatTime(Environment.TickCount);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user