Compare commits
5 Commits
63877a2664
...
ad9e3cca46
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ad9e3cca46 | ||
![]() |
cedce860c5 | ||
![]() |
cc6aad7223 | ||
![]() |
566c3aeb7b | ||
![]() |
8a69a4fc1e |
@ -240,7 +240,7 @@ export function ctor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Array.prototype.random = function (this: Array<any>) {
|
Array.prototype.random = function (this: Array<any>) {
|
||||||
return this[PublicShared.randomNum(0, this.length)];
|
return this[PublicShared.randomNum(0, this.length - 1)];
|
||||||
};
|
};
|
||||||
|
|
||||||
Array.prototype.intersection = function (this: Array<any>, other: Array<any>) {
|
Array.prototype.intersection = function (this: Array<any>, other: Array<any>) {
|
||||||
|
@ -250,6 +250,33 @@ export abstract class Rank {
|
|||||||
let res = await this.db.find({ idKey: { $in: uids }, type: this.getType() }).toArray()
|
let res = await this.db.find({ idKey: { $in: uids }, type: this.getType() }).toArray()
|
||||||
|
|
||||||
switch (this.getType()) {
|
switch (this.getType()) {
|
||||||
|
case "slzd1":
|
||||||
|
case "slzd2":
|
||||||
|
case "slzd3":
|
||||||
|
case "slzd4":
|
||||||
|
case "slzd5":
|
||||||
|
case "slzd6":
|
||||||
|
let ghid = [];
|
||||||
|
res = res.map(item => {
|
||||||
|
if (!item.data?.player?.ghid || item.data.utime + 60 < G.time) {
|
||||||
|
ghid.push(G.mongodb.conversionId(item.idKey));
|
||||||
|
}
|
||||||
|
return item;
|
||||||
|
})
|
||||||
|
if(ghid.length > 0){
|
||||||
|
let ghinfo = await G.mongodb.collection("gonghui").find(
|
||||||
|
{ _id: { $in: ghid } }, { projection: { name: 1 } }
|
||||||
|
).toArray();
|
||||||
|
ghinfo.forEach(item => {
|
||||||
|
let index = res.findIndex(x => x.idKey == item._id.toHexString());
|
||||||
|
res[index].data.player = {
|
||||||
|
ghName: item.name,
|
||||||
|
ghId: item._id.toHexString(),
|
||||||
|
};
|
||||||
|
this.db.updateOne({ idKey: item._id.toHexString(), type: this.getType() }, { $set: { "data.player": res[index].data.player } });
|
||||||
|
})
|
||||||
|
}
|
||||||
|
break;
|
||||||
default: // 排行数据更新逻辑 默认更新playerInfo
|
default: // 排行数据更新逻辑 默认更新playerInfo
|
||||||
let updateUids = [];
|
let updateUids = [];
|
||||||
res = res.map(item => {
|
res = res.map(item => {
|
||||||
@ -271,7 +298,7 @@ export abstract class Rank {
|
|||||||
this.db.updateOne({ idKey: item.uid, type: this.getType() }, { $set: { "data.player": item } });
|
this.db.updateOne({ idKey: item.uid, type: this.getType() }, { $set: { "data.player": item } });
|
||||||
|
|
||||||
// 跟新redis score
|
// 跟新redis score
|
||||||
this.setRankData(item.uid, res[index].data as any);
|
// this.setRankData(item.uid, res[index].data as any);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user