Merge branch 'bugfix' of http://git.legu.cc/qixin/HJ_Server into bugfix
This commit is contained in:
commit
58ff276e10
@ -1,39 +1,32 @@
|
|||||||
import { ApiCall } from "tsrpc";
|
import {ApiCall} from "tsrpc";
|
||||||
import { ReqRank, ResRank } from "../../cross/protocols/wzry/PtlRank";
|
import {ReqRank, ResRank} from "../../cross/protocols/wzry/PtlRank";
|
||||||
import { ChatFun } from "../../public/chat";
|
import {player} from "../../shared/protocols/user/type";
|
||||||
import { EmailFun } from "../../public/email";
|
import {FindOptions} from "mongodb";
|
||||||
import { FightFun } from "../../public/fight";
|
|
||||||
import { Rank } from '../../public/rank/rank';
|
|
||||||
import { SchedulerWzryDlDstart, wzrygroup } from "../../public/scheduler/scheduler_wzry";
|
|
||||||
import { WangZheRongYaofun } from "../../public/wzry";
|
|
||||||
import { PublicShared } from "../../shared/public/public";
|
|
||||||
import { player } from "../../shared/protocols/user/type";
|
|
||||||
import { rankInfo } from "../../shared/protocols/type";
|
|
||||||
import { FindOptions } from "mongodb";
|
|
||||||
|
|
||||||
export async function getRankList(limit?: number, projection?:any){
|
export async function getRankList(limit?: number, projection?: any) {
|
||||||
let option : FindOptions = {
|
let option: FindOptions = {
|
||||||
sort : {
|
sort: {
|
||||||
'data.valArr': -1
|
'data.valArr': -1,
|
||||||
|
'data.player.power': -1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(limit!=null){
|
if (limit != null) {
|
||||||
option.limit = limit;
|
option.limit = limit;
|
||||||
}
|
}
|
||||||
if(projection!=null){
|
if (projection != null) {
|
||||||
option.projection = projection;
|
option.projection = projection;
|
||||||
}
|
}
|
||||||
|
|
||||||
let listArr = await G.mongodb.collection('rankList').find({ type: 'wzryCross' },option).toArray();
|
let listArr = await G.mongodb.collection('rankList').find({type: 'wzryCross'}, option).toArray();
|
||||||
let list = listArr.map(l => l.data);
|
let list = listArr.map(l => l.data);
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getPlayerRank(uid: string) {
|
export async function getPlayerRank(uid: string) {
|
||||||
let _r = await getRankList(50,{
|
let _r = await getRankList(50, {
|
||||||
"data.player.uid":1,
|
"data.player.uid": 1,
|
||||||
"data.valArr":1,
|
"data.valArr": 1,
|
||||||
});
|
});
|
||||||
if (!Object.keys(_r).length) {
|
if (!Object.keys(_r).length) {
|
||||||
return -1
|
return -1
|
||||||
@ -42,14 +35,14 @@ export async function getPlayerRank(uid: string) {
|
|||||||
return myrank;
|
return myrank;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getWzryRankList(uid: string, gud: player){
|
export async function getWzryRankList(uid: string, gud: player) {
|
||||||
let list = await getRankList(50);
|
let list = await getRankList(50);
|
||||||
return {
|
return {
|
||||||
rankList: list,
|
rankList: list,
|
||||||
myRank: {
|
myRank: {
|
||||||
rank: list.findIndex(li => li.player.uid == uid) + 1 || -1,
|
rank: list.findIndex(li => li.player.uid == uid) + 1 || -1,
|
||||||
player: gud,
|
player: gud,
|
||||||
valArr: [(await G.mongodb.collection('wzry_fight').findOne({ uid: uid }))?.jifen || 0]
|
valArr: [(await G.mongodb.collection('wzry_fight').findOne({uid: uid}))?.jifen || 0]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -22,12 +22,15 @@ export class CrossEmailPull extends Scheduler {
|
|||||||
G.clientCross.callApi("email/GetCrossEmail", {server_id: G.config.serverId + ""}).then((res) => {
|
G.clientCross.callApi("email/GetCrossEmail", {server_id: G.config.serverId + ""}).then((res) => {
|
||||||
if(!res.isSucc)return;
|
if(!res.isSucc)return;
|
||||||
res.res.emails.forEach(async (email) => {
|
res.res.emails.forEach(async (email) => {
|
||||||
|
let _prize = email?.prizeData?.prize || [];
|
||||||
|
if (email?.prizeData) delete email.prizeData;
|
||||||
|
|
||||||
|
email["prize"] = _prize;
|
||||||
if (email.uid != "system") {
|
if (email.uid != "system") {
|
||||||
await EmailFun.addEmail(email)
|
await EmailFun.addEmail(email)
|
||||||
} else {
|
} else {
|
||||||
await EmailFun.addQuanFuEmail(email)
|
await EmailFun.addQuanFuEmail(email)
|
||||||
}
|
}
|
||||||
await EmailFun.addEmail(email)
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
await this.ctorStartTime()
|
await this.ctorStartTime()
|
||||||
|
@ -630,25 +630,25 @@ export class _mongodb {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//@ts-ignore
|
// //@ts-ignore
|
||||||
FindCursor.prototype._toArray = FindCursor.prototype.toArray;
|
// FindCursor.prototype._toArray = FindCursor.prototype.toArray;
|
||||||
//@ts-ignore
|
// //@ts-ignore
|
||||||
FindCursor.prototype.toArray = async function(){
|
// FindCursor.prototype.toArray = async function(){
|
||||||
let rss = await this._toArray();
|
// let rss = await this._toArray();
|
||||||
|
//
|
||||||
//如果返回的数据超过50条
|
// //如果返回的数据超过50条
|
||||||
if(rss.length>50){
|
// if(rss.length>50){
|
||||||
addGameLog("system","findCount",null,{
|
// addGameLog("system","findCount",null,{
|
||||||
collection: this.namespace.collection,
|
// collection: this.namespace.collection,
|
||||||
db:this.namespace.db,
|
// db:this.namespace.db,
|
||||||
count:rss.length
|
// count:rss.length
|
||||||
})
|
// })
|
||||||
console.log("system,findCount",{
|
// console.log("system,findCount",{
|
||||||
collection: this.namespace.collection,
|
// collection: this.namespace.collection,
|
||||||
db:this.namespace.db,
|
// db:this.namespace.db,
|
||||||
count:rss.length
|
// count:rss.length
|
||||||
})
|
// })
|
||||||
console.trace();
|
// console.trace();
|
||||||
}
|
// }
|
||||||
return rss;
|
// return rss;
|
||||||
}
|
// }
|
Loading…
Reference in New Issue
Block a user