Compare commits
2 Commits
d71ecf13f9
...
b9be0901fa
Author | SHA1 | Date | |
---|---|---|---|
![]() |
b9be0901fa | ||
![]() |
ecc116bfa1 |
@ -34,7 +34,7 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
|
||||
|
||||
let users = await G.crossmongodb.collection('huodong_user').find({uid: {$in: rankList.map(i => i._id).filter(i => i._id != 'system')}}).toArray()
|
||||
|
||||
rankList = rankList.map(i => ({...i, player: users.find(v => v.uid == i._id) || {}}))
|
||||
rankList = rankList.map(i => ({...i, player: users.find(v => v.uid == i.uid) || {}}))
|
||||
|
||||
// 活动结束前半小时,缓存过期时间改为10秒
|
||||
let exTime = (G.time + 1800) > _hd.etime ? 10 : 60
|
||||
@ -57,7 +57,7 @@ export function sortRankList(rank, list) {
|
||||
rank.map(i => {
|
||||
for (let k = i.rank[0] - 1; k < i.rank[1]; k++) {
|
||||
if (list[k]?.total >= i.need[0].n) {
|
||||
rankList.push({...list[k - ccc], rank: k})
|
||||
rankList.push({...list[k - ccc], rank: k, _id: list[k - ccc].uid})
|
||||
} else {
|
||||
rankList.push({_id: 'system', total: i.need[0].n, rank: k, player: {}})
|
||||
ccc += 1
|
||||
@ -75,11 +75,11 @@ async function getMyData(call, rankList) {
|
||||
let myCut: any = await G.crossmongodb.collection('rmbuse').findOne({uid: call.uid})
|
||||
|
||||
let myUser = await G.mongodb.collection('user').findOne({uid: call.uid})
|
||||
G.crossmongodb.collection('huodong_user').updateOne({uid: call.uid}, myUser, {upsert: true})
|
||||
G.crossmongodb.collection('huodong_user').updateOne({uid: call.uid}, {$set: myUser}, {upsert: true})
|
||||
|
||||
if (!myCut) {
|
||||
myCut = {_id: myUser.uid, total: 0}
|
||||
}
|
||||
|
||||
return {player: myUser, ...myCut, total: R.negate(myCut.total), rank: -1}
|
||||
return {player: myUser, ...myCut, total: R.negate(myCut.total), rank: -1, _id: myUser.uid}
|
||||
}
|
@ -227,7 +227,7 @@ export class PlayerFun {
|
||||
// 消费竞赛开启时写入跨服数据库
|
||||
if (G.huodong.xfjs && !data.isAdd) {
|
||||
G.crossmongodb.collection('rmbuse').updateOne({uid: data.uid}, {
|
||||
time: G.time,
|
||||
$set: {time: G.time},
|
||||
$inc: {change: data.change}
|
||||
}, {upsert: true});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user