diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/TaskCenterController.java b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/TaskCenterController.java index 767c2b9a27..1eefa6aa2f 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/TaskCenterController.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/TaskCenterController.java @@ -65,11 +65,11 @@ public class TaskCenterController { taskCenterService.enable(id); } - @PostMapping("/schedule/update/{id}/{cron}") + @PostMapping("/schedule/update/{id}") @Operation(summary = "系统-任务中心-修改定时任务") @CheckOwner(resourceId = "#id", resourceType = "schedule") - public void update(@PathVariable String id, @PathVariable String cron) { - taskCenterService.update(id, cron); + public void update(@PathVariable String id, @RequestBody Object cron) { + taskCenterService.update(id, cron.toString()); } diff --git a/backend/services/system-setting/src/test/java/io/metersphere/system/controller/TaskCenterScheduleControllerTests.java b/backend/services/system-setting/src/test/java/io/metersphere/system/controller/TaskCenterScheduleControllerTests.java index 04c2a5a17b..384a16e0c5 100644 --- a/backend/services/system-setting/src/test/java/io/metersphere/system/controller/TaskCenterScheduleControllerTests.java +++ b/backend/services/system-setting/src/test/java/io/metersphere/system/controller/TaskCenterScheduleControllerTests.java @@ -193,6 +193,6 @@ class TaskCenterScheduleControllerTests extends BaseTest { scheduleService.getScheduleByResource(schedule.getResourceId(), schedule.getJob()); this.requestGet("/task/center/schedule/switch" + "test-schedule-switch"); this.requestGet("/task/center/schedule/switch" + "test-schedule-switch"); - this.requestGet("/task/center/schedule/update/" + "test-schedule-switch" + "/0 0/2 * * * ?"); + this.requestPost("/task/center/schedule/update/" + "test-schedule-switch" ,"/0 0/2 * * * ?"); } }