新增文章历史记录接口
parent
6c9cb6168d
commit
4e2e728f5a
|
@ -212,14 +212,14 @@ func GetArticleCount(c *gin.Context) {
|
||||||
|
|
||||||
func GetArticleHistory(c *gin.Context) {
|
func GetArticleHistory(c *gin.Context) {
|
||||||
resp := RespBase{Msg: "FAIL", Status: 211}
|
resp := RespBase{Msg: "FAIL", Status: 211}
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
c.JSON(200, resp)
|
c.JSON(200, resp)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
query := fmt.Sprintf("select *
|
sid := c.Query("id")
|
||||||
from doc_history where doc_history.id = %d",req.id)
|
log.Print(sid)
|
||||||
|
query := `select * from doc_history where doc_id=` + sid
|
||||||
|
log.Print(query)
|
||||||
doc_history := []model.DocHistory{}
|
doc_history := []model.DocHistory{}
|
||||||
|
|
||||||
e := db.GetMysqlClient().Query2(query, &doc_history)
|
e := db.GetMysqlClient().Query2(query, &doc_history)
|
||||||
|
|
2
main.go
2
main.go
|
@ -177,7 +177,7 @@ func main() {
|
||||||
api.GET("/articleCount", controller.GetArticleCount) //获取所有文章个数
|
api.GET("/articleCount", controller.GetArticleCount) //获取所有文章个数
|
||||||
api.DELETE("/article/:id", controller.DeleteArticle) ////删除文章
|
api.DELETE("/article/:id", controller.DeleteArticle) ////删除文章
|
||||||
api.DELETE("/article_tree/:id", controller.DeleteArticleTree) ////删除文章
|
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", fileController.OnUpload) // 上传图片,如果图片太大自动裁减为原来的一半
|
||||||
api.POST("/image_upload_origin", fileController.OnUploadOrigin) // 上传图片
|
api.POST("/image_upload_origin", fileController.OnUploadOrigin) // 上传图片
|
||||||
|
|
|
@ -63,8 +63,8 @@ type DocHistory struct{
|
||||||
ID int32 `json:"id" gorm:"column:id" sql:"id"`
|
ID int32 `json:"id" gorm:"column:id" sql:"id"`
|
||||||
Title string `json:"title" gorm:"column:title" sql:"title"`
|
Title string `json:"title" gorm:"column:title" sql:"title"`
|
||||||
DocId int32 `json:"doc_id" gorm:"column:doc_id" sql:"doc_id"`
|
DocId int32 `json:"doc_id" gorm:"column:doc_id" sql:"doc_id"`
|
||||||
Content []byte `json:"content" gorm:"column:content" sql:"content"`
|
Content string `json:"content" gorm:"column:content" sql:"content"`
|
||||||
EditTime time.Time `json:"edit_time" gorm:"column:edit_time" sql:"edit_time"`
|
EditTime string `json:"edit_time" gorm:"column:edit_time" sql:"edit_time"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type DocGroup struct {
|
type DocGroup struct {
|
||||||
|
|
Loading…
Reference in New Issue