新增文章历史记录接口

master
zcy 2022-11-09 00:03:38 +08:00
parent 6c9cb6168d
commit 4e2e728f5a
3 changed files with 8 additions and 8 deletions

View File

@ -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)

View File

@ -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) // 下载图片

View File

@ -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 {