diff --git a/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.FileSystem/LINGYUN/Abp/OssManagement/FileSystem/FileSystemOssContainer.cs b/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.FileSystem/LINGYUN/Abp/OssManagement/FileSystem/FileSystemOssContainer.cs index 4be7384e2..d12aa2624 100644 --- a/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.FileSystem/LINGYUN/Abp/OssManagement/FileSystem/FileSystemOssContainer.cs +++ b/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.FileSystem/LINGYUN/Abp/OssManagement/FileSystem/FileSystemOssContainer.cs @@ -459,10 +459,14 @@ namespace LINGYUN.Abp.OssManagement.FileSystem .Select(ConvertFileSystem) .ToArray(); - // 计算下一页起始标记文件/目录名称 - var nextMarkerIndex = fileSystemNames.FindIndex(x => x.EndsWith(fileSystems[fileSystems.Length - 1].Name)); - string nextMarker = ""; - if (nextMarkerIndex >=0 && nextMarkerIndex + 1 < fileSystemNames.Length) + var nextMarkerIndex = -1; + if (fileSystems.Length > 0) + { + // 计算下一页起始标记文件/目录名称 + nextMarkerIndex = fileSystemNames.FindIndex(x => x.EndsWith(fileSystems[^1].Name)); + } + var nextMarker = ""; + if (nextMarkerIndex >= 0 && nextMarkerIndex + 1 < fileSystemNames.Length) { nextMarker = fileSystemNames[nextMarkerIndex + 1]; nextMarker = File.Exists(nextMarker) diff --git a/aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks.ExceptionHandling/LINGYUN.Abp.BackgroundTasks.ExceptionHandling.csproj b/aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks.ExceptionHandling/LINGYUN.Abp.BackgroundTasks.ExceptionHandling.csproj index a5dd97fab..45c0aed6a 100644 --- a/aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks.ExceptionHandling/LINGYUN.Abp.BackgroundTasks.ExceptionHandling.csproj +++ b/aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks.ExceptionHandling/LINGYUN.Abp.BackgroundTasks.ExceptionHandling.csproj @@ -20,10 +20,10 @@ + - diff --git a/aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks.ExceptionHandling/LINGYUN/Abp/BackgroundTasks/ExceptionHandling/AbpBackgroundTasksExceptionHandlingModule.cs b/aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks.ExceptionHandling/LINGYUN/Abp/BackgroundTasks/ExceptionHandling/AbpBackgroundTasksExceptionHandlingModule.cs index 705a36a01..4e20f436c 100644 --- a/aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks.ExceptionHandling/LINGYUN/Abp/BackgroundTasks/ExceptionHandling/AbpBackgroundTasksExceptionHandlingModule.cs +++ b/aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks.ExceptionHandling/LINGYUN/Abp/BackgroundTasks/ExceptionHandling/AbpBackgroundTasksExceptionHandlingModule.cs @@ -1,13 +1,13 @@ -using LINGYUN.Abp.BackgroundTasks.Jobs; -using LINGYUN.Abp.BackgroundTasks.Localization; +using LINGYUN.Abp.BackgroundTasks.Localization; using Volo.Abp.Localization; using Volo.Abp.Modularity; +using Volo.Abp.Emailing; using Volo.Abp.VirtualFileSystem; namespace LINGYUN.Abp.BackgroundTasks.ExceptionHandling; [DependsOn(typeof(AbpBackgroundTasksModule))] -[DependsOn(typeof(AbpBackgroundTasksJobsModule))] +[DependsOn(typeof(AbpEmailingModule))] public class AbpBackgroundTasksExceptionHandlingModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) diff --git a/aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks.ExceptionHandling/LINGYUN/Abp/BackgroundTasks/ExceptionHandling/JobFailedNotifierProvider.cs b/aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks.ExceptionHandling/LINGYUN/Abp/BackgroundTasks/ExceptionHandling/JobFailedNotifierProvider.cs index f1a6abf8a..33791fc93 100644 --- a/aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks.ExceptionHandling/LINGYUN/Abp/BackgroundTasks/ExceptionHandling/JobFailedNotifierProvider.cs +++ b/aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks.ExceptionHandling/LINGYUN/Abp/BackgroundTasks/ExceptionHandling/JobFailedNotifierProvider.cs @@ -1,6 +1,5 @@ using JetBrains.Annotations; using LINGYUN.Abp.BackgroundTasks.ExceptionHandling.Templates; -using LINGYUN.Abp.BackgroundTasks.Jobs; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Newtonsoft.Json; @@ -12,7 +11,6 @@ using Volo.Abp.DependencyInjection; using Volo.Abp.Emailing; using Volo.Abp.MultiTenancy; using Volo.Abp.TextTemplating; -using Volo.Abp.Timing; namespace LINGYUN.Abp.BackgroundTasks.ExceptionHandling; @@ -21,6 +19,32 @@ public class JobFailedNotifierProvider : IJobFailedNotifierProvider, ITransientD public const string Prefix = "exception."; public const string JobGroup = "ExceptionNotifier"; + public const string PropertyFrom = "from"; + /// + /// 接收者 + /// + public const string PropertyTo = "to"; + /// + /// 必须,邮件主体 + /// + public const string PropertySubject = "subject"; + /// + /// 消息内容, 文本消息时必须 + /// + public const string PropertyBody = "body"; + /// + /// 发送模板消息 + /// + public const string PropertyTemplate = "template"; + /// + /// 可选, 模板消息中的上下文参数 + /// + public const string PropertyContext = "context"; + /// + /// 可选, 模板消息中的区域性 + /// + public const string PropertyCulture = "culture"; + public ILogger Logger { protected get; set; } protected IEmailSender EmailSender { get; } @@ -45,13 +69,13 @@ public class JobFailedNotifierProvider : IJobFailedNotifierProvider, ITransientD Logger.LogWarning($"There is a problem executing the job, reason: {eventData.Exception.Message}"); return; } - var notifyKey = Prefix + SendEmailJob.PropertyTo; + var notifyKey = Prefix + PropertyTo; if (eventData.Args.TryGetValue(notifyKey, out var exceptionTo) && exceptionTo is string to) { - var template = eventData.Args.GetOrDefault(Prefix + SendEmailJob.PropertyTemplate)?.ToString() ?? ""; - var subject = eventData.Args.GetOrDefault(Prefix + SendEmailJob.PropertySubject)?.ToString() ?? "From job execute exception"; - var from = eventData.Args.GetOrDefault(Prefix + SendEmailJob.PropertyFrom)?.ToString() ?? ""; + var template = eventData.Args.GetOrDefault(Prefix + PropertyTemplate)?.ToString() ?? ""; + var subject = eventData.Args.GetOrDefault(Prefix + PropertySubject)?.ToString() ?? "From job execute exception"; + var from = eventData.Args.GetOrDefault(Prefix + PropertyFrom)?.ToString() ?? ""; var errorMessage = eventData.Exception.GetBaseException().Message; if (template.IsNullOrWhiteSpace()) @@ -78,7 +102,7 @@ public class JobFailedNotifierProvider : IJobFailedNotifierProvider, ITransientD }; var globalContext = new Dictionary(); - if (eventData.Args.TryGetValue(Prefix + SendEmailJob.PropertyContext, out var ctx) && + if (eventData.Args.TryGetValue(Prefix + PropertyContext, out var ctx) && ctx is string ctxStr && !ctxStr.IsNullOrWhiteSpace()) { try @@ -89,7 +113,7 @@ public class JobFailedNotifierProvider : IJobFailedNotifierProvider, ITransientD } globalContext.AddIfNotContains(eventData.Args); - var culture = eventData.Args.GetOrDefault(Prefix + SendEmailJob.PropertyCulture)?.ToString() ?? CultureInfo.CurrentCulture.Name; + var culture = eventData.Args.GetOrDefault(Prefix + PropertyCulture)?.ToString() ?? CultureInfo.CurrentCulture.Name; var content = await TemplateRenderer.RenderAsync( templateName: template,