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().ToList(); - if (seedData == null) continue; + var seedData = ((IEnumerable)hasDataMethod?.Invoke(instance, null))?.Cast().ToList() ?? new List(); + if (seedData.Count == 0) continue; var entityType = seedType.GetInterfaces().First().GetGenericArguments().First(); var entityInfo = db.EntityMaintenance.GetEntityInfo(entityType); @@ -411,7 +411,7 @@ public static class SqlSugarSetup { foreach (var sd in seedData) { - sd.GetType().GetProperty(nameof(EntityTenantId.TenantId)).SetValue(sd, dbConfigId); + sd.GetType().GetProperty(nameof(EntityTenantId.TenantId))!.SetValue(sd, dbConfigId); } } // 若实体包含Pid字段,则设置为当前租户Id @@ -419,7 +419,7 @@ public static class SqlSugarSetup { foreach (var sd in seedData) { - sd.GetType().GetProperty(nameof(SysOrg.Pid)).SetValue(sd, dbConfigId); + sd.GetType().GetProperty(nameof(SysOrg.Pid))!.SetValue(sd, dbConfigId); } } // 若实体包含Id字段,则设置为当前租户Id递增1 @@ -427,7 +427,7 @@ public static class SqlSugarSetup { foreach (var sd in seedData) { - sd.GetType().GetProperty(nameof(EntityBaseId.Id)).SetValue(sd, ++dbConfigId); + sd.GetType().GetProperty(nameof(EntityBaseId.Id))!.SetValue(sd, ++dbConfigId); } } diff --git a/Admin.NET/Admin.NET.Core/Util/AdminResultProvider.cs b/Admin.NET/Admin.NET.Core/Util/AdminResultProvider.cs index 4a6e6f67..dc2a8979 100644 --- a/Admin.NET/Admin.NET.Core/Util/AdminResultProvider.cs +++ b/Admin.NET/Admin.NET.Core/Util/AdminResultProvider.cs @@ -116,7 +116,7 @@ public class AdminResultProvider : IUnifyResultProvider Result = data, Type = succeeded ? "success" : "error", Extras = UnifyContext.Take(), - Time = DateTime.UtcNow + Time = DateTime.Now }; } } diff --git a/Admin.NET/Admin.NET.Core/Util/ComputerUtil.cs b/Admin.NET/Admin.NET.Core/Util/ComputerUtil.cs index 9fad8c3d..60e6940b 100644 --- a/Admin.NET/Admin.NET.Core/Util/ComputerUtil.cs +++ b/Admin.NET/Admin.NET.Core/Util/ComputerUtil.cs @@ -198,19 +198,19 @@ public static class ComputerUtil //返回:1705379131 //使用date格式化即可 string output = ShellUtil.Bash("date -r $(sysctl -n kern.boottime | awk '{print $4}' | tr -d ',') +\"%Y-%m-%d %H:%M:%S\"").Trim(); - runTime = DateTimeUtil.FormatTime((DateTime.UtcNow - output.ParseToDateTime()).TotalMilliseconds.ToString().Split('.')[0].ParseToLong()); + runTime = DateTimeUtil.FormatTime((DateTime.Now - output.ParseToDateTime()).TotalMilliseconds.ToString().Split('.')[0].ParseToLong()); } else if (IsUnix()) { string output = ShellUtil.Bash("uptime -s").Trim(); - runTime = DateTimeUtil.FormatTime((DateTime.UtcNow - output.ParseToDateTime()).TotalMilliseconds.ToString().Split('.')[0].ParseToLong()); + runTime = DateTimeUtil.FormatTime((DateTime.Now - output.ParseToDateTime()).TotalMilliseconds.ToString().Split('.')[0].ParseToLong()); } else { string output = ShellUtil.Cmd("wmic", "OS get LastBootUpTime/Value"); string[] outputArr = output.Split('=', (char)StringSplitOptions.RemoveEmptyEntries); if (outputArr.Length == 2) - runTime = DateTimeUtil.FormatTime((DateTime.UtcNow - outputArr[1].Split('.')[0].ParseToDateTime()).TotalMilliseconds.ToString().Split('.')[0].ParseToLong()); + runTime = DateTimeUtil.FormatTime((DateTime.Now - outputArr[1].Split('.')[0].ParseToDateTime()).TotalMilliseconds.ToString().Split('.')[0].ParseToLong()); } return runTime; } diff --git a/Admin.NET/Admin.NET.Core/Util/DateTimeUtil.cs b/Admin.NET/Admin.NET.Core/Util/DateTimeUtil.cs index 4662e9fa..070f2abb 100644 --- a/Admin.NET/Admin.NET.Core/Util/DateTimeUtil.cs +++ b/Admin.NET/Admin.NET.Core/Util/DateTimeUtil.cs @@ -17,9 +17,9 @@ public class DateTimeUtil public static DateTime GetBeginTime(DateTime? dateTime, int days = 0) { if (dateTime == DateTime.MinValue || dateTime == null) - return DateTime.UtcNow.AddDays(days); + return DateTime.Now.AddDays(days); - return dateTime ?? DateTime.UtcNow; + return dateTime ?? DateTime.Now; } /// @@ -122,7 +122,7 @@ public class DateTimeUtil { if (dt == null) return string.Empty; - if (dt.Value.Year == DateTime.UtcNow.Year) + if (dt.Value.Year == DateTime.Now.Year) return dt.Value.ToString("MM-dd HH:mm"); else return dt.Value.ToString("yyyy-MM-dd HH:mm"); diff --git a/Admin.NET/Admin.NET.Web.Core/Startup.cs b/Admin.NET/Admin.NET.Web.Core/Startup.cs index 45734be0..860e2221 100644 --- a/Admin.NET/Admin.NET.Web.Core/Startup.cs +++ b/Admin.NET/Admin.NET.Web.Core/Startup.cs @@ -80,6 +80,7 @@ public class Startup : AppStartup setting.DateFormatHandling = DateFormatHandling.IsoDateFormat; setting.DateTimeZoneHandling = DateTimeZoneHandling.Local; setting.DateFormatString = "yyyy-MM-dd HH:mm:ss"; // 时间格式化 + // setting.Converters.AddDateTimeTypeConverters(localized: true); // 时间本地化 setting.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; // 忽略循环引用 // setting.ContractResolver = new CamelCasePropertyNamesContractResolver(); // 解决动态对象属性名大写 // setting.NullValueHandling = NullValueHandling.Ignore; // 忽略空值 @@ -135,13 +136,17 @@ public class Startup : AppStartup #region Redis消息队列 - //// 替换事件源存储器 - //options.ReplaceStorer(serviceProvider => - //{ - // var cacheProvider = serviceProvider.GetRequiredService(); - // // 创建默认内存通道事件源对象,可自定义队列路由key,如:adminnet - // return new RedisEventSourceStorer(cacheProvider, "adminnet", 3000); - //}); + // 替换事件源存储器为Redis + var cacheOptions = App.GetConfig("Cache", true); + if (cacheOptions.CacheType == CacheTypeEnum.Redis.ToString()) + { + options.ReplaceStorer(serviceProvider => + { + var cacheProvider = serviceProvider.GetRequiredService(); + // 创建默认内存通道事件源对象,可自定义队列路由key,如:adminnet_eventsource_queue + return new RedisEventSourceStorer(cacheProvider, "adminnet_eventsource_queue", 3000); + }); + } #endregion Redis消息队列 @@ -180,7 +185,10 @@ public class Startup : AppStartup //services.AddSingleton(); services.AddSignalR(options => { - options.KeepAliveInterval = TimeSpan.FromSeconds(5); + options.EnableDetailedErrors = true; + options.KeepAliveInterval = TimeSpan.FromSeconds(15); // 服务器端向客户端ping的间隔 + options.ClientTimeoutInterval = TimeSpan.FromSeconds(30); // 客户端向服务器端ping的间隔 + options.MaximumReceiveMessageSize = 1024 * 1014 * 10; // 数据包大小10M,默认最大为32K }).AddNewtonsoftJsonProtocol(options => SetNewtonsoftJsonSetting(options.PayloadSerializerSettings)); // 系统日志 diff --git a/Admin.NET/Admin.NET.Web.Entry/wwwroot/Template/index.vue.vm b/Admin.NET/Admin.NET.Web.Entry/wwwroot/Template/index.vue.vm index 7dc3a419..8eb33055 100644 --- a/Admin.NET/Admin.NET.Web.Entry/wwwroot/Template/index.vue.vm +++ b/Admin.NET/Admin.NET.Web.Entry/wwwroot/Template/index.vue.vm @@ -298,7 +298,7 @@ const options = useVxeTable<@(@Model.ClassName)>( } } } - { field: '', title: '修改记录', width: 100, showOverflow: 'tooltip', slots: { default: 'row_record' } }, + { title: '修改记录', width: 100, showOverflow: 'tooltip', slots: { default: 'row_record' } }, { title: '操作', fixed: 'right', width: 180, showOverflow: true, slots: { default: 'row_buttons' } }, ], }, @@ -396,7 +396,7 @@ const handleDelete = (row: any) => { } else { @:await delete@(@Model.ClassName)(row); } - handleQuery(); + await handleQuery(); ElMessage.success('删除成功'); }) .catch(() => {}); diff --git a/Admin.NET/Plugins/Admin.NET.Plugin.ApprovalFlow/Service/ApprovalFlow/ApprovalFlowService.cs b/Admin.NET/Plugins/Admin.NET.Plugin.ApprovalFlow/Service/ApprovalFlow/ApprovalFlowService.cs index ef133c4c..53748fdb 100644 --- a/Admin.NET/Plugins/Admin.NET.Plugin.ApprovalFlow/Service/ApprovalFlow/ApprovalFlowService.cs +++ b/Admin.NET/Plugins/Admin.NET.Plugin.ApprovalFlow/Service/ApprovalFlow/ApprovalFlowService.cs @@ -117,9 +117,9 @@ public class ApprovalFlowService : IDynamicApiController, ITransient /// private async Task LastCode(string prefix) { - var today = DateTime.UtcNow.Date; + var today = DateTime.Now.Date; var count = await _approvalFlowRep.AsQueryable().Where(u => u.CreateTime >= today).CountAsync(); - return prefix + DateTime.UtcNow.ToString("yyMMdd") + string.Format("{0:d2}", count + 1); + return prefix + DateTime.Now.ToString("yyMMdd") + string.Format("{0:d2}", count + 1); } [HttpGet] diff --git a/Admin.NET/Plugins/Admin.NET.Plugin.ApprovalFlow/Service/SysApproval/SysApprovalService.cs b/Admin.NET/Plugins/Admin.NET.Plugin.ApprovalFlow/Service/SysApproval/SysApprovalService.cs index c3bf93d7..11c8d88b 100644 --- a/Admin.NET/Plugins/Admin.NET.Plugin.ApprovalFlow/Service/SysApproval/SysApprovalService.cs +++ b/Admin.NET/Plugins/Admin.NET.Plugin.ApprovalFlow/Service/SysApproval/SysApprovalService.cs @@ -48,7 +48,7 @@ public class SysApprovalService : ITransient var approvalFlow = new ApprovalFlowRecord { FormName = funcName, - CreateTime = DateTime.UtcNow, + CreateTime = DateTime.Now, }; // 判断是否需要审批 @@ -59,7 +59,7 @@ public class SysApprovalService : ITransient FlowId = approvalFlow.Id, FormName = funcName, FormType = typeName, - CreateTime = DateTime.UtcNow, + CreateTime = DateTime.Now, }; // 判断是否需要审批 diff --git a/Admin.NET/Plugins/Admin.NET.Plugin.DingTalk/Job/SyncDingTalkUserJob.cs b/Admin.NET/Plugins/Admin.NET.Plugin.DingTalk/Job/SyncDingTalkUserJob.cs index d66df4c8..e4f7599d 100644 --- a/Admin.NET/Plugins/Admin.NET.Plugin.DingTalk/Job/SyncDingTalkUserJob.cs +++ b/Admin.NET/Plugins/Admin.NET.Plugin.DingTalk/Job/SyncDingTalkUserJob.cs @@ -167,7 +167,7 @@ public class SyncDingTalkUserJob : IJob var originColor = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Blue; - Console.WriteLine("【" + DateTime.UtcNow + "】同步钉钉用户"); + Console.WriteLine("【" + DateTime.Now + "】同步钉钉用户"); Console.ForegroundColor = originColor; } } \ No newline at end of file diff --git a/Web/package.json b/Web/package.json index 60dfc628..7bb13d1a 100644 --- a/Web/package.json +++ b/Web/package.json @@ -2,13 +2,13 @@ "name": "admin.net.pro", "type": "module", "version": "2.4.33", - "lastBuildTime": "2024.07.14", + "lastBuildTime": "2024.07.18", "description": "Admin.NET 站在巨人肩膀上的 .NET 通用权限开发框架", "author": "zuohuaijun", "license": "MIT", "scripts": { "dev": "vite", - "build": "vite build", + "build": "node --max-old-space-size=8192 ./node_modules/vite/bin/vite build", "lint-fix": "eslint --fix --ext .js --ext .jsx --ext .vue src/", "build-api": "cd api_build/ && build.bat" }, @@ -18,7 +18,7 @@ "@logicflow/extension": "^1.2.27", "@microsoft/signalr": "^8.0.7", "@vue-office/docx": "^1.6.2", - "@vue-office/excel": "^1.7.8", + "@vue-office/excel": "^1.7.11", "@vue-office/pdf": "^2.0.2", "@vueuse/core": "^10.11.0", "@wangeditor/editor": "^5.1.23", @@ -57,7 +57,7 @@ "splitpanes": "^3.1.5", "vcrontab-3": "^3.3.22", "vform3-builds": "^3.0.10", - "vue": "^3.4.31", + "vue": "^3.4.32", "vue-clipboard3": "^2.0.0", "vue-demi": "^0.14.8", "vue-grid-layout": "3.0.0-beta1", @@ -68,8 +68,8 @@ "vue-signature-pad": "^3.0.2", "vue3-tree-org": "^4.2.2", "vuedraggable": "4.0.3", - "vxe-pc-ui": "^4.0.68", - "vxe-table": "^4.7.51", + "vxe-pc-ui": "^4.0.74", + "vxe-table": "^4.7.54", "vxe-table-plugin-element": "^4.0.4", "vxe-table-plugin-export-xlsx": "^4.0.5", "xe-utils": "^3.5.28", @@ -79,14 +79,14 @@ "@iconify/vue": "^4.1.2", "@plugin-web-update-notification/vite": "^1.7.1", "@types/lodash-es": "^4.17.12", - "@types/node": "^20.14.10", + "@types/node": "^20.14.11", "@types/nprogress": "^0.2.3", "@types/sortablejs": "^1.15.8", - "@typescript-eslint/eslint-plugin": "^7.16.0", - "@typescript-eslint/parser": "^7.16.0", + "@typescript-eslint/eslint-plugin": "^7.16.1", + "@typescript-eslint/parser": "^7.16.1", "@vitejs/plugin-vue": "^5.0.5", "@vitejs/plugin-vue-jsx": "^4.0.0", - "@vue/compiler-sfc": "^3.4.31", + "@vue/compiler-sfc": "^3.4.32", "code-inspector-plugin": "^0.14.2", "eslint": "^9.7.0", "eslint-plugin-vue": "^9.27.0", @@ -94,9 +94,9 @@ "prettier": "^3.3.3", "rollup-plugin-visualizer": "^5.12.0", "sass": "^1.77.8", - "terser": "^5.31.2", + "terser": "^5.31.3", "typescript": "^5.5.3", - "vite": "^5.3.3", + "vite": "^5.3.4", "vite-plugin-cdn-import": "^1.0.1", "vite-plugin-compression2": "^1.1.2", "vite-plugin-vue-setup-extend": "^0.4.0", diff --git a/Web/src/App.vue b/Web/src/App.vue index 6a133901..edc4d2dd 100644 --- a/Web/src/App.vue +++ b/Web/src/App.vue @@ -159,6 +159,12 @@ const updateFavicon = (url: string): void => { // 加载系统信息 loadSysInfo(); + +// 阻止火狐浏览器在拖动时打开新窗口 +document.body.ondrop = function (event) { + event.preventDefault(); + event.stopPropagation(); +};