no message
parent
5b9ec97933
commit
cb2534a3cd
|
@ -161,7 +161,7 @@ func GetArticle(c *gin.Context) {
|
||||||
func UpdateArtilce(c *gin.Context) {
|
func UpdateArtilce(c *gin.Context) {
|
||||||
rsp := RespBase{Msg: "FAIL", Status: 210}
|
rsp := RespBase{Msg: "FAIL", Status: 210}
|
||||||
type ReqUpdateArticle struct {
|
type ReqUpdateArticle struct {
|
||||||
Id int64 `json:"id"`
|
ID int64 `json:"id"`
|
||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
Content string `json:"content"`
|
Content string `json:"content"`
|
||||||
author string `json:"author"`
|
author string `json:"author"`
|
||||||
|
@ -173,7 +173,7 @@ func UpdateArtilce(c *gin.Context) {
|
||||||
c.JSON(200, rsp)
|
c.JSON(200, rsp)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
query := fmt.Sprintf("select * from doc where doc.id = '%d'", id)
|
query := fmt.Sprintf("select * from doc where doc.id = '%d'", req.ID)
|
||||||
docs := []model.Doc{}
|
docs := []model.Doc{}
|
||||||
e := db.GetMysqlClient().Query2(query, &docs)
|
e := db.GetMysqlClient().Query2(query, &docs)
|
||||||
if nil != e {
|
if nil != e {
|
||||||
|
@ -200,7 +200,7 @@ func UpdateArtilce(c *gin.Context) {
|
||||||
Title: req.Title,
|
Title: req.Title,
|
||||||
Content: req.Content,
|
Content: req.Content,
|
||||||
Author: req.author,
|
Author: req.author,
|
||||||
ID: req.Id,
|
ID: req.ID,
|
||||||
IsPublic: int32(req.IsPublic),
|
IsPublic: int32(req.IsPublic),
|
||||||
Version: (docs[0].Version + 1),
|
Version: (docs[0].Version + 1),
|
||||||
},
|
},
|
||||||
|
@ -244,11 +244,11 @@ func AddArticle(c *gin.Context) {
|
||||||
}
|
}
|
||||||
e := model.CreateDoc(
|
e := model.CreateDoc(
|
||||||
model.Doc{
|
model.Doc{
|
||||||
Type: req.Type,
|
Type: int32(req.Type),
|
||||||
Title: req.Title,
|
Title: req.Title,
|
||||||
Content: req.Content,
|
Content: req.Content,
|
||||||
Author: req.Author,
|
Author: req.Author,
|
||||||
IsPublic: req.Ispublic,
|
IsPublic: int32(req.Ispublic),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
if nil != e {
|
if nil != e {
|
||||||
|
|
Loading…
Reference in New Issue