From 35e279926c8e3e4f1af5882f78f64d063ee45462 Mon Sep 17 00:00:00 2001 From: "Mr. Lan" Date: Thu, 16 Jul 2020 01:50:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B5=81=E7=A8=8B=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apis/process/process.go | 28 ++++++++++++++-------------- router/process/process.go | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/apis/process/process.go b/apis/process/process.go index 799d9fd..1a58f75 100644 --- a/apis/process/process.go +++ b/apis/process/process.go @@ -118,20 +118,20 @@ func UpdateProcess(c *gin.Context) { } // 删除流程 -//func DeleteProcess(c *gin.Context) { -// processId := c.DefaultQuery("processId", "") -// if processId == "" { -// Response(c, code.InternalServerError, nil, "参数不正确,请确定参数processId是否传递") -// return -// } -// -// err := connection.DB.Self.Delete(process2.Info{}, "id = ?", processId).Error -// if err != nil { -// Response(c, code.DeleteError, nil, fmt.Sprintf("删除流程失败, %v", err.Error())) -// return -// } -// Response(c, nil, nil, "") -//} +func DeleteProcess(c *gin.Context) { + processId := c.DefaultQuery("processId", "") + if processId == "" { + app.Error(c, -1, errors.New("参数不正确,请确定参数processId是否传递"), "") + return + } + + err := orm.Eloquent.Delete(process2.Info{}, "id = ?", processId).Error + if err != nil { + app.Error(c, -1, err, fmt.Sprintf("删除流程失败, %v", err.Error())) + return + } + app.OK(c, "", "删除流程成功") +} // 流程详情 func ProcessDetails(c *gin.Context) { diff --git a/router/process/process.go b/router/process/process.go index 4718923..9806ef5 100644 --- a/router/process/process.go +++ b/router/process/process.go @@ -19,7 +19,7 @@ func RegisterProcessRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddle processRouter.GET("", process.ProcessList) processRouter.POST("", process.CreateProcess) processRouter.PUT("", process.UpdateProcess) - //processRouter.DELETE("", process.DeleteProcess) + processRouter.DELETE("", process.DeleteProcess) processRouter.GET("/details", process.ProcessDetails) } }