From e06328582c56414e94d51535e1512a643506d0a0 Mon Sep 17 00:00:00 2001 From: xxe Date: Thu, 8 Sep 2022 14:41:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=B7=E5=8D=A1=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HKCardOUT/Bootstrapper.cs | 11 +++++++++++ HKCardOUT/Helper/DataBus.cs | 2 ++ HKCardOUT/options.json | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/HKCardOUT/Bootstrapper.cs b/HKCardOUT/Bootstrapper.cs index 300c9c6..074a015 100644 --- a/HKCardOUT/Bootstrapper.cs +++ b/HKCardOUT/Bootstrapper.cs @@ -6,6 +6,8 @@ using System.Windows.Threading; using System.Windows; using Microsoft.Extensions.Configuration; using HKCardOUT.Helper; +using HKCardOUT.QuartzUtil.Job; +using HKCardOUT.QuartzUtil; namespace HKCardOUT { @@ -30,6 +32,8 @@ namespace HKCardOUT { var configer = (new ConfigurationBuilder()).AddJsonFile("options.json").Build(); DataBus.ConnectionString = configer.GetConnectionString("Sqlite"); + DataBus.Cron = configer["Cron"]; + DataBus.SaasRoute = configer["SaasRoute"]; base.Configure(); } @@ -55,6 +59,13 @@ namespace HKCardOUT /// protected override void OnLaunch() { + QuartzCoreFactory.QuartzCore().AddJob(new QuartzMap + { + JobDetail = "定时推送订单", + Cron = DataBus.Cron, + JobName = "订单", + JobGroup = "订单" + }); base.OnLaunch(); } diff --git a/HKCardOUT/Helper/DataBus.cs b/HKCardOUT/Helper/DataBus.cs index 4b0e545..f5a618d 100644 --- a/HKCardOUT/Helper/DataBus.cs +++ b/HKCardOUT/Helper/DataBus.cs @@ -20,5 +20,7 @@ namespace HKCardOUT.Helper _ConnectionString = SyncStatic.CreateFile(Path.Combine(SyncStatic.CreateDir(Route), value)); } } + public static string Cron { get; set; } + public static string SaasRoute { get; set; } } } diff --git a/HKCardOUT/options.json b/HKCardOUT/options.json index b32804d..4b872b7 100644 --- a/HKCardOUT/options.json +++ b/HKCardOUT/options.json @@ -1,6 +1,6 @@ { "SaasRoute": "", - "Cron": "", + "Cron": "0 0 11,15 * * ? ", "ConnectionStrings": { "Sqlite": "HKSQL.db3" }