31 lines
		
	
	
		
			804 B
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			31 lines
		
	
	
		
			804 B
		
	
	
	
		
			C#
		
	
	
	
| 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}】:自定义的工作正在执行... ...");
 | |
|             });
 | |
|         }
 | |
|     }
 | |
| }
 | |
| 
 |