消费竞赛
This commit is contained in:
parent
b578bb0db0
commit
722e92a54b
@ -32,7 +32,7 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
|
|||||||
|
|
||||||
let rankList = sortRankList(_hd.data.rank, list)
|
let rankList = sortRankList(_hd.data.rank, list)
|
||||||
|
|
||||||
let users = await G.crossmongodb.collection('xfjs_user').find({uid: {$in: rankList.map(i => i._id).filter(i => i._id != 'system')}}).toArray()
|
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._id) || {}}))
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ async function getMyData(call, rankList) {
|
|||||||
let myCut: any = await G.crossmongodb.collection('rmbuse').findOne({uid: call.uid})
|
let myCut: any = await G.crossmongodb.collection('rmbuse').findOne({uid: call.uid})
|
||||||
|
|
||||||
let myUser = await G.mongodb.collection('user').findOne({uid: call.uid})
|
let myUser = await G.mongodb.collection('user').findOne({uid: call.uid})
|
||||||
G.crossmongodb.collection('xfjs_user').updateOne({uid: call.uid}, myUser, {upsert: true})
|
G.crossmongodb.collection('huodong_user').updateOne({uid: call.uid}, myUser, {upsert: true})
|
||||||
|
|
||||||
if (!myCut) {
|
if (!myCut) {
|
||||||
myCut = {_id: myUser.uid, total: 0}
|
myCut = {_id: myUser.uid, total: 0}
|
||||||
|
@ -13,6 +13,6 @@ export default async function (call: ApiCall<ReqhdGetList, ReshdGetList>) {
|
|||||||
G.huodong.xfjs = !!_hdList.find(i => i.htype == 11);
|
G.huodong.xfjs = !!_hdList.find(i => i.htype == 11);
|
||||||
if (G.huodong.xfjs) {
|
if (G.huodong.xfjs) {
|
||||||
let myUser = await G.mongodb.collection('user').findOne({uid: call.uid})
|
let myUser = await G.mongodb.collection('user').findOne({uid: call.uid})
|
||||||
G.crossmongodb.collection('xfjs_user').updateOne({uid: call.uid}, myUser, {upsert: true})
|
G.crossmongodb.collection('huodong_user').updateOne({uid: call.uid}, {$set: myUser}, {upsert: true})
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -134,5 +134,5 @@ export type MongodbCollections = {
|
|||||||
shop: CollectionShop
|
shop: CollectionShop
|
||||||
pushgift:CollectionPushGift
|
pushgift:CollectionPushGift
|
||||||
|
|
||||||
xfjs_user: CollectionUser;
|
huodong_user: CollectionUser;
|
||||||
};
|
};
|
@ -438,7 +438,12 @@ const crossIndexs: Partial<{ [k in keyof MongodbCollections]: IndexDescription[]
|
|||||||
{
|
{
|
||||||
key: {zkey: 1}
|
key: {zkey: 1}
|
||||||
},
|
},
|
||||||
]
|
],
|
||||||
|
huodong_user: [
|
||||||
|
{
|
||||||
|
key: {uid: 1}, unique: true,
|
||||||
|
}
|
||||||
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function initMongoDB() {
|
export async function initMongoDB() {
|
||||||
|
Loading…
Reference in New Issue
Block a user