From a60da3d592998d66ea3f9f29d5ba8802faf3e205 Mon Sep 17 00:00:00 2001 From: lealife Date: Thu, 17 Sep 2015 17:14:57 +0800 Subject: [PATCH] =?UTF-8?q?1.0=20=E7=89=88=E5=9C=A8=E7=BD=91=E9=A1=B5?= =?UTF-8?q?=E7=AB=AF=E5=88=A0=E9=99=A4=E7=AC=94=E8=AE=B0=E6=9C=AC=E5=87=BA?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/leanote/leanote/issues/207 --- app/service/NotebookService.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/service/NotebookService.go b/app/service/NotebookService.go index a94de3f..dad005d 100644 --- a/app/service/NotebookService.go +++ b/app/service/NotebookService.go @@ -275,11 +275,15 @@ func (this *NotebookService) ToBlog(userId, notebookId string, isBlog bool) (boo // 查看是否有子notebook // 先查看该notebookId下是否有notes, 没有则删除 func (this *NotebookService) DeleteNotebook(userId, notebookId string) (bool, string) { - if db.Count(db.Notebooks, bson.M{"ParentNotebookId": bson.ObjectIdHex(notebookId), - "UserId": bson.ObjectIdHex(userId)}) == 0 { // 无 + if db.Count(db.Notebooks, bson.M{ + "ParentNotebookId": bson.ObjectIdHex(notebookId), + "UserId": bson.ObjectIdHex(userId), + "IsDeleted": false, + }) == 0 { // 无 if db.Count(db.Notes, bson.M{"NotebookId": bson.ObjectIdHex(notebookId), "UserId": bson.ObjectIdHex(userId), - "IsTrash": false}) == 0 { // 不包含trash + "IsTrash": false, + "IsDeleted": false}) == 0 { // 不包含trash // 不是真删除 1/20, 为了同步笔记本 ok := db.UpdateByQMap(db.Notebooks, bson.M{"_id": bson.ObjectIdHex(notebookId)}, bson.M{"IsDeleted": true, "Usn": userService.IncrUsn(userId)}) return ok, ""