add update time

This commit is contained in:
deepzz0
2016-11-03 20:22:39 +08:00
parent 1715d8543d
commit b12080e40c

4
api.go
View File

@@ -179,6 +179,7 @@ func apiPostAdd(c *gin.Context) {
date := c.PostForm("date")
serie := c.PostForm("serie")
tag := c.PostForm("tags")
update := c.PostForm("update")
if title == "" || text == "" || slug == "" {
err = errors.New("参数错误")
return
@@ -223,6 +224,9 @@ func apiPostAdd(c *gin.Context) {
artc.Count = a.Count
artc.UpdateTime = a.UpdateTime
}
if update != "" {
artc.UpdateTime = time.Now()
}
err = UpdateArticle(bson.M{"id": artc.ID}, artc)
if err != nil {
logd.Error(err)