|
@@ -1,8 +1,10 @@
|
|
-using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
|
+using FreeScheduler;
|
|
|
|
+using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Hosting;
|
|
using Microsoft.Extensions.Hosting;
|
|
using ZhonTai.Admin.Core;
|
|
using ZhonTai.Admin.Core;
|
|
using ZhonTai.Admin.Core.Configs;
|
|
using ZhonTai.Admin.Core.Configs;
|
|
using ZhonTai.Admin.Core.Startup;
|
|
using ZhonTai.Admin.Core.Startup;
|
|
|
|
+using ZhonTai.Admin.Tools.TaskScheduler;
|
|
using ZhonTai.ApiUI;
|
|
using ZhonTai.ApiUI;
|
|
|
|
|
|
new HostApp(new HostAppOptions
|
|
new HostApp(new HostAppOptions
|
|
@@ -10,8 +12,30 @@ new HostApp(new HostAppOptions
|
|
//配置后置服务
|
|
//配置后置服务
|
|
ConfigurePostServices = context =>
|
|
ConfigurePostServices = context =>
|
|
{
|
|
{
|
|
- //context.Services.AddTiDb(context);
|
|
|
|
- },
|
|
|
|
|
|
+ //context.Services.AddTiDb(context);
|
|
|
|
+
|
|
|
|
+ //添加任务调度
|
|
|
|
+ context.Services.AddTaskScheduler(options =>
|
|
|
|
+ {
|
|
|
|
+ options.ConfigureFreeSql = freeSql =>
|
|
|
|
+ {
|
|
|
|
+ freeSql.CodeFirst
|
|
|
|
+ //配置任务表
|
|
|
|
+ .ConfigEntity<TaskInfo>(a =>
|
|
|
|
+ {
|
|
|
|
+ a.Name("app_task");
|
|
|
|
+ })
|
|
|
|
+ //配置任务日志表
|
|
|
|
+ .ConfigEntity<TaskLog>(a =>
|
|
|
|
+ {
|
|
|
|
+ a.Name("app_task_log");
|
|
|
|
+ });
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ //模块任务处理器
|
|
|
|
+ //options.TaskHandler = new ModuleTaskHandler(options.FreeSql);
|
|
|
|
+ });
|
|
|
|
+ },
|
|
//配置后置中间件
|
|
//配置后置中间件
|
|
ConfigurePostMiddleware = context =>
|
|
ConfigurePostMiddleware = context =>
|
|
{
|
|
{
|