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 {