From da77cb86d5a2489c17357e8ec3fd61b1986cf33e Mon Sep 17 00:00:00 2001 From: "DESKTOP-4RNDQIC\\29019" <290198252@qq.com> Date: Mon, 25 Jan 2021 22:34:45 +0800 Subject: [PATCH] no message --- controller/blog.go | 3 ++- main.go | 2 +- model/book.go | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/controller/blog.go b/controller/blog.go index a0a5464..53860c4 100644 --- a/controller/blog.go +++ b/controller/blog.go @@ -434,7 +434,8 @@ func GetBook(c *gin.Context) { } var book model.Book book.ID = int64(req.ID) - if e == db.GetOrm().First(&book, req.ID).Error { + e = db.GetOrm().First(&book, req.ID).Error + if e != nil { logs.Error(e.Error) return } diff --git a/main.go b/main.go index 3a8efd7..b5c9f40 100644 --- a/main.go +++ b/main.go @@ -170,7 +170,7 @@ func main() { api.PUT("/book", controller.CreateBook) // api.POST("/book", controller.UpdateBook) // - api.POST("/book", controller.GetBook) // 单书籍数据 + api.POST("/getbook", controller.GetBook) // 单书籍数据 api.POST("/books", controller.GetPageBook) // 批量书籍 api.POST("/delbook", controller.DeleteMemos) // 删除书籍 diff --git a/model/book.go b/model/book.go index e0c6ca3..3df70b5 100644 --- a/model/book.go +++ b/model/book.go @@ -7,6 +7,7 @@ type Book struct { Author string `gorm:"column:author" sql:"author" json:"author"` Title string `gorm:"column:title" sql:"title" json:"title"` Tag string `gorm:"column:tag" sql:"tag" json:"tag"` + Content string `gorm:"column:content" sql:"content" json:"content"` CreateTime utils.OrmTime ` gorm:"column:create_time" sql:"create_time" json:"create_time"` } // 设置User的表名为`profiles`