module.add(user,problem,record)

This commit is contained in:
masnn committed 2020-04-01 18:13:04 +08:00
commit d5b1f623f8
43 files changed
+5965

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
const
db = require('../service/db.js'),
coll = db.collection('blacklist');
module.exports = {
add(ip) {
let expireAt = new Date(new Date().getTime() + 365 * 24 * 60 * 60 * 1000);
return coll.findOneAndUpdate({ _id: ip }, { $set: { expireAt } }, { upsert: true });
},
get: ip => coll.findOne({ _id: ip }),
delete: ip => coll.deleteOne({ _id: ip })
};