public async Task Execute(IJobExecutionContext context) { var executeLog = await ExecuteJob(context, async() => await Run(context)); // 可以直接获取 JobDetail 的值 var jobKey = context.JobDetail.Key; var jobId = jobKey.Name; //var param = context.MergedJobDataMap; // 也可以通过数据库配置,获取传递过来的参数 JobDataMap data = context.JobDetail.JobDataMap; //int jobId = data.GetInt("JobParam"); var model = _tasksQzService.GetId(jobId); if (model != null) { model.RunTimes += 1; model.Remark = LogHelpers.logWrite(executeLog); _tasksQzService.Update(model); } _logger.LogDebug(executeLog); }
public IActionResult Get(string id) { if (!string.IsNullOrEmpty(id)) { return(toResponse(_tasksQzService.GetId(id))); } return(toResponse(_tasksQzService.GetAll())); }