mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: rating history
This commit is contained in:
1 parent
a532f3d7a6
commit
256ff96c57
8 files changed
+86
-7
No files matched your search
@@ -205,6 +205,12 @@ class DomainModel {
|
||||
return await collUser.updateOne({ domainId, uid }, { $set: params }, { upsert: true });
|
||||
}
|
||||
|
||||
static async updateUserInDomain(domainId: string, uid: number, update: any) {
|
||||
const udoc = await UserModel.getById(domainId, uid);
|
||||
deleteUserCache(udoc);
|
||||
return await collUser.updateOne({ domainId, uid }, update, { upsert: true });
|
||||
}
|
||||
|
||||
@ArgMethod
|
||||
static async incUserInDomain(domainId: string, uid: number, field: string, n: number = 1) {
|
||||
// @ts-ignore
|
||||
|
||||
@@ -150,10 +150,9 @@ async function runInDomain(domainId: string, isSub: boolean, report: Function) {
|
||||
await domain.setMultiUserInDomain(domainId, {}, { rp: 1500 });
|
||||
const tasks = [];
|
||||
for (const uid in udict) {
|
||||
const rp = udict[uid] + (deltaudict[uid] || 0);
|
||||
tasks.push(
|
||||
domain.setUserInDomain(
|
||||
domainId, parseInt(uid, 10), { rp: udict[uid] + (deltaudict[uid] || 0) },
|
||||
),
|
||||
domain.updateUserInDomain(domainId, +uid, { $set: { rp }, $push: { ratingHistory: rp } }),
|
||||
);
|
||||
}
|
||||
await Promise.all(tasks);
|
||||
|
||||
Reference in new issue
Block a user