mirror of
https://github.com/leanote/desktop-app.git
synced 2025-10-16 16:04:56 +00:00
本地发送note带图片 ok
下一步, 修改笔记带图片
This commit is contained in:
32
node_modules/api.js
generated
vendored
32
node_modules/api.js
generated
vendored
@@ -350,35 +350,36 @@ var Api = {
|
||||
// note.NotebookId是本的, 要得到远程的
|
||||
Notebook.getServerNotebookIdByNotebookId(note.NotebookId, function(serverNotebookId) {
|
||||
var data = {
|
||||
title: note.Title,
|
||||
notebookId: serverNotebookId,
|
||||
content: note.Content,
|
||||
isMarkdown: note.isMarkdown,
|
||||
tags: note.Tags,
|
||||
isBlog: note.IsBlog,
|
||||
Title: note.Title,
|
||||
NotebookId: serverNotebookId,
|
||||
Content: note.Content,
|
||||
IsMarkdown: note.isMarkdown,
|
||||
Tags: note.Tags,
|
||||
IsBlog: note.IsBlog,
|
||||
}
|
||||
log('add note');
|
||||
log(data);
|
||||
// log(data);
|
||||
|
||||
// files处理
|
||||
var files = note.Files;
|
||||
var needTransferFiles = [];
|
||||
var needPostFilesAttr = [];
|
||||
async.eachSeries(files, function(file, cb) {
|
||||
var file = files[i];
|
||||
// var file = files[i];
|
||||
var needFile = {
|
||||
fileId: file.ServerFileId,
|
||||
localFileId: file.FileId,
|
||||
hasBody: false
|
||||
FileId: file.ServerFileId,
|
||||
LocalFileId: file.FileId,
|
||||
HasBody: false
|
||||
}
|
||||
// console.log(file);
|
||||
// 要传数据的
|
||||
if(file.IsDirty) {
|
||||
ifs.exists(file.Path, function(isExists) {
|
||||
needTransferFiles[file.ServerFileId] = {
|
||||
fs.exists(file.Path, function(isExists) {
|
||||
needTransferFiles[file.FileId] = {
|
||||
file: file.Path,
|
||||
content_type: 'image/' + file.Type
|
||||
}
|
||||
needFile.hasBody = true;
|
||||
needFile.HasBody = true;
|
||||
needPostFilesAttr.push(needFile);
|
||||
return cb();
|
||||
});
|
||||
@@ -387,7 +388,7 @@ var Api = {
|
||||
return cb();
|
||||
}
|
||||
}, function() {
|
||||
data.files = needPostFilesAttr;
|
||||
data.Files = needPostFilesAttr;
|
||||
var needMultiple = false;
|
||||
for(var i in needTransferFiles) {
|
||||
needMultiple = true;
|
||||
@@ -405,6 +406,7 @@ var Api = {
|
||||
log('add note ret');
|
||||
log(ret);
|
||||
if(Common.isOk(ret)) {
|
||||
// 将serverId保存
|
||||
callback(ret);
|
||||
} else {
|
||||
callback(false);
|
||||
|
Reference in New Issue
Block a user