| | |
| | | return Ok(response); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据Job实体名称和Job名称添加任务 |
| | | /// </summary> |
| | | /// <param name="action"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [Route("api/[controller]/[action]")] |
| | | public async Task<IActionResult> AddJob(ApiAction<FluentJobParam> action) |
| | | { |
| | | ApiAction response = new(); |
| | | try |
| | | { |
| | | response = response.GetResponse(DI.Resolve<IBizContext>().GetInterfaceService()?.AddJob(action.NewDataEntity(), action.Data) ?? new ApiAction($"任务未启用", false)); |
| | | } |
| | | catch (System.Exception ex) |
| | | { |
| | | response = response.GetResponse().CatchExceptionWithLog(ex); |
| | | } |
| | | return Ok(response); |
| | | } |
| | | |
| | | [HttpPost] |
| | | [Route("api/[controller]/[action]")] |
| | | public async Task<IActionResult> UpdateJob(ApiAction<TSK_JOB> action) |
| | |
| | | } |
| | | return Ok(response); |
| | | } |
| | | |
| | | #region 新版计划任务 |
| | | |
| | | |
| | | /// <summary> |
| | | /// 根据Job实体名称和Job名称添加任务 |
| | | /// </summary> |
| | | /// <param name="action"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [Route("api/[controller]/[action]")] |
| | | public async Task<IActionResult> AddTskJob(ApiAction<FluentJobParam> action) |
| | | { |
| | | ApiAction response = new(); |
| | | try |
| | | { |
| | | response = response.GetResponse(DI.Resolve<IBizContext>().GetInterfaceService()?.AddTskJob(action.NewDataEntity(), action.Data) ?? new ApiAction($"任务未启用", false)); |
| | | } |
| | | catch (System.Exception ex) |
| | | { |
| | | response = response.GetResponse().CatchExceptionWithLog(ex); |
| | | } |
| | | return Ok(response); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 删除作业 |
| | | /// </summary> |
| | | /// <param name="action"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [Route("api/[controller]/[action]")] |
| | | public async Task<IActionResult> RemoveTskJob(ApiAction action) |
| | | { |
| | | ApiAction response = new(); |
| | | try |
| | | { |
| | | DI.Resolve<IBizContext>().GetInterfaceService()?.RemovefJob(action.Data?.ToString()); |
| | | } |
| | | catch (System.Exception ex) |
| | | { |
| | | response = response.GetResponse().CatchExceptionWithLog(ex); |
| | | } |
| | | return Ok(response); |
| | | } |
| | | #endregion |
| | | } |
| | | } |