From 33e10b99abf0492d15bbd71875ef0be876b8912f Mon Sep 17 00:00:00 2001 From: "DESKTOP-4RNDQIC\\29019" <290198252@qq.com> Date: Fri, 26 Mar 2021 21:44:35 +0800 Subject: [PATCH] no message --- controller/blog.go | 15 +++++++++++++-- model/template.go | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/controller/blog.go b/controller/blog.go index e6ca7f3..4629609 100644 --- a/controller/blog.go +++ b/controller/blog.go @@ -795,7 +795,18 @@ func DeleteDocTemplate(c *gin.Context) { defer func() { c.JSON(200, resp) }() - type ReqDeleteDocTemplate struct { + sid := c.Param("id") + id,e := strconv.Atoi(sid) + if nil != e{ + log.Print(e.Error()) + return } - + e = model.DeleteDocTemplate(int32(id)) + if nil != e{ + log.Print(e.Error()) + return + } + resp.Data = nil + resp.Msg = "OK" + resp.Status = 0 } \ No newline at end of file diff --git a/model/template.go b/model/template.go index ed15694..06a4d18 100644 --- a/model/template.go +++ b/model/template.go @@ -37,7 +37,7 @@ func UpdateDocTemplate(templ DocTemplate) error{ } func DeleteDocTemplate(id int32) error{ - sql := fmt.Sprintf(`delete from doc_template doc_template memo.id = '%d'`,id) + sql := fmt.Sprintf(`delete from doc_template where id = '%d'`,id) _, e := db.GetMysqlClient().Query(sql) if nil != e { logs.Error(e.Error())