コード例 #1
0
        /// <summary>
        /// 创建连续性任务
        /// </summary>
        /// <param name="jobId">任务编号</param>
        /// <returns></returns>
        public async Task <ResultDTO> ContinuationsJobs(string jobId)
        {
            var NewMaxId = MaxId + 1;
            var id       = await Db.ExecuteScalarAsync <string>("select max(TaskId) from HangfireInfo");

            var intJobId = Convert.ToInt32(id);

            BackgroundJob.ContinueJobWith(jobId, () => ContinuationsJob());
            var datetime = await Db.ExecuteScalarAsync <string>("select ExecutionTime from HangfireInfo where TaskId = @0", jobId);

            hangFireLog = new HangfireLogger(NewMaxId, 0, (intJobId + 1).ToString(), jobId, "Continuations-jobs", TaskStatusCode.Success, DateTime.Now.ToString("F"), datetime);
            await Db.InsertAsync(hangFireLog);

            return(new ResultDTO(200, "连续性任务开启成功", ResultStatus.Suceess));
        }