From 87d5b0902feba59aa07dfd9f5b4c2deb2360f1ae Mon Sep 17 00:00:00 2001 From: dy Date: Tue, 19 Dec 2023 14:29:14 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E9=93=81=E7=AC=BC=E6=AD=BB=E6=96=97?= =?UTF-8?q?=EF=BC=8C=E7=9B=B8=E5=90=8C=E7=A7=AF=E5=88=86=E7=94=A8=E6=88=98?= =?UTF-8?q?=E5=8A=9B=E6=8E=92=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api_cross/wzry/ApiRank.ts | 41 +++++++++++++++-------------------- 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/src/api_cross/wzry/ApiRank.ts b/src/api_cross/wzry/ApiRank.ts index 79c9d3c..767fdc8 100644 --- a/src/api_cross/wzry/ApiRank.ts +++ b/src/api_cross/wzry/ApiRank.ts @@ -1,39 +1,32 @@ -import { ApiCall } from "tsrpc"; -import { ReqRank, ResRank } from "../../cross/protocols/wzry/PtlRank"; -import { ChatFun } from "../../public/chat"; -import { EmailFun } from "../../public/email"; -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"; +import {ApiCall} from "tsrpc"; +import {ReqRank, ResRank} from "../../cross/protocols/wzry/PtlRank"; +import {player} from "../../shared/protocols/user/type"; +import {FindOptions} from "mongodb"; -export async function getRankList(limit?: number, projection?:any){ - let option : FindOptions = { - sort : { - 'data.valArr': -1 +export async function getRankList(limit?: number, projection?: any) { + let option: FindOptions = { + sort: { + 'data.valArr': -1, + 'data.player.power': -1 } } - if(limit!=null){ + if (limit != null) { option.limit = limit; } - if(projection!=null){ + if (projection != null) { 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); return list; } export async function getPlayerRank(uid: string) { - let _r = await getRankList(50,{ - "data.player.uid":1, - "data.valArr":1, + let _r = await getRankList(50, { + "data.player.uid": 1, + "data.valArr": 1, }); if (!Object.keys(_r).length) { return -1 @@ -42,14 +35,14 @@ export async function getPlayerRank(uid: string) { return myrank; } -export async function getWzryRankList(uid: string, gud: player){ +export async function getWzryRankList(uid: string, gud: player) { let list = await getRankList(50); return { rankList: list, myRank: { rank: list.findIndex(li => li.player.uid == uid) + 1 || -1, 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] } }; } From dbda10a17ed3190c275100fa97a2b34b3784e5cd Mon Sep 17 00:00:00 2001 From: dy Date: Tue, 19 Dec 2023 16:24:14 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=8E=BB=E6=8E=89trace=20log?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/setMongodb.ts | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/setMongodb.ts b/src/setMongodb.ts index 2e1c47a..d636171 100644 --- a/src/setMongodb.ts +++ b/src/setMongodb.ts @@ -630,25 +630,25 @@ export class _mongodb { } } -//@ts-ignore -FindCursor.prototype._toArray = FindCursor.prototype.toArray; -//@ts-ignore -FindCursor.prototype.toArray = async function(){ - let rss = await this._toArray(); - - //如果返回的数据超过50条 - if(rss.length>50){ - addGameLog("system","findCount",null,{ - collection: this.namespace.collection, - db:this.namespace.db, - count:rss.length - }) - console.log("system,findCount",{ - collection: this.namespace.collection, - db:this.namespace.db, - count:rss.length - }) - console.trace(); - } - return rss; -} \ No newline at end of file +// //@ts-ignore +// FindCursor.prototype._toArray = FindCursor.prototype.toArray; +// //@ts-ignore +// FindCursor.prototype.toArray = async function(){ +// let rss = await this._toArray(); +// +// //如果返回的数据超过50条 +// if(rss.length>50){ +// addGameLog("system","findCount",null,{ +// collection: this.namespace.collection, +// db:this.namespace.db, +// count:rss.length +// }) +// console.log("system,findCount",{ +// collection: this.namespace.collection, +// db:this.namespace.db, +// count:rss.length +// }) +// console.trace(); +// } +// return rss; +// } \ No newline at end of file From 7ae7349550dc0acdafd78c8b495c557a0883de77 Mon Sep 17 00:00:00 2001 From: xcy <871622040@qq.com> Date: Tue, 19 Dec 2023 14:42:51 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix:=E8=B7=A8=E6=9C=8D=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=E5=AE=9A=E6=97=B6=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/public/scheduler/scheduler_cross_email_pull.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/public/scheduler/scheduler_cross_email_pull.ts b/src/public/scheduler/scheduler_cross_email_pull.ts index 652f36e..66a19cc 100644 --- a/src/public/scheduler/scheduler_cross_email_pull.ts +++ b/src/public/scheduler/scheduler_cross_email_pull.ts @@ -22,12 +22,15 @@ export class CrossEmailPull extends Scheduler { G.clientCross.callApi("email/GetCrossEmail", {server_id: G.config.serverId + ""}).then((res) => { if(!res.isSucc)return; res.res.emails.forEach(async (email) => { + let _prize = email?.prizeData?.prize || []; + if (email?.prizeData) delete email.prizeData; + + email["prize"] = _prize; if (email.uid != "system") { await EmailFun.addEmail(email) } else { await EmailFun.addQuanFuEmail(email) } - await EmailFun.addEmail(email) }) }) await this.ctorStartTime()