123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- using OASystem.API.OAMethodLib.Quartz.Business;
- using Quartz;
- namespace OASystem.API.OAMethodLib.Quartz.Jobs
- {
- /// <summary>
- /// 任务消息推送
- /// 每天下午两点推送
- /// </summary>
- public class TaskNewsFeedJob : IJob
- {
- private readonly ILogger<TaskNewsFeedJob> _logger;
- public TaskNewsFeedJob(ILogger<TaskNewsFeedJob> logger)
- {
- _logger = logger;
- }
- /// <summary>
- /// 任务消息推送
- /// </summary>
- /// <param name="context"></param>
- /// <returns></returns>
- public async Task Execute(IJobExecutionContext context)
- {
- _logger.LogInformation("调用任务消息通知 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
- try
- {
- //在此处编写任务业务代码
- TaskNotification.PostTaskMessageNotification();
- }
- catch (Exception ex)
- {
- _logger.LogInformation($"调用任务消息通知ErrorMsg:{ex.Message} " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
- }
- //return Task.CompletedTask;
- await Task.CompletedTask;
- }
- }
- }
|