mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
移除可以与同一用户创建多个会话的特性
This commit is contained in:
1 parent
d04628148f
commit
3c5fdb9032
16 files changed
+120
-118
No files matched your search
+4
-3
@@ -96,9 +96,10 @@ async function changePassword(uid, currentPassword, newPassword) {
|
||||
});
|
||||
}
|
||||
|
||||
async function inc(_id, field, n) {
|
||||
await coll.findOneAndUpdate({ _id }, { $inc: { [field]: n } });
|
||||
const udoc = await getById(_id);
|
||||
async function inc(_id, field, n = 1) {
|
||||
const udoc = await coll.findOne({ _id });
|
||||
udoc[field] = udoc[field] + n || n;
|
||||
await coll.updateOne({ _id }, { $set: { [field]: udoc[field] } });
|
||||
return udoc;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user