From 122447a6213b34fc6c5958ddb6ce5c2df6b221c7 Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Tue, 10 Jun 2025 10:31:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/Helper/HangfireJobHelper.cs | 3 +++ .../Service/Common/EmailNoticeConfigService.cs | 8 -------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/IRaCIS.Core.Application/Helper/HangfireJobHelper.cs b/IRaCIS.Core.Application/Helper/HangfireJobHelper.cs index c886d0555..ef5e78eed 100644 --- a/IRaCIS.Core.Application/Helper/HangfireJobHelper.cs +++ b/IRaCIS.Core.Application/Helper/HangfireJobHelper.cs @@ -89,6 +89,9 @@ namespace IRaCIS.Core.Application.Helper { case EmailBusinessScenario.GeneralTraining_ExpirationNotification: + + HangfireJobHelper.RemoveCronJob(jobId + "System"); + HangfireJobHelper.RemoveCronJob(jobId + "Trial"); Console.WriteLine("添加发邮件过期提醒任务"); HangfireJobHelper.AddOrUpdateCronJob(jobId+"System", t => t.Send(new SystemDocumentErverDayEvent() { }, default), emailCron); HangfireJobHelper.AddOrUpdateCronJob(jobId+"Trial", t => t.Send(new TrialDocumentErverDayEvent() { }, default), emailCron); diff --git a/IRaCIS.Core.Application/Service/Common/EmailNoticeConfigService.cs b/IRaCIS.Core.Application/Service/Common/EmailNoticeConfigService.cs index 28fab14b8..4bdc0d7b6 100644 --- a/IRaCIS.Core.Application/Service/Common/EmailNoticeConfigService.cs +++ b/IRaCIS.Core.Application/Service/Common/EmailNoticeConfigService.cs @@ -168,14 +168,6 @@ namespace IRaCIS.Core.Application.Contracts var jobId = $"{entity.Id}_({entity.BusinessScenarioEnum})"; //有的job 可能编辑控制直接不发,需要移除已存在的 - HangfireJobHelper.RemoveCronJob(jobId); - if (entity.BusinessScenarioEnum == EmailBusinessScenario.GeneralTraining_ExpirationNotification) - { - - HangfireJobHelper.RemoveCronJob(jobId + "System"); - HangfireJobHelper.RemoveCronJob(jobId + "Trial"); - } - if (entity.IsAutoSend && entity.IsEnable) { HangfireJobHelper.AddOrUpdateSystemCronJob(jobId, entity.BusinessScenarioEnum, entity.EmailCron);