diff --git a/Admin.NET/Admin.NET.Core/Entity/SysWechatPay.cs b/Admin.NET/Admin.NET.Core/Entity/SysWechatPay.cs
index aff68a15..9c6c3930 100644
--- a/Admin.NET/Admin.NET.Core/Entity/SysWechatPay.cs
+++ b/Admin.NET/Admin.NET.Core/Entity/SysWechatPay.cs
@@ -11,7 +11,7 @@ namespace Admin.NET.Core;
///
[SugarTable(null, "系统微信支付表")]
[SysTable]
-[SugarIndex("sys_wechat_pay_order_id", nameof(OrderId), OrderByType.Desc)]
+[SugarIndex("index_{table}_O", nameof(OrderId), OrderByType.Desc)]
public partial class SysWechatPay : EntityBase
{
///
diff --git a/Admin.NET/Admin.NET.Core/Entity/SysWechatRefund.cs b/Admin.NET/Admin.NET.Core/Entity/SysWechatRefund.cs
index d4ef92a3..9d907ae4 100644
--- a/Admin.NET/Admin.NET.Core/Entity/SysWechatRefund.cs
+++ b/Admin.NET/Admin.NET.Core/Entity/SysWechatRefund.cs
@@ -11,7 +11,7 @@ namespace Admin.NET.Core;
///
[SugarTable(null, "系统微信退款表")]
[SysTable]
-[SugarIndex("sys_wechat_refund_order_id", nameof(OrderId), OrderByType.Desc)]
+[SugarIndex("index_{table}_O", nameof(OrderId), OrderByType.Desc)]
public class SysWechatRefund : EntityBase
{
///
diff --git a/Admin.NET/Admin.NET.Core/Extension/ObjectExtension.cs b/Admin.NET/Admin.NET.Core/Extension/ObjectExtension.cs
index d6491776..8f6c106c 100644
--- a/Admin.NET/Admin.NET.Core/Extension/ObjectExtension.cs
+++ b/Admin.NET/Admin.NET.Core/Extension/ObjectExtension.cs
@@ -261,9 +261,9 @@ public static partial class ObjectExtension
public static string ParseToDateTimeForRep(this string str)
{
if (string.IsNullOrWhiteSpace(str))
- str = $"{DateTime.UtcNow.Year}/{DateTime.UtcNow.Month}/{DateTime.UtcNow.Day}";
+ str = $"{DateTime.Now.Year}/{DateTime.Now.Month}/{DateTime.Now.Day}";
- var date = DateTime.UtcNow;
+ var date = DateTime.Now;
var reg = new Regex(@"(\{.+?})");
var match = reg.Matches(str);
match.ToList().ForEach(u =>
diff --git a/Admin.NET/Admin.NET.Core/Hub/OnlineUserHub.cs b/Admin.NET/Admin.NET.Core/Hub/OnlineUserHub.cs
index f13e329c..59f6d7b3 100644
--- a/Admin.NET/Admin.NET.Core/Hub/OnlineUserHub.cs
+++ b/Admin.NET/Admin.NET.Core/Hub/OnlineUserHub.cs
@@ -52,7 +52,7 @@ public class OnlineUserHub : Hub
UserId = _userManager.UserId,
UserName = _userManager.Account,
RealName = _userManager.RealName,
- Time = DateTime.UtcNow,
+ Time = DateTime.Now,
Ip = httpContext.GetRemoteIpAddressToIPv4(true),
Browser = httpContext.GetClientBrowser(),
Os = httpContext.GetClientOs(),
diff --git a/Admin.NET/Admin.NET.Core/Job/EnumToDictJob.cs b/Admin.NET/Admin.NET.Core/Job/EnumToDictJob.cs
index 904ee150..3e0d5661 100644
--- a/Admin.NET/Admin.NET.Core/Job/EnumToDictJob.cs
+++ b/Admin.NET/Admin.NET.Core/Job/EnumToDictJob.cs
@@ -143,7 +143,7 @@ public class EnumToDictJob : IJob
var originColor = Console.ForegroundColor;
Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine($"【{DateTime.UtcNow}】系统枚举转换字典");
+ Console.WriteLine($"【{DateTime.Now}】系统枚举转换字典");
Console.ForegroundColor = originColor;
}
}
\ No newline at end of file
diff --git a/Admin.NET/Admin.NET.Core/Job/LogJob.cs b/Admin.NET/Admin.NET.Core/Job/LogJob.cs
index 8db0a9e9..0f766e95 100644
--- a/Admin.NET/Admin.NET.Core/Job/LogJob.cs
+++ b/Admin.NET/Admin.NET.Core/Job/LogJob.cs
@@ -32,11 +32,11 @@ public class LogJob : IJob
var sysConfigService = serviceScope.ServiceProvider.GetRequiredService();
var daysAgo = await sysConfigService.GetConfigValue(ConfigConst.SysLogRetentionDays); // 日志保留天数
- await logVisRep.CopyNew().AsDeleteable().Where(u => u.CreateTime < DateTime.UtcNow.AddDays(-daysAgo)).ExecuteCommandAsync(stoppingToken); // 删除访问日志
- await logOpRep.CopyNew().AsDeleteable().Where(u => u.CreateTime < DateTime.UtcNow.AddDays(-daysAgo)).ExecuteCommandAsync(stoppingToken); // 删除操作日志
- await logDiffRep.CopyNew().AsDeleteable().Where(u => u.CreateTime < DateTime.UtcNow.AddDays(-daysAgo)).ExecuteCommandAsync(stoppingToken); // 删除差异日志
+ await logVisRep.CopyNew().AsDeleteable().Where(u => u.CreateTime < DateTime.Now.AddDays(-daysAgo)).ExecuteCommandAsync(stoppingToken); // 删除访问日志
+ await logOpRep.CopyNew().AsDeleteable().Where(u => u.CreateTime < DateTime.Now.AddDays(-daysAgo)).ExecuteCommandAsync(stoppingToken); // 删除操作日志
+ await logDiffRep.CopyNew().AsDeleteable().Where(u => u.CreateTime < DateTime.Now.AddDays(-daysAgo)).ExecuteCommandAsync(stoppingToken); // 删除差异日志
- string msg = $"【{DateTime.UtcNow}】清理系统日志成功,删除 {daysAgo} 天前的日志数据!";
+ string msg = $"【{DateTime.Now}】清理系统日志成功,删除 {daysAgo} 天前的日志数据!";
var originColor = Console.ForegroundColor;
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine(msg);
diff --git a/Admin.NET/Admin.NET.Core/Job/OnlineUserJob.cs b/Admin.NET/Admin.NET.Core/Job/OnlineUserJob.cs
index 881e6dd5..e5c333c2 100644
--- a/Admin.NET/Admin.NET.Core/Job/OnlineUserJob.cs
+++ b/Admin.NET/Admin.NET.Core/Job/OnlineUserJob.cs
@@ -34,7 +34,7 @@ public class OnlineUserJob : IJob
// 缓存租户列表
await serviceScope.ServiceProvider.GetRequiredService().CacheTenant();
- string msg = $"【{DateTime.UtcNow}】清理在线用户成功!服务已重启...";
+ string msg = $"【{DateTime.Now}】清理在线用户成功!服务已重启...";
var originColor = Console.ForegroundColor;
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(msg);
diff --git a/Admin.NET/Admin.NET.Core/Job/RoleApiJob.cs b/Admin.NET/Admin.NET.Core/Job/RoleApiJob.cs
index 77d3598c..8d830f3e 100644
--- a/Admin.NET/Admin.NET.Core/Job/RoleApiJob.cs
+++ b/Admin.NET/Admin.NET.Core/Job/RoleApiJob.cs
@@ -55,11 +55,11 @@ public class RoleApiJob : IJob
var originColor = Console.ForegroundColor;
Console.ForegroundColor = ConsoleColor.Blue;
- Console.WriteLine($"【{DateTime.UtcNow}】初始化管理员角色接口资源");
+ Console.WriteLine($"【{DateTime.Now}】初始化管理员角色接口资源");
Console.ForegroundColor = originColor;
// 自定义日志
- _logger.LogInformation($"【{DateTime.UtcNow}】初始化管理员角色接口资源");
+ _logger.LogInformation($"【{DateTime.Now}】初始化管理员角色接口资源");
await Task.CompletedTask;
}
diff --git a/Admin.NET/Admin.NET.Core/Logging/ElasticSearchLoggingWriter.cs b/Admin.NET/Admin.NET.Core/Logging/ElasticSearchLoggingWriter.cs
index c047bbe6..d4253a57 100644
--- a/Admin.NET/Admin.NET.Core/Logging/ElasticSearchLoggingWriter.cs
+++ b/Admin.NET/Admin.NET.Core/Logging/ElasticSearchLoggingWriter.cs
@@ -61,7 +61,7 @@ public class ElasticSearchLoggingWriter : IDatabaseLoggingWriter, IDisposable
var sysLogOp = new SysLogOp
{
- Id = DateTime.UtcNow.Ticks,
+ Id = DateTime.Now.Ticks,
ControllerName = loggingMonitor.controllerName,
ActionName = loggingMonitor.actionTypeName,
DisplayTitle = loggingMonitor.displayTitle,
diff --git a/Admin.NET/Admin.NET.Core/Logging/LogExceptionHandler.cs b/Admin.NET/Admin.NET.Core/Logging/LogExceptionHandler.cs
index 28c3e715..7895563b 100644
--- a/Admin.NET/Admin.NET.Core/Logging/LogExceptionHandler.cs
+++ b/Admin.NET/Admin.NET.Core/Logging/LogExceptionHandler.cs
@@ -42,7 +42,7 @@
// Browser = context.HttpContext.Request.Headers["User-Agent"],
// TraceId = App.GetTraceId(),
// ThreadId = App.GetThreadId(),
-// LogDateTime = DateTime.UtcNow,
+// LogDateTime = DateTime.Now,
// LogLevel = LogLevel.Error
// };
diff --git a/Admin.NET/Admin.NET.Core/Logging/LoggingSetup.cs b/Admin.NET/Admin.NET.Core/Logging/LoggingSetup.cs
index d2a2f853..b0e502df 100644
--- a/Admin.NET/Admin.NET.Core/Logging/LoggingSetup.cs
+++ b/Admin.NET/Admin.NET.Core/Logging/LoggingSetup.cs
@@ -44,7 +44,7 @@ public static class LoggingSetup
{
options.WithTraceId = true; // 显示线程Id
options.WithStackFrame = true; // 显示程序集
- options.FileNameRule = fileName => string.Format(fileName, DateTime.UtcNow, logLevel.ToString()); // 每天创建一个文件
+ options.FileNameRule = fileName => string.Format(fileName, DateTime.Now, logLevel.ToString()); // 每天创建一个文件
options.WriteFilter = logMsg => logMsg.LogLevel == logLevel; // 日志级别
options.HandleWriteError = (writeError) => // 写入失败时启用备用文件
{
diff --git a/Admin.NET/Admin.NET.Core/Service/Auth/SysAuthService.cs b/Admin.NET/Admin.NET.Core/Service/Auth/SysAuthService.cs
index 5179a008..b427125a 100644
--- a/Admin.NET/Admin.NET.Core/Service/Auth/SysAuthService.cs
+++ b/Admin.NET/Admin.NET.Core/Service/Auth/SysAuthService.cs
@@ -240,7 +240,7 @@ public class SysAuthService : IDynamicApiController, ITransient
// 更新用户登录信息
user.LastLoginIp = _httpContextAccessor.HttpContext.GetRemoteIpAddressToIPv4(true);
(user.LastLoginAddress, double? longitude, double? latitude) = CommonUtil.GetIpAddress(user.LastLoginIp);
- user.LastLoginTime = DateTime.UtcNow;
+ user.LastLoginTime = DateTime.Now;
user.LastLoginDevice = CommonUtil.GetClientDeviceInfo(_httpContextAccessor.HttpContext?.Request?.Headers?.UserAgent);
await _sysUserRep.AsUpdateable(user).UpdateColumns(u => new
{
@@ -277,7 +277,7 @@ public class SysAuthService : IDynamicApiController, ITransient
// 获取水印文字(若系统水印为空则全局为空)
var watermarkText = await _sysConfigService.GetConfigValue(ConfigConst.SysWebWatermark);
if (!string.IsNullOrWhiteSpace(watermarkText))
- watermarkText += $"-{user.RealName}"; // $"-{user.RealName}-{_httpContextAccessor.HttpContext.GetRemoteIpAddressToIPv4(true)}-{DateTime.UtcNow}";
+ watermarkText += $"-{user.RealName}"; // $"-{user.RealName}-{_httpContextAccessor.HttpContext.GetRemoteIpAddressToIPv4(true)}-{DateTime.Now}";
return new LoginUserOutput
{
diff --git a/Admin.NET/Admin.NET.Core/Service/Common/SysCommonService.cs b/Admin.NET/Admin.NET.Core/Service/Common/SysCommonService.cs
index d1f3510a..d06287af 100644
--- a/Admin.NET/Admin.NET.Core/Service/Common/SysCommonService.cs
+++ b/Admin.NET/Admin.NET.Core/Service/Common/SysCommonService.cs
@@ -138,7 +138,7 @@ public class SysCommonService : IDynamicApiController, ITransient
return await Task.FromResult(new FileStreamResult(resultStream, "application/octet-stream")
{
- FileDownloadName = $"{(string.IsNullOrEmpty(fileName) ? "错误标记_" + DateTime.UtcNow.ToString("yyyyMMddhhmmss") : fileName)}.xlsx"
+ FileDownloadName = $"{(string.IsNullOrEmpty(fileName) ? "错误标记_" + DateTime.Now.ToString("yyyyMMddhhmmss") : fileName)}.xlsx"
});
}
diff --git a/Admin.NET/Admin.NET.Core/Service/DataBase/SysDatabaseService.cs b/Admin.NET/Admin.NET.Core/Service/DataBase/SysDatabaseService.cs
index be5997fe..b6a41ce2 100644
--- a/Admin.NET/Admin.NET.Core/Service/DataBase/SysDatabaseService.cs
+++ b/Admin.NET/Admin.NET.Core/Service/DataBase/SysDatabaseService.cs
@@ -528,7 +528,7 @@ public class SysDatabaseService : IDynamicApiController, ITransient
Directory.CreateDirectory(backupDirectory);
// 构建备份文件名
- string backupFileName = $"backup_{DateTime.UtcNow:yyyyMMddHHmmss}.sql";
+ string backupFileName = $"backup_{DateTime.Now:yyyyMMddHHmmss}.sql";
string backupFilePath = Path.Combine(backupDirectory, backupFileName);
// 启动pg_dump进程进行备份
diff --git a/Admin.NET/Admin.NET.Core/Service/Job/JobClusterServer.cs b/Admin.NET/Admin.NET.Core/Service/Job/JobClusterServer.cs
index 14bf013f..139b2ec6 100644
--- a/Admin.NET/Admin.NET.Core/Service/Job/JobClusterServer.cs
+++ b/Admin.NET/Admin.NET.Core/Service/Job/JobClusterServer.cs
@@ -11,7 +11,7 @@ namespace Admin.NET.Core.Service;
///
public class JobClusterServer : IJobClusterServer
{
- private readonly Random rd = new(DateTime.UtcNow.Millisecond);
+ private readonly Random rd = new(DateTime.Now.Millisecond);
public JobClusterServer()
{
diff --git a/Admin.NET/Admin.NET.Core/Service/Logging/SysLogExService.cs b/Admin.NET/Admin.NET.Core/Service/Logging/SysLogExService.cs
index 284c26ba..5d9a887f 100644
--- a/Admin.NET/Admin.NET.Core/Service/Logging/SysLogExService.cs
+++ b/Admin.NET/Admin.NET.Core/Service/Logging/SysLogExService.cs
@@ -74,6 +74,6 @@ public class SysLogExService : IDynamicApiController, ITransient
IExcelExporter excelExporter = new ExcelExporter();
var res = await excelExporter.ExportAsByteArray(logExList);
- return new FileStreamResult(new MemoryStream(res), "application/octet-stream") { FileDownloadName = DateTime.UtcNow.ToString("yyyyMMddHHmm") + "异常日志.xlsx" };
+ return new FileStreamResult(new MemoryStream(res), "application/octet-stream") { FileDownloadName = DateTime.Now.ToString("yyyyMMddHHmm") + "异常日志.xlsx" };
}
}
\ No newline at end of file
diff --git a/Admin.NET/Admin.NET.Core/Service/Logging/SysLogOpService.cs b/Admin.NET/Admin.NET.Core/Service/Logging/SysLogOpService.cs
index ab1f3c21..480ed487 100644
--- a/Admin.NET/Admin.NET.Core/Service/Logging/SysLogOpService.cs
+++ b/Admin.NET/Admin.NET.Core/Service/Logging/SysLogOpService.cs
@@ -74,6 +74,6 @@ public class SysLogOpService : IDynamicApiController, ITransient
IExcelExporter excelExporter = new ExcelExporter();
var res = await excelExporter.ExportAsByteArray(logOpList);
- return new FileStreamResult(new MemoryStream(res), "application/octet-stream") { FileDownloadName = DateTime.UtcNow.ToString("yyyyMMddHHmm") + "操作日志.xlsx" };
+ return new FileStreamResult(new MemoryStream(res), "application/octet-stream") { FileDownloadName = DateTime.Now.ToString("yyyyMMddHHmm") + "操作日志.xlsx" };
}
}
\ No newline at end of file
diff --git a/Admin.NET/Admin.NET.Core/Service/Notice/SysNoticeService.cs b/Admin.NET/Admin.NET.Core/Service/Notice/SysNoticeService.cs
index a216009d..c5896ba2 100644
--- a/Admin.NET/Admin.NET.Core/Service/Notice/SysNoticeService.cs
+++ b/Admin.NET/Admin.NET.Core/Service/Notice/SysNoticeService.cs
@@ -101,7 +101,7 @@ public class SysNoticeService : IDynamicApiController, ITransient
public async Task Public(NoticeInput input)
{
// 更新发布状态和时间
- await _sysNoticeRep.UpdateAsync(u => new SysNotice() { Status = NoticeStatusEnum.PUBLIC, PublicTime = DateTime.UtcNow }, u => u.Id == input.Id);
+ await _sysNoticeRep.UpdateAsync(u => new SysNotice() { Status = NoticeStatusEnum.PUBLIC, PublicTime = DateTime.Now }, u => u.Id == input.Id);
var notice = await _sysNoticeRep.GetFirstAsync(u => u.Id == input.Id);
@@ -131,7 +131,7 @@ public class SysNoticeService : IDynamicApiController, ITransient
await _sysNoticeUserRep.UpdateAsync(u => new SysNoticeUser
{
ReadStatus = NoticeUserStatusEnum.READ,
- ReadTime = DateTime.UtcNow
+ ReadTime = DateTime.Now
}, u => u.NoticeId == input.Id && u.UserId == _userManager.UserId);
}
diff --git a/Admin.NET/Admin.NET.Core/Service/Region/SysRegionService.cs b/Admin.NET/Admin.NET.Core/Service/Region/SysRegionService.cs
index 5c9f9648..f974a88e 100644
--- a/Admin.NET/Admin.NET.Core/Service/Region/SysRegionService.cs
+++ b/Admin.NET/Admin.NET.Core/Service/Region/SysRegionService.cs
@@ -97,7 +97,11 @@ public class SysRegionService : IDynamicApiController, ITransient
if (input.Code.Length != 12 && input.Code.Length != 9 && input.Code.Length != 6)
throw Oops.Oh(ErrorCodeEnum.R2003);
- if (input.Pid != input.Pid && input.Pid != 0)
+ var sysRegion = await _sysRegionRep.GetFirstAsync(u => u.Id == input.Id);
+ if (sysRegion == null)
+ throw Oops.Oh(ErrorCodeEnum.D1002);
+
+ if (sysRegion.Pid != input.Pid && input.Pid != 0)
{
var pRegion = await _sysRegionRep.GetFirstAsync(u => u.Id == input.Pid);
pRegion ??= await _sysRegionRep.GetFirstAsync(u => u.Code == input.Pid.ToString());
@@ -114,7 +118,6 @@ public class SysRegionService : IDynamicApiController, ITransient
if (input.Id == input.Pid)
throw Oops.Oh(ErrorCodeEnum.R2001);
- var sysRegion = await _sysRegionRep.GetFirstAsync(u => u.Id == input.Id);
var isExist = await _sysRegionRep.IsAnyAsync(u => (u.Name == input.Name && u.Code == input.Code) && u.Id != sysRegion.Id);
if (isExist)
throw Oops.Oh(ErrorCodeEnum.R2002);
diff --git a/Admin.NET/Admin.NET.Core/Service/Server/SysServerService.cs b/Admin.NET/Admin.NET.Core/Service/Server/SysServerService.cs
index 1529e4ea..d3d8f741 100644
--- a/Admin.NET/Admin.NET.Core/Service/Server/SysServerService.cs
+++ b/Admin.NET/Admin.NET.Core/Service/Server/SysServerService.cs
@@ -62,7 +62,7 @@ public class SysServerService : IDynamicApiController, ITransient
public dynamic GetServerUsed()
{
var programStartTime = Process.GetCurrentProcess().StartTime;
- var totalMilliseconds = (DateTime.UtcNow - programStartTime).TotalMilliseconds.ToString();
+ var totalMilliseconds = (DateTime.Now - programStartTime).TotalMilliseconds.ToString();
var ts = totalMilliseconds.Contains('.') ? totalMilliseconds.Split('.')[0] : totalMilliseconds;
var programRunTime = DateTimeUtil.FormatTime(ts.ParseToLong());
diff --git a/Admin.NET/Admin.NET.Core/Service/Wechat/SysWechatPayService.cs b/Admin.NET/Admin.NET.Core/Service/Wechat/SysWechatPayService.cs
index eaa500d6..905974f6 100644
--- a/Admin.NET/Admin.NET.Core/Service/Wechat/SysWechatPayService.cs
+++ b/Admin.NET/Admin.NET.Core/Service/Wechat/SysWechatPayService.cs
@@ -68,7 +68,7 @@ public class SysWechatPayService : IDynamicApiController, ITransient
[DisplayName("微信支付统一下单获取Id(商户直连)")]
public async Task CreatePayTransaction([FromBody] WechatPayTransactionInput input)
{
- string outTradeNumber = DateTimeOffset.UtcNow.ToString("yyyyMMddHHmmssfff") + (new Random()).Next(100, 1000); // 微信需要的订单号(唯一)
+ string outTradeNumber = DateTimeOffset.Now.ToString("yyyyMMddHHmmssfff") + (new Random()).Next(100, 1000); // 微信需要的订单号(唯一)
//检查订单信息是否已存在(使用“商户交易单号+状态”唯一性判断)
var wechatPay = await _sysWechatPayRep.GetFirstAsync(u => u.OrderId == input.OrderId && u.OrderStatus == input.OrderStatus);
@@ -84,7 +84,7 @@ public class SysWechatPayService : IDynamicApiController, ITransient
Description = input.Description,
Attachment = input.Attachment,
GoodsTag = input.GoodsTag,
- ExpireTime = DateTimeOffset.UtcNow.AddMinutes(10),
+ ExpireTime = DateTimeOffset.Now.AddMinutes(10),
NotifyUrl = _payCallBackOptions.WechatPayUrl,
Amount = new CreatePayTransactionJsapiRequest.Types.Amount() { Total = input.Total },
Payer = new CreatePayTransactionJsapiRequest.Types.Payer() { OpenId = input.OpenId }
@@ -126,7 +126,7 @@ public class SysWechatPayService : IDynamicApiController, ITransient
[DisplayName("微信支付统一下单获取Id(服务商模式)")]
public async Task CreatePayPartnerTransaction([FromBody] WechatPayTransactionInput input)
{
- string outTradeNumber = DateTimeOffset.UtcNow.ToString("yyyyMMddHHmmssfff") + (new Random()).Next(100, 1000); // 微信需要的订单号(唯一)
+ string outTradeNumber = DateTimeOffset.Now.ToString("yyyyMMddHHmmssfff") + (new Random()).Next(100, 1000); // 微信需要的订单号(唯一)
//检查订单信息是否已存在(使用“商户交易单号+状态”唯一性判断)
var wechatPay = await _sysWechatPayRep.GetFirstAsync(u => u.OrderId == input.OrderId && u.OrderStatus == input.OrderStatus);
@@ -145,7 +145,7 @@ public class SysWechatPayService : IDynamicApiController, ITransient
Description = input.Description,
Attachment = input.Attachment,
GoodsTag = input.GoodsTag,
- ExpireTime = DateTimeOffset.UtcNow.AddMinutes(10),
+ ExpireTime = DateTimeOffset.Now.AddMinutes(10),
NotifyUrl = _payCallBackOptions.WechatPayUrl,
Amount = new CreatePayPartnerTransactionJsapiRequest.Types.Amount() { Total = input.Total },
Payer = new CreatePayPartnerTransactionJsapiRequest.Types.Payer() { OpenId = input.OpenId }
@@ -288,7 +288,7 @@ public class SysWechatPayService : IDynamicApiController, ITransient
var request = new CreateRefundDomesticRefundRequest()
{
OutTradeNumber = input.OutTradeNumber,
- OutRefundNumber = "REFUND_" + DateTimeOffset.UtcNow.ToString("yyyyMMddHHmmssfff"),
+ OutRefundNumber = "REFUND_" + DateTimeOffset.Now.ToString("yyyyMMddHHmmssfff"),
Amount = new CreateRefundDomesticRefundRequest.Types.Amount()
{
Total = input.Total,
diff --git a/Admin.NET/Admin.NET.Core/SqlSugar/SqlSugarSetup.cs b/Admin.NET/Admin.NET.Core/SqlSugar/SqlSugarSetup.cs
index ea0d9a6f..b621a55a 100644
--- a/Admin.NET/Admin.NET.Core/SqlSugar/SqlSugarSetup.cs
+++ b/Admin.NET/Admin.NET.Core/SqlSugar/SqlSugarSetup.cs
@@ -117,7 +117,7 @@ public static class SqlSugarSetup
// par.Value = string.Concat(par.Value.ToString()[..100], "......");
//}
- var log = $"【{DateTime.UtcNow}——执行SQL】\r\n{UtilMethods.GetNativeSql(sql, pars)}\r\n";
+ var log = $"【{DateTime.Now}——执行SQL】\r\n{UtilMethods.GetNativeSql(sql, pars)}\r\n";
var originColor = Console.ForegroundColor;
if (sql.StartsWith("SELECT", StringComparison.OrdinalIgnoreCase))
Console.ForegroundColor = ConsoleColor.Green;
@@ -132,7 +132,7 @@ public static class SqlSugarSetup
db.Aop.OnError = ex =>
{
if (ex.Parametres == null) return;
- var log = $"【{DateTime.UtcNow}——错误SQL】\r\n{UtilMethods.GetNativeSql(ex.Sql, (SugarParameter[])ex.Parametres)}\r\n";
+ var log = $"【{DateTime.Now}——错误SQL】\r\n{UtilMethods.GetNativeSql(ex.Sql, (SugarParameter[])ex.Parametres)}\r\n";
Log.Error(log, ex);
App.PrintToMiniProfiler("SqlSugar", "Error", log);
};
@@ -152,7 +152,7 @@ public static class SqlSugarSetup
var fileName = db.Ado.SqlStackTrace.FirstFileName; // 文件名
var fileLine = db.Ado.SqlStackTrace.FirstLine; // 行号
var firstMethodName = db.Ado.SqlStackTrace.FirstMethodName; // 方法名
- var log = $"【{DateTime.UtcNow}——超时SQL】\r\n【所在文件名】:{fileName}\r\n【代码行数】:{fileLine}\r\n【方法名】:{firstMethodName}\r\n" + $"【SQL语句】:{UtilMethods.GetNativeSql(sql, pars)}";
+ var log = $"【{DateTime.Now}——超时SQL】\r\n【所在文件名】:{fileName}\r\n【代码行数】:{fileLine}\r\n【方法名】:{firstMethodName}\r\n" + $"【SQL语句】:{UtilMethods.GetNativeSql(sql, pars)}";
Log.Warning(log);
App.PrintToMiniProfiler("SqlSugar", "Slow", log);
}
@@ -174,9 +174,9 @@ public static class SqlSugarSetup
// 若创建时间为空则赋值当前时间
else if (entityInfo.PropertyName == nameof(EntityBase.CreateTime))
{
- var createTime = entityInfo.EntityColumnInfo.PropertyInfo.GetValue(entityInfo.EntityValue);
- if (createTime.Equals(DateTime.Parse("0001/1/1 0:00:00")))
- entityInfo.SetValue(DateTime.UtcNow);
+ var createTime = entityInfo.EntityColumnInfo.PropertyInfo.GetValue(entityInfo.EntityValue)!;
+ if (createTime == null || createTime.Equals(DateTime.MinValue))
+ entityInfo.SetValue(DateTime.Now);
}
// 若当前用户非空(web线程时)
if (App.User != null)
@@ -213,7 +213,7 @@ public static class SqlSugarSetup
else if (entityInfo.OperationType == DataFilterType.UpdateByObject)
{
if (entityInfo.PropertyName == nameof(EntityBase.UpdateTime))
- entityInfo.SetValue(DateTime.UtcNow);
+ entityInfo.SetValue(DateTime.Now);
else if (entityInfo.PropertyName == nameof(EntityBase.UpdateUserId))
entityInfo.SetValue(App.User?.FindFirst(ClaimConst.UserId)?.Value);
else if (entityInfo.PropertyName == nameof(EntityBase.UpdateUserName))
@@ -268,7 +268,7 @@ public static class SqlSugarSetup
var logDb = ITenant.IsAnyConnection(SqlSugarConst.LogConfigId) ? ITenant.GetConnectionScope(SqlSugarConst.LogConfigId) : db;
await logDb.CopyNew().Insertable(logDiff).ExecuteCommandAsync();
Console.ForegroundColor = ConsoleColor.Red;
- Console.WriteLine(DateTime.UtcNow + $"\r\n*****开始差异日志*****\r\n{Environment.NewLine}{JSON.Serialize(logDiff)}{Environment.NewLine}*****结束差异日志*****\r\n");
+ Console.WriteLine(DateTime.Now + $"\r\n*****开始差异日志*****\r\n{Environment.NewLine}{JSON.Serialize(logDiff)}{Environment.NewLine}*****结束差异日志*****\r\n");
};
}
@@ -316,7 +316,7 @@ public static class SqlSugarSetup
{
var seedDataTypes = App.EffectiveTypes.Where(u => !u.IsInterface && !u.IsAbstract && u.IsClass && u.GetInterfaces().Any(i => i.HasImplementedRawGeneric(typeof(ISqlSugarEntitySeedData<>))))
.WhereIF(config.SeedSettings.EnableIncreSeed, u => u.IsDefined(typeof(IncreSeedAttribute), false))
- .OrderBy(u => u.GetCustomAttributes(typeof(SeedDataAttribute), false).Length > 0 ? (u.GetCustomAttributes(typeof(SeedDataAttribute), false)[0] as SeedDataAttribute).Order : 0).ToList();
+ .OrderBy(u => u.GetCustomAttributes(typeof(SeedDataAttribute), false).Length > 0 ? ((SeedDataAttribute)u.GetCustomAttributes(typeof(SeedDataAttribute), false)[0]).Order : 0).ToList();
foreach (var seedType in seedDataTypes)
{
@@ -394,14 +394,14 @@ public static class SqlSugarSetup
// 初始化业务应用种子数据
var seedDataTypes = App.EffectiveTypes.Where(u => !u.IsInterface && !u.IsAbstract && u.IsClass && u.GetInterfaces().Any(i => i.HasImplementedRawGeneric(typeof(ISqlSugarEntitySeedData<>))))
.Where(u => u.IsDefined(typeof(AppSeedAttribute), false))
- .OrderBy(u => u.GetCustomAttributes(typeof(SeedDataAttribute), false).Length > 0 ? (u.GetCustomAttributes(typeof(SeedDataAttribute), false)[0] as SeedDataAttribute).Order : 0).ToList();
+ .OrderBy(u => u.GetCustomAttributes(typeof(SeedDataAttribute), false).Length > 0 ? ((SeedDataAttribute)u.GetCustomAttributes(typeof(SeedDataAttribute), false)[0]).Order : 0).ToList();
foreach (var seedType in seedDataTypes)
{
var instance = Activator.CreateInstance(seedType);
var hasDataMethod = seedType.GetMethod("HasData");
- var seedData = ((IEnumerable)hasDataMethod?.Invoke(instance, null))?.Cast