mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
module.add(user,problem,record)
This commit is contained in:
commit
d5b1f623f8
43 files changed
+5965
No files matched your search
@@ -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 })
|
||||
};
|
||||
Reference in new issue
Block a user