Commit 4b4d92f4 authored by 刘松's avatar 刘松

fix date

parent c2442c60
......@@ -260,7 +260,7 @@ async function updateBill(data, callback) {
if(!/^[0-9a-z]{24}$/.test(accountID) ) return callback('参数错误');
db
.collection('bills')
.insert(wrapTime({ pre, number, accountID: OID(accountID), type, taskID: OID(taskID) }), (err, rep) => {
.insert(wrapTime({ pre, number, accountID: OID(accountID), type, taskID: OID(taskID) },true), (err, rep) => {
if (err) return callback(err);
callback && callback(null, rep);
});
......@@ -346,8 +346,12 @@ function OID(str) {
return typeof str === 'string' ? mongodb.ObjectID(str) : str;
}
function wrapTime(obj) {
return _.merge(obj, { createdAt: new Date() })
function wrapTime(obj, date) {
let d = { createdAt: new Date() };
if(date) {
d.date = moment().format('YYYYMMDD');
}
return _.merge(obj,d )
}
async function getFromID(accountID) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment