From 4e2e728f5aa02a904157fc3d53b8a6dfb0eb6350 Mon Sep 17 00:00:00 2001 From: zcy <290198252@qq.com> Date: Wed, 9 Nov 2022 00:03:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=96=87=E7=AB=A0=E5=8E=86?= =?UTF-8?q?=E5=8F=B2=E8=AE=B0=E5=BD=95=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller/blog.go | 8 ++++---- main.go | 4 ++-- model/blog.go | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/controller/blog.go b/controller/blog.go index b29d88e..6166ba4 100644 --- a/controller/blog.go +++ b/controller/blog.go @@ -212,14 +212,14 @@ func GetArticleCount(c *gin.Context) { 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) - + sid := c.Query("id") + log.Print(sid) + query := `select * from doc_history where doc_id=` + sid + log.Print(query) doc_history := []model.DocHistory{} e := db.GetMysqlClient().Query2(query, &doc_history) diff --git a/main.go b/main.go index 5473afe..41520dc 100644 --- a/main.go +++ b/main.go @@ -177,8 +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.GET("/article_history",controller.GetArticleHistory) // 历史 + api.POST("/image_upload", fileController.OnUpload) // 上传图片,如果图片太大自动裁减为原来的一半 api.POST("/image_upload_origin", fileController.OnUploadOrigin) // 上传图片 api.GET("/image_download/:file", fileController.OnDownLoad) // 下载图片 diff --git a/model/blog.go b/model/blog.go index ae60b59..6640206 100644 --- a/model/blog.go +++ b/model/blog.go @@ -63,8 +63,8 @@ type DocHistory struct{ ID int32 `json:"id" gorm:"column:id" sql:"id"` Title string `json:"title" gorm:"column:title" sql:"title"` DocId int32 `json:"doc_id" gorm:"column:doc_id" sql:"doc_id"` - Content []byte `json:"content" gorm:"column:content" sql:"content"` - EditTime time.Time `json:"edit_time" gorm:"column:edit_time" sql:"edit_time"` + Content string `json:"content" gorm:"column:content" sql:"content"` + EditTime string `json:"edit_time" gorm:"column:edit_time" sql:"edit_time"` } type DocGroup struct {