From 6c9cb6168d292844b46a6f74d39ca71f96e1d87f Mon Sep 17 00:00:00 2001 From: zcy <290198252@qq.com> Date: Tue, 8 Nov 2022 23:39:04 +0800 Subject: [PATCH] no message --- controller/blog.go | 24 ++++++++++++++++++++++++ main.go | 3 ++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/controller/blog.go b/controller/blog.go index 1a5f971..b29d88e 100644 --- a/controller/blog.go +++ b/controller/blog.go @@ -208,6 +208,30 @@ func GetArticleCount(c *gin.Context) { resp.Msg = "OK" } + + +func GetArticleHistory(c *gin.Context) { + resp := RespBase{Msg: "FAIL", Status: 211} + + defer func() { + c.JSON(200, resp) + }() + + query := fmt.Sprintf("select * + from doc_history where doc_history.id = %d",req.id) + + doc_history := []model.DocHistory{} + + e := db.GetMysqlClient().Query2(query, &doc_history) + if nil != e { + log.Print(e.Error()) + return + } + resp.Data = doc_history + resp.Status = 0 + resp.Msg = "OK" +} + func GetArticle(c *gin.Context) { resp := RespBase{Msg: "FAIL", Status: 211} diff --git a/main.go b/main.go index d4868c7..5473afe 100644 --- a/main.go +++ b/main.go @@ -177,7 +177,8 @@ func main() { api.GET("/articleCount", controller.GetArticleCount) //获取所有文章个数 api.DELETE("/article/:id", controller.DeleteArticle) ////删除文章 api.DELETE("/article_tree/:id", controller.DeleteArticleTree) ////删除文章 - + api.GET("/article_history",controller.GetArticleCount) // 历史 + api.POST("/image_upload", fileController.OnUpload) // 上传图片,如果图片太大自动裁减为原来的一半 api.POST("/image_upload_origin", fileController.OnUploadOrigin) // 上传图片 api.GET("/image_download/:file", fileController.OnDownLoad) // 下载图片