Merge branch 'fix/conglinshoulie' into dev
# Conflicts: # src/public/rank/rank.ts
This commit is contained in:
commit
a69ca2312a
@ -257,13 +257,7 @@ export abstract class Rank {
|
|||||||
if (uids && uids.length > 0) {
|
if (uids && uids.length > 0) {
|
||||||
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()) {
|
if (this.type.indexOf("slzd") != -1) {
|
||||||
case "slzd1":
|
|
||||||
case "slzd2":
|
|
||||||
case "slzd3":
|
|
||||||
case "slzd4":
|
|
||||||
case "slzd5":
|
|
||||||
case "slzd6":
|
|
||||||
let ghid = [];
|
let ghid = [];
|
||||||
res = res.map(item => {
|
res = res.map(item => {
|
||||||
if (!item.data?.player?.ghid || item.data.utime + 60 < G.time) {
|
if (!item.data?.player?.ghid || item.data.utime + 60 < G.time) {
|
||||||
@ -284,8 +278,9 @@ export abstract class Rank {
|
|||||||
this.db.updateOne({ idKey: item._id.toHexString(), type: this.getType() }, { $set: { "data.player": res[index].data.player } });
|
this.db.updateOne({ idKey: item._id.toHexString(), type: this.getType() }, { $set: { "data.player": res[index].data.player } });
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
break;
|
} else if (this.type.indexOf('clslCross') != -1) {
|
||||||
default: // 排行数据更新逻辑 默认更新playerInfo
|
// 丛林猎手 跨服排行榜 不需要更新
|
||||||
|
} else {
|
||||||
let updateUids = [];
|
let updateUids = [];
|
||||||
res = res.map(item => {
|
res = res.map(item => {
|
||||||
// 没有player 或者 player 过期
|
// 没有player 或者 player 过期
|
||||||
@ -294,6 +289,7 @@ export abstract class Rank {
|
|||||||
}
|
}
|
||||||
return item;
|
return item;
|
||||||
});
|
});
|
||||||
|
|
||||||
let newUserArr = await G.mongodb.collection('user').find(
|
let newUserArr = await G.mongodb.collection('user').find(
|
||||||
{ uid: { $in: updateUids } }, { projection: { _id: 0 } }
|
{ uid: { $in: updateUids } }, { projection: { _id: 0 } }
|
||||||
).toArray();
|
).toArray();
|
||||||
@ -311,7 +307,7 @@ export abstract class Rank {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 按照redis uids 排序顺序排序
|
// 按照redis uids 排序顺序排序
|
||||||
return res.sort((a,b)=>uids.indexOf(a.idKey)-uids.indexOf(b.idKey)).map(ele => ele.data);
|
return res.sort((a, b) => uids.indexOf(a.idKey) - uids.indexOf(b.idKey)).map(ele => ele.data);
|
||||||
}
|
}
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,11 @@ export class RankClslCross extends Rank {
|
|||||||
return Number(val)
|
return Number(val)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getRankData(uid: string) {
|
||||||
|
let data: rankInfo;
|
||||||
|
return (await this.db.findOne({ "idKey": uid, "type": this.getType() })).data
|
||||||
|
}
|
||||||
|
|
||||||
async addNew(info: rankInfo) {
|
async addNew(info: rankInfo) {
|
||||||
// 积分大于配置的最小参数,更新数据
|
// 积分大于配置的最小参数,更新数据
|
||||||
if (info.valArr[0] >= this.minStar) {
|
if (info.valArr[0] >= this.minStar) {
|
||||||
|
@ -406,7 +406,15 @@ const crossIndexs: Partial<{ [k in keyof MongodbCollections]: IndexDescription[]
|
|||||||
],
|
],
|
||||||
clslCrossUser: [
|
clslCrossUser: [
|
||||||
{
|
{
|
||||||
key: {uid: 1}, unique: true
|
key: { uid: 1 },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: { ttltime: 1 }, expireAfterSeconds: 7 * 24 * 3600
|
||||||
|
}
|
||||||
|
],
|
||||||
|
clslCrossGroup: [
|
||||||
|
{
|
||||||
|
key: { week: 1 },
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
rankList: [
|
rankList: [
|
||||||
|
@ -13,7 +13,7 @@ export type ResOpen = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export type rankType = 'jjc' | 'tanxian' | 'zhanli' | 'qjzzd' | 'hbzbLocal' | 'hbzbCross' | 'hbzbZbsCross'
|
export type rankType = 'jjc' | 'tanxian' | 'zhanli' | 'qjzzd' | 'hbzbLocal' | 'hbzbCross' | 'hbzbZbsCross'
|
||||||
| 'slzd1' | 'slzd2' | 'slzd3' | 'slzd4' | 'slzd5' | 'slzd6' | 'clslCross'
|
| 'slzd1' | 'slzd2' | 'slzd3' | 'slzd4' | 'slzd5' | 'slzd6' | "clslCross"
|
||||||
| 'kbzz' | 'xszm' | 'zccg' | 'gbzl' | 'tujian' | 'wzryCross';
|
| 'kbzz' | 'xszm' | 'zccg' | 'gbzl' | 'tujian' | 'wzryCross';
|
||||||
|
|
||||||
export type rankTypeObj = {
|
export type rankTypeObj = {
|
||||||
|
Loading…
Reference in New Issue
Block a user