public async Task <ActionResult> SwitchStatus(SwitchStatusRequest switchRequest) { AjaxResult ajaxResult = new AjaxResult(); TaskJobInfo info = _yunYingRepository.GetModel <TaskJobInfo>(new { JobID = switchRequest.JobId }); if (info == null) { ajaxResult.IsOk = false; ajaxResult.Msg = $"作业不存在[jobid={switchRequest.JobId}]"; return(Json(ajaxResult)); } await _quartzManager.CreateJob(info); if (switchRequest.Status == 1) { await _quartzManager.ResumeJob(info.JobName); } else if (switchRequest.Status == 2) { await _quartzManager.PauseJob(info.JobName); } else if (switchRequest.Status == 3) { await _quartzManager.DeleteJob(info.JobName); await _quartzManager.CreateJob(info); } ajaxResult.IsOk = true; ajaxResult.Msg = "操作成功"; return(Json(ajaxResult)); }