From 215549e5ea562ca1a41af8a044c446fdc81482ed Mon Sep 17 00:00:00 2001 From: life Date: Mon, 3 Dec 2018 13:27:00 +0800 Subject: [PATCH] sync fixed --- node_modules/api.js | 2 +- node_modules/note.js | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/node_modules/api.js b/node_modules/api.js index e3f64916..40e7fc23 100644 --- a/node_modules/api.js +++ b/node_modules/api.js @@ -234,7 +234,7 @@ var Api = { if(Common.isOk(ret)) { // {Content: 'xx', NoteId: 'xxx'} callback && callback(ret); } else { - callback && callback(false); + callback && callback(false, ret); } }); }, diff --git a/node_modules/note.js b/node_modules/note.js index 0ab83d5d..6414eba3 100644 --- a/node_modules/note.js +++ b/node_modules/note.js @@ -670,8 +670,8 @@ var Note = { me.inSyncTimes[noteId] = 0 } me.inSyncTimes[noteId]++; - if(me.inSyncTimes[noteId] > 5) { - callback && callback(false); + if(me.inSyncTimes[noteId] >= 5) { + return callback && callback(false); } me.getNote(noteId, function(note) { @@ -700,12 +700,11 @@ var Note = { return callback && callback(false); } - Api.getNoteContent(serverNoteId, function(noteContent) { + Api.getNoteContent(serverNoteId, function(noteContent, ret) { me.inSyncContent[noteId] = false; // 同步到本地 if(Common.isOk(noteContent)) { - me.updateNoteContentForce(noteId, noteContent.Content, function(content) { noteContent.Content = content; noteContent.NoteId = noteId; @@ -714,12 +713,12 @@ var Note = { } else { // 没有登录或者需要升级 try { - if (noteContent.Ok === false) { // {"Ok":false,"Msg":"NOTLOGIN"} - return callback(false) + if (ret.Ok === false) { // {"Ok":false,"Msg":"NOTLOGIN"} + console.error(ret) + return callback && callback(false) } } catch(e) { } - console.error(noteId + ' api.getNoteContent error'); // 这里, 可能太多的要同步了