You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.4 KiB
C#

using Admin.Core.IService.ISys;
using Admin.Core.IService;
using Admin.Core.Service;
using Quartz;
using System;
using System.Threading.Tasks;
/// <summary>
/// 这里要注意下,命名空间和程序集是一样的,不然反射不到
/// </summary>
namespace Admin.Core.Tasks
{
public class Job_DataTask_Quartz : JobBase, IJob
{
private readonly ISysTasksQzService _tasksQzService;
public Job_DataTask_Quartz(ISysTasksQzService tasksQzService, ISysTasksQzService SysTasksQzService, ISysJobLogService sysJobLogService)
{
_tasksQzService = tasksQzService;
_SysTasksQzService = SysTasksQzService;
_sysJobLogService = sysJobLogService;
}
public async Task Execute(IJobExecutionContext context)
{
Console.WriteLine("sa");
await ExecuteJob(context, async () => await Run(context));
}
public Task Run(IJobExecutionContext context)
{
//var r = await _tasksQzService.Query(d=>d.IsStart==true);
//foreach (var item in r)
//{
// Console.WriteLine($"[{DateTime.Now}] 任务1 [{item.Name}]");
//}
//Console.WriteLine($"[{DateTime.Now}] 任务1 [{Guid.NewGuid()}]");
Console.WriteLine($"[{DateTime.Now}] 任务 [DataTask]");
return Task.CompletedTask;
}
}
}