From ad1c56290e07a7068b1b9acf9c2bd6be79a8c5ab Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Wed, 10 Apr 2024 13:08:44 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE):?= =?UTF-8?q?=20=E4=BC=98=E5=8C=96=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../metersphere/system/controller/TaskCenterController.java | 6 +++--- .../controller/TaskCenterScheduleControllerTests.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) 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 * * * ?"); } }