mirror of
https://github.com/leanote/desktop-app.git
synced 2025-10-16 08:01:53 +00:00
添加/修改笔记同步传updatedTime, createdTime
This commit is contained in:
8
node_modules/api.js
generated
vendored
8
node_modules/api.js
generated
vendored
@@ -466,7 +466,7 @@ var Api = {
|
||||
Notebook.getServerNotebookIdByNotebookId(note.NotebookId, function(serverNotebookId) {
|
||||
if(!serverNotebookId) {
|
||||
console.error('No serverNotebookId');
|
||||
console.log(note);
|
||||
// console.log(note);
|
||||
callback && callback(false);
|
||||
return;
|
||||
}
|
||||
@@ -480,6 +480,8 @@ var Api = {
|
||||
IsBlog: note.IsBlog,
|
||||
Files: note.Files,
|
||||
FileDatas: note.FileDatas,
|
||||
CreatedTime: Common.formatDatetime(note.CreatedTime),
|
||||
UpdatedTime: Common.formatDatetime(note.UpdatedTime)
|
||||
}
|
||||
// log('add note');
|
||||
// log(data);
|
||||
@@ -495,7 +497,6 @@ var Api = {
|
||||
console.log('end transfer data');
|
||||
console.log(data);
|
||||
|
||||
|
||||
try {
|
||||
needle.post(me.getUrl('note/addNote'), data,
|
||||
{
|
||||
@@ -542,7 +543,8 @@ var Api = {
|
||||
IsBlog: note.IsBlog, // 是否是博客
|
||||
Files: note.Files,
|
||||
FileDatas: note.FileDatas,
|
||||
Tags: note.Tags, // 新添加
|
||||
Tags: note.Tags, // 新添加,
|
||||
UpdatedTime: Common.formatDatetime(note.UpdatedTime)
|
||||
};
|
||||
|
||||
// 内容不一样才发内容
|
||||
|
28
node_modules/common.js
generated
vendored
28
node_modules/common.js
generated
vendored
@@ -21,6 +21,23 @@ process.on('uncaughtException', function (err) {
|
||||
*/
|
||||
|
||||
function log(o) {console.log(o)}
|
||||
Date.prototype.format = function(fmt) { //author: meizz
|
||||
var o = {
|
||||
"M+" : this.getMonth()+1, //月份
|
||||
"d+" : this.getDate(), //日
|
||||
"h+" : this.getHours(), //小时
|
||||
"m+" : this.getMinutes(), //分
|
||||
"s+" : this.getSeconds(), //秒
|
||||
"q+" : Math.floor((this.getMonth()+3)/3), //季度
|
||||
"S" : this.getMilliseconds() //毫秒
|
||||
};
|
||||
if(/(y+)/.test(fmt))
|
||||
fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));
|
||||
for(var k in o)
|
||||
if(new RegExp("("+ k +")").test(fmt))
|
||||
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));
|
||||
return fmt;
|
||||
}
|
||||
// log("<>>>>>>>>>>>>>>>>>>>>");
|
||||
var Common = {
|
||||
objectId: function() {
|
||||
@@ -187,6 +204,17 @@ var Common = {
|
||||
}
|
||||
},
|
||||
|
||||
formatDatetime: function (t) {
|
||||
if (!t) {
|
||||
t = new Date();
|
||||
}
|
||||
try {
|
||||
return t.format("yyyy-MM-dd hh:mm:ss");
|
||||
} catch(e) {
|
||||
return '';
|
||||
}
|
||||
},
|
||||
|
||||
// 获取文件的json数据
|
||||
getFileJson: function(filepath) {
|
||||
var me = this;
|
||||
|
Reference in New Issue
Block a user