no message

master
DESKTOP-4RNDQIC\29019 2021-01-25 22:34:45 +08:00
parent 37dd7d8b6f
commit da77cb86d5
3 changed files with 4 additions and 2 deletions

View File

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

View File

@ -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) // 删除书籍

View File

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