no message
This commit is contained in:
parent
368751fbf6
commit
5b9ec97933
@ -1,10 +1,11 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"gopkg.in/yaml.v2"
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
"runtime"
|
||||
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
var ostype = runtime.GOOS
|
||||
|
@ -172,6 +172,19 @@ func UpdateArtilce(c *gin.Context) {
|
||||
defer func() {
|
||||
c.JSON(200, rsp)
|
||||
}()
|
||||
|
||||
query := fmt.Sprintf("select * from doc where doc.id = '%d'", id)
|
||||
docs := []model.Doc{}
|
||||
e := db.GetMysqlClient().Query2(query, &docs)
|
||||
if nil != e {
|
||||
log.Print(e.Error())
|
||||
return
|
||||
}
|
||||
if len(docs) == 0 {
|
||||
rsp.Msg = "不存在该"
|
||||
return
|
||||
}
|
||||
|
||||
er := c.BindJSON(&req)
|
||||
if nil != er {
|
||||
logs.Error(er.Error())
|
||||
@ -181,14 +194,15 @@ func UpdateArtilce(c *gin.Context) {
|
||||
rsp.Msg = "title required"
|
||||
return
|
||||
}
|
||||
e := model.UpdateDoc(
|
||||
e = model.UpdateDoc(
|
||||
model.Doc{
|
||||
Type: req.Type,
|
||||
Type: int32(req.Type),
|
||||
Title: req.Title,
|
||||
Content: req.Content,
|
||||
Author: req.author,
|
||||
ID: req.Id,
|
||||
IsPublic: req.IsPublic,
|
||||
IsPublic: int32(req.IsPublic),
|
||||
Version: (docs[0].Version + 1),
|
||||
},
|
||||
)
|
||||
if nil != e {
|
||||
|
@ -12,12 +12,18 @@ import (
|
||||
)
|
||||
|
||||
type Doc struct {
|
||||
ID int64 `sql:"id" json:"id"`
|
||||
Title string `sql:"title" json:"title"`
|
||||
Type int64 `sql:"type" json:"type"`
|
||||
Content string `sql:"content" json:"content"`
|
||||
Author string `sql:"author" json:"author"`
|
||||
IsPublic int `sql:"is_public" json:"is_public"`
|
||||
ID int64 `json:"id" gorm:"column:id" sql:"id"`
|
||||
Title string `json:"title" gorm:"column:title" sql:"title"`
|
||||
Type int32 `json:"type" gorm:"column:type" sql:"type"`
|
||||
Content string `json:"content" gorm:"column:content" sql:"content"`
|
||||
Author string `json:"author" gorm:"column:author" sql:"author"`
|
||||
CreateTime time.Time `json:"create_time" gorm:"column:create_time" sql:"create_time"`
|
||||
UpdateTime time.Time `json:"update_time" gorm:"column:update_time" sql:"update_time"`
|
||||
DeleteTime time.Time `json:"delete_time" gorm:"column:delete_time" sql:"delete_time"`
|
||||
Version int32 `json:"version" gorm:"column:version" sql:"version"`
|
||||
IsPublic int32 `json:"is_public" gorm:"column:is_public" sql:"is_public"`
|
||||
Deleted int32 `json:"deleted" gorm:"column:deleted" sql:"deleted"`
|
||||
OriginUrl string `json:"origin_url" gorm:"column:origin_url" sql:"origin_url"`
|
||||
}
|
||||
|
||||
type DocGroup struct {
|
||||
|
Loading…
Reference in New Issue
Block a user