send changes tag ok

This commit is contained in:
life
2015-02-07 00:59:06 +08:00
parent 68c668514b
commit 8b329de3bb
3 changed files with 106 additions and 4 deletions

24
node_modules/tag.js generated vendored
View File

@@ -84,14 +84,34 @@ var Tag = {
},
getTag: function(title, callback) {
userId = User.getCurActiveUserId();
var userId = User.getCurActiveUserId();
Tags.findOne({UserId: userId, Tag: title}, function(err, tag) {
if(err || !tag) {
return callback && callback(false);
}
callback && callback(tag);
});
}
},
// 服务器上更新过来, 已经存在了
setNotDirty: function(title) {
var me = this;
var userId = User.getCurActiveUserId();
Tags.update({UserId: userId, Title: title}, {$set: {IsDirty: false, UpdatedTime: new Date()}}, function() {
});
},
// send changes to server
getDirtyTags: function(callback) {
var me = this;
userId = User.getCurActiveUserId();
Tags.find({UserId: userId, IsDirty: true}, function(err, tags) {
if(err || !tags) {
return callback && callback(false);
}
callback && callback(tags);
});
},
/*
// 添加多个标签
addTags: function(titles) {