public async Task <ActionResult <BaseResponse> > PauseJob(string id) { var job = _jobStore.QueryJob(id); if (job == null) { return(BaseResponse.GetResponse("任务不存在")); } if (job.Status == (int)JobStatus.Running) { var service = new ServiceRouteDescriptor(job.NodeHost, job.NodePort); var result = await _schedulerRemoting.PauseJob(job.Id, service); if (result) { job.Status = (int)JobStatus.Paused; job.NextRunTime = null; var updatedProperties = new Expression <Func <JobEntity, object> >[] { p => p.Status, p => p.NextRunTime }; result = _jobStore.UpdateEntity(job, updatedProperties); if (!result) { await _schedulerRemoting.ResumeJob(job.Id, service); } } return(BaseResponse.GetResponse(result)); } return(BaseResponse.GetResponse("任务在运行状态下才能暂停")); }