public JsonResult AddOrUpdateRecurringJob([FromBody] Hangfire.HttpJob.Server.HttpJobItem httpJob)
 {
     try
     {
         RecurringJob.AddOrUpdate(httpJob.JobName, () => Hangfire.HttpJob.Server.HttpJob.Excute(httpJob, httpJob.JobName, httpJob.QueueName, httpJob.IsRetry, null), httpJob.Corn, TimeZoneInfo.Local);
     }
     catch (Exception ec)
     {
         return(Json(new Message()
         {
             Code = false, ErrorMessage = ec.ToString()
         }));
     }
     return(Json(new Message()
     {
         Code = true, ErrorMessage = ""
     }));
 }
        public JsonResult AddBackGroundJob([FromBody] Hangfire.HttpJob.Server.HttpJobItem httpJob)
        {
            var addreslut = string.Empty;

            try
            {
                addreslut = BackgroundJob.Enqueue(() => Hangfire.HttpJob.Server.HttpJob.Excute(httpJob, httpJob.JobName, httpJob.QueueName, httpJob.IsRetry, null));
            }
            catch (Exception ec)
            {
                return(Json(new Message()
                {
                    Code = false, ErrorMessage = ec.ToString()
                }));
            }
            return(Json(new Message()
            {
                Code = true, ErrorMessage = ""
            }));
        }
        public JsonResult AddScheduleJob([FromBody] Hangfire.HttpJob.Server.HttpJobItem httpJob)
        {
            var reslut = string.Empty;

            try
            {
                reslut = BackgroundJob.Schedule(() => Hangfire.HttpJob.Server.HttpJob.Excute(httpJob, httpJob.JobName, httpJob.QueueName, httpJob.IsRetry, null), TimeSpan.FromMinutes(httpJob.DelayFromMinutes));
            }
            catch (Exception ec)
            {
                return(Json(new Message()
                {
                    Code = false, ErrorMessage = ec.ToString()
                }));
            }
            return(Json(new Message()
            {
                Code = true, ErrorMessage = ""
            }));
        }
 /// <summary>
 /// 执行连续任务
 /// </summary>
 /// <param name="httpJob"></param>
 public void RunContinueJob(Hangfire.HttpJob.Server.HttpJobItem httpJob)
 {
     BackgroundJob.Enqueue(() => Hangfire.HttpJob.Server.HttpJob.Excute(httpJob, httpJob.JobName, httpJob.QueueName, httpJob.IsRetry, null));
 }