sync fixed

This commit is contained in:
life
2018-12-03 13:27:00 +08:00
parent d683c69707
commit 215549e5ea
2 changed files with 7 additions and 8 deletions

2
node_modules/api.js generated vendored
View File

@@ -234,7 +234,7 @@ var Api = {
if(Common.isOk(ret)) { // {Content: 'xx', NoteId: 'xxx'} if(Common.isOk(ret)) { // {Content: 'xx', NoteId: 'xxx'}
callback && callback(ret); callback && callback(ret);
} else { } else {
callback && callback(false); callback && callback(false, ret);
} }
}); });
}, },

13
node_modules/note.js generated vendored
View File

@@ -670,8 +670,8 @@ var Note = {
me.inSyncTimes[noteId] = 0 me.inSyncTimes[noteId] = 0
} }
me.inSyncTimes[noteId]++; me.inSyncTimes[noteId]++;
if(me.inSyncTimes[noteId] > 5) { if(me.inSyncTimes[noteId] >= 5) {
callback && callback(false); return callback && callback(false);
} }
me.getNote(noteId, function(note) { me.getNote(noteId, function(note) {
@@ -700,12 +700,11 @@ var Note = {
return callback && callback(false); return callback && callback(false);
} }
Api.getNoteContent(serverNoteId, function(noteContent) { Api.getNoteContent(serverNoteId, function(noteContent, ret) {
me.inSyncContent[noteId] = false; me.inSyncContent[noteId] = false;
// 同步到本地 // 同步到本地
if(Common.isOk(noteContent)) { if(Common.isOk(noteContent)) {
me.updateNoteContentForce(noteId, noteContent.Content, function(content) { me.updateNoteContentForce(noteId, noteContent.Content, function(content) {
noteContent.Content = content; noteContent.Content = content;
noteContent.NoteId = noteId; noteContent.NoteId = noteId;
@@ -714,12 +713,12 @@ var Note = {
} else { } else {
// 没有登录或者需要升级 // 没有登录或者需要升级
try { try {
if (noteContent.Ok === false) { // {"Ok":false,"Msg":"NOTLOGIN"} if (ret.Ok === false) { // {"Ok":false,"Msg":"NOTLOGIN"}
return callback(false) console.error(ret)
return callback && callback(false)
} }
} catch(e) { } catch(e) {
} }
console.error(noteId + ' api.getNoteContent error'); console.error(noteId + ' api.getNoteContent error');
// 这里, 可能太多的要同步了 // 这里, 可能太多的要同步了