recount tags
This commit is contained in:
@ -438,11 +438,7 @@ func (this *NoteService) UpdateNote(updatedUserId, noteId string, needUpdate bso
|
||||
afterUsn := userService.IncrUsn(userId)
|
||||
needUpdate["Usn"] = afterUsn
|
||||
|
||||
// 添加tag2
|
||||
// TODO 这个tag去掉, 添加tag另外添加, 不要这个
|
||||
if tags, ok := needUpdate["Tags"]; ok {
|
||||
tagService.AddTagsI(userId, tags)
|
||||
}
|
||||
needRecountTags := false
|
||||
|
||||
// 是否修改了isBlog
|
||||
// 也要修改noteContents的IsBlog
|
||||
@ -456,10 +452,18 @@ func (this *NoteService) UpdateNote(updatedUserId, noteId string, needUpdate bso
|
||||
needUpdate["PublicTime"] = needUpdate["UpdatedTime"]
|
||||
}
|
||||
|
||||
// 重新计算tags
|
||||
go (func() {
|
||||
blogService.ReCountBlogTags(userId)
|
||||
})()
|
||||
needRecountTags = true
|
||||
}
|
||||
}
|
||||
|
||||
// 添加tag2
|
||||
// TODO 这个tag去掉, 添加tag另外添加, 不要这个
|
||||
if tags, ok := needUpdate["Tags"]; ok {
|
||||
tagService.AddTagsI(userId, tags)
|
||||
|
||||
// 如果是博客, 标签改了, 那么重新计算
|
||||
if note.IsBlog {
|
||||
needRecountTags = true
|
||||
}
|
||||
}
|
||||
|
||||
@ -468,6 +472,13 @@ func (this *NoteService) UpdateNote(updatedUserId, noteId string, needUpdate bso
|
||||
return ok, "", 0
|
||||
}
|
||||
|
||||
if needRecountTags {
|
||||
// 重新计算tags
|
||||
go (func() {
|
||||
blogService.ReCountBlogTags(userId)
|
||||
})()
|
||||
}
|
||||
|
||||
// 重新获取之
|
||||
note = this.GetNoteById(noteId)
|
||||
|
||||
|
Reference in New Issue
Block a user