From 7e0414c91a51219a92515c90ccb803ebade5613a Mon Sep 17 00:00:00 2001 From: duheng <2784771470@qq.com> Date: 星期二, 11 二月 2025 13:39:05 +0800 Subject: [PATCH] 遗漏提交 --- WaterPredict/IStation.ChEr.WebApi.Predict/任务/PredictCronJobHelper.cs | 21 ++++++++++++--------- 1 files changed, 12 insertions(+), 9 deletions(-) diff --git "a/WaterPredict/IStation.ChEr.WebApi.Predict/\344\273\273\345\212\241/PredictCronJobHelper.cs" "b/WaterPredict/IStation.ChEr.WebApi.Predict/\344\273\273\345\212\241/PredictCronJobHelper.cs" index 2b3f688..3ad8e1f 100644 --- "a/WaterPredict/IStation.ChEr.WebApi.Predict/\344\273\273\345\212\241/PredictCronJobHelper.cs" +++ "b/WaterPredict/IStation.ChEr.WebApi.Predict/\344\273\273\345\212\241/PredictCronJobHelper.cs" @@ -1,4 +1,6 @@ 锘縰sing Quartz; +using System.Reflection; +using System.Xml.Linq; namespace IStation.ChEr.WebApi; @@ -13,7 +15,6 @@ private static IScheduler _sched;//璋冨害鍣� - /// <summary> /// 寮�濮嬩换鍔� /// </summary> public async Task StartJob() @@ -33,19 +34,21 @@ .WithIdentity(_jobName, _jobGroup) .Build(); + var root_directory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + var filePath = Path.Combine(root_directory, "Data", "cronsetting.txt"); + var cron = File.ReadAllText(filePath); // 4.鍒涘缓Trigger var trigger = TriggerBuilder.Create() .WithIdentity(_triggerName, _jobGroup) - .WithCronSchedule("0 43 0/1 * * ? ")//"0 32 0/1 * * ? " + .WithCronSchedule(cron)//"0 32 0/1 * * ? " .Build(); - /* //4.鍒涘缓Trigger - var trigger = TriggerBuilder.Create() - .WithIdentity(_triggerName, _jobGroup) - .WithSimpleSchedule(x => x.WithIntervalInSeconds(2) - .RepeatForever().WithMisfireHandlingInstructionNextWithRemainingCount()) - .Build(); -*/ + /* //4.鍒涘缓Trigger + var trigger = TriggerBuilder.Create() + .WithIdentity(_triggerName, _jobGroup) + .WithSimpleSchedule(x => x.WithIntervalInSeconds(10) + .RepeatForever().WithMisfireHandlingInstructionNextWithRemainingCount()) + .Build();*/ //5.鍔犲叆璋冨害绠$悊鍣� await _sched.ScheduleJob(job, trigger); } -- Gitblit v1.9.3