From e3dbc2586ed75c7dd45382b891c8c39feff609ab Mon Sep 17 00:00:00 2001 From: zouap Date: Wed, 12 Oct 2022 09:08:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81=EF=BC=8C?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=81=9C=E6=AD=A2=E4=BB=BB=E5=8A=A1=E7=9A=84?= =?UTF-8?q?Bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/aisafety.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/routers/repo/aisafety.go b/routers/repo/aisafety.go index c350c66f1..e4a41fd85 100644 --- a/routers/repo/aisafety.go +++ b/routers/repo/aisafety.go @@ -201,17 +201,14 @@ func StopAiSafetyTask(ctx *context.Context) { func DelAiSafetyTask(ctx *context.Context) { var ID = ctx.Params(":jobid") task, err := models.GetCloudbrainByIDWithDeleted(ID) - result := make(map[string]interface{}) - result["code"] = 1 + if err != nil { log.Error("GetCloudbrainByJobID failed:" + err.Error()) - result["msg"] = "No such task." ctx.ServerError("No such task.", err) return } if task.Status != string(models.JobStopped) && task.Status != string(models.JobFailed) && task.Status != string(models.JobSucceeded) { log.Error("the job(%s) has not been stopped", task.JobName, ctx.Data["msgID"]) - result["msg"] = "the job(" + task.JobName + ") has not been stopped" ctx.ServerError("the job("+task.JobName+") has not been stopped", nil) return } @@ -220,7 +217,6 @@ func DelAiSafetyTask(ctx *context.Context) { } err = models.DeleteJob(task) if err != nil { - result["msg"] = err.Error() ctx.ServerError(err.Error(), err) return }