send changes note.update [ok]

This commit is contained in:
life
2015-01-26 23:42:56 +08:00
parent b65a997cc8
commit 218671f53a
5 changed files with 133 additions and 18 deletions

28
node_modules/api.js generated vendored
View File

@@ -322,18 +322,34 @@ var Api = {
//--------
// 获取笔记
// noteId是serverNoteId
getNote: function(noteId, callback) {
needle.get(this.getUrl('note/getNote', {NoteId: noteId}), function(error, response) {
if(error) {
return callback && callback(false);
}
var ret = response.body;
if(Common.isOk(ret)) {
callback && callback(ret);
} else {
log(error);
callback && callback(false);
}
});
},
// 添加
addNote: function(note, callback) {
var me = this;
// note.NotebookId是本的, 要得到远程的
Notebook.getServerNotebookIdByNotebookId(notebook.NotebookId, function(serverNotebookId) {
Notebook.getServerNotebookIdByNotebookId(note.NotebookId, function(serverNotebookId) {
var data = {
title: note.Title,
notebookId: serverNotebookId
notebookId: serverNotebookId,
content: note.Content,
isMarkdown: note.isMarkdown,
Tags: note.Tags,
IsBlog: note.IsBlog
}
log('add note');
log(data);
@@ -342,6 +358,7 @@ var Api = {
return callback(false);
}
var ret = resp.body;
log('add note ret');
log(ret);
if(Common.isOk(ret)) {
callback(ret);
@@ -354,13 +371,14 @@ var Api = {
// 更新
updateNote: function(note, callback) {
var me = this;
Notebook.getServerNotebookIdByNotebookId(notebook.NotebookId, function(serverNotebookId) {
Notebook.getServerNotebookIdByNotebookId(note.NotebookId, function(serverNotebookId) {
var data = {
noteId: note.ServerNoteId,
notebookId: serverNotebookId || "",
title: note.Title,
usn: note.Usn,
isTrash: note.IsTrash
isTrash: note.IsTrash,
content: note.Content
}
log('update note');
log(data);