2023-08-04
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using Quartz;
|
||||
using System.Threading;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public class MyJob : IJob
|
||||
{
|
||||
public async Task Execute(IJobExecutionContext context)
|
||||
{
|
||||
JobKey key = context.JobDetail.Key;
|
||||
|
||||
// note: use context.MergedJobDataMap in production code
|
||||
JobDataMap dataMap = context.JobDetail.JobDataMap;
|
||||
string InterFaceTaskId = dataMap.GetString("InterFaceTaskId");
|
||||
|
||||
//使用异步任务来实现
|
||||
await Task.Run(() =>
|
||||
{
|
||||
|
||||
InterFaceTaskService.ExecuteTasks(InterFaceTaskId);
|
||||
|
||||
|
||||
//Console.WriteLine($"{DateTime.Now}【{Thread.CurrentThread.ManagedThreadId}】:自定义的工作正在执行... ...");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user