From f0521179890de58d43fa253ab4a7d5f48f513a9f Mon Sep 17 00:00:00 2001 From: lealife Date: Sat, 28 Nov 2015 14:22:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=AC=94=E8=AE=B0=E6=97=B6?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=8E=86=E5=8F=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/TrashService.go | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 }