Jump to 0.3.1

This commit is contained in:
Wu Cheng-Han 2015-07-02 00:10:20 +08:00
parent f7f8c901f4
commit 10c9811fc5
49 changed files with 2336 additions and 448 deletions

View file

@ -4,6 +4,7 @@ var mongoose = require('mongoose');
//core
var config = require("../config.js");
var logger = require("./logger.js");
// create a temp model
var model = mongoose.model('temp', {
@ -33,13 +34,13 @@ function findTemp(id, callback) {
id: id
}, function (err, temp) {
if (err) {
console.log('find temp failed: ' + err);
logger.error('find temp failed: ' + err);
callback(err, null);
}
if (!err && temp) {
callback(null, temp);
} else {
console.log('find temp failed: ' + err);
logger.error('find temp failed: ' + err);
callback(err, null);
};
});
@ -53,10 +54,10 @@ function newTemp(id, data, callback) {
});
temp.save(function (err) {
if (err) {
console.log('new temp failed: ' + err);
logger.error('new temp failed: ' + err);
callback(err, null);
} else {
console.log("new temp success: " + temp.id);
logger.info("new temp success: " + temp.id);
callback(null, temp);
};
});
@ -67,14 +68,14 @@ function removeTemp(id, callback) {
if(!err && temp) {
temp.remove(function(err) {
if(err) {
console.log('remove temp failed: ' + err);
logger.error('remove temp failed: ' + err);
callback(err, null);
} else {
callback(null, null);
}
});
} else {
console.log('remove temp failed: ' + err);
logger.error('remove temp failed: ' + err);
callback(err, null);
}
});