mirror of
https://github.com/eiblog/eiblog.git
synced 2026-02-07 23:32:27 +08:00
add update time
This commit is contained in:
4
api.go
4
api.go
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user