diff --git a/app/service/TrashService.go b/app/service/TrashService.go index e5ef218..7f2f6f5 100644 --- a/app/service/TrashService.go +++ b/app/service/TrashService.go @@ -85,6 +85,9 @@ func (this *TrashService) DeleteTrash(noteId, userId string) bool { // delete content ok = db.DeleteByIdAndUserId(db.NoteContents, noteId, userId) + // 删除content history + ok = db.DeleteByIdAndUserId(db.NoteContentHistories, noteId, userId) + // 重新统计tag's count // TODO 这里会改变tag's Usn tagService.reCountTagCount(userId, note.Tags) @@ -115,6 +118,13 @@ func (this *TrashService) DeleteTrashApi(noteId, userId string, usn int) (bool, // delete content ok = db.DeleteByIdAndUserId(db.NoteContents, noteId, userId) + // 删除content history + ok = db.DeleteByIdAndUserId(db.NoteContentHistories, noteId, userId) + + // 一个BUG, iOS删除直接调用这个API, 结果没有重新recount + // recount notebooks' notes number + notebookService.ReCountNotebookNumberNotes(note.NotebookId.Hex()) + return ok, "", afterUsn }