blog, tags, archives

This commit is contained in:
life
2014-11-10 23:56:15 +08:00
parent 6555384e5c
commit d979a0c3e2
11 changed files with 233 additions and 125 deletions

View File

@ -294,6 +294,27 @@ func (this *NoteService) UpdateTags(noteId string, userId string, tags []string)
return db.UpdateByIdAndUserIdField(db.Notes, noteId, userId, "Tags", tags)
}
func (this *NoteService) ToBlog(userId, noteId string, isBlog, isTop bool) bool {
noteUpdate := bson.M{}
if isTop {
isBlog = true
}
if !isBlog {
isTop = false
}
noteUpdate["IsBlog"] = isBlog
noteUpdate["IsTop"] = isTop
if isBlog {
noteUpdate["PublicTime"] = time.Now()
}
ok := db.UpdateByIdAndUserIdMap(db.Notes, noteId, userId, noteUpdate)
// 重新计算tags
go (func() {
blogService.ReCountBlogTags(userId)
})()
return ok
}
// 移动note
// trash, 正常的都可以用
// 1. 要检查下notebookId是否是自己的