From ba2731bf61c17454046b758da81196ae422083c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E7=9F=B3=E5=A4=B4?= Date: Thu, 31 Oct 2024 09:32:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=B2=A1=E6=9C=89=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=97=B6=E9=97=B4=E6=97=B6=EF=BC=8C=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=B8=BA=E4=BB=8A=E5=A4=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AntJob.Server/Services/JobService.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/AntJob.Server/Services/JobService.cs b/AntJob.Server/Services/JobService.cs index 99b2c0a..22acad1 100644 --- a/AntJob.Server/Services/JobService.cs +++ b/AntJob.Server/Services/JobService.cs @@ -83,6 +83,12 @@ public String[] AddJobs(App app, JobModel[] jobs) if (job.Cron.IsNullOrEmpty()) job.Cron = model.Cron; if (job.Topic.IsNullOrEmpty()) job.Topic = model.Topic; + // 定时调度和数据调度,自动设置DataTime + if (job.Mode is JobModes.Time or JobModes.Data) + { + if (job.DataTime.Year < 2000) job.DataTime = DateTime.Today; + } + // 添加定时作业时,计算下一次执行时间 if (job.ID == 0 && job.Mode == JobModes.Time) {