Compare commits

...

4 Commits

Author SHA1 Message Date
dy
b84fd92528 Merge branch 'bugfix' into release 2023-12-19 16:24:37 +08:00
dy
dbda10a17e 去掉trace log 2023-12-19 16:24:14 +08:00
dy
1a703f1ecd 首充改为直购 2023-12-19 14:59:28 +08:00
dy
87d5b0902f 铁笼死斗,相同积分用战力排名 2023-12-19 14:30:01 +08:00
7 changed files with 89 additions and 80 deletions

View File

@ -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]
}
};
}

View File

@ -1,11 +1,14 @@
import { ApiCall } from "tsrpc";
import { ReqOpen, ResOpen } from "../../../shared/protocols/event/shouchong/PtlOpen";
import {PayFun} from "../../../public/pay";
export default async function (call: ApiCall<ReqOpen, ResOpen>) {
let data = await G.mongodb.cEvent('shouchong').findOne({ uid: call.uid, type: 'shouchong' });
let data = await G.mongodb.cEvent('shouchongzhigou').findOne({uid: call.uid, type: 'shouchongzhigou'})
let payIds = R.compose(R.map(i=>i.payid),R.values())(G.gc.shouchong)
call.succ({
payNum: call.conn.gud.payExp / 10,
receive: Object.fromEntries(Object.keys(G.gc.shouchong).map(k => [k, data?.receive?.[k] || []]))
});
receive: data?.receive || {},
buyLog: await PayFun.getPayLogs(call.uid, payIds)
})
}

View File

@ -1,28 +1,31 @@
import { ApiCall } from "tsrpc";
import { PlayerFun } from '../../../public/player';
import { ReqReceive, ResReceive } from "../../../shared/protocols/event/shouchong/PtlReceive";
import { PublicShared } from '../../../shared/public/public';
import { HongDianChange } from "../../hongdian/fun";
import {ApiCall} from "tsrpc";
import {PlayerFun} from '../../../public/player';
import {ReqReceive, ResReceive} from "../../../shared/protocols/event/shouchong/PtlReceive";
import {PublicShared} from '../../../shared/public/public';
import {HongDianChange} from "../../hongdian/fun";
import {PayFun} from "../../../public/pay";
export default async function (call: ApiCall<ReqReceive, ResReceive>) {
let conf = G.gc.shouchong[call.req.k];
if (!conf) return call.error(globalThis.lng.pata_getprize_1);
let data = await G.mongodb.cEvent('shouchong').findOne({ uid: call.uid, type: 'shouchong' });
let payLog = await PayFun.getPayLog(call.uid, conf.payid)
if (!payLog) return call.errorCode(-1)
let data = await G.mongodb.cEvent('shouchongzhigou').findOne({ uid: call.uid, type: 'shouchongzhigou' });
let recArr = data?.receive?.[call.req.k] || [];
if (call.conn.gud.payExp < conf.paynum) return call.error(globalThis.lng.event_kfkh_9);
// if (call.conn.gud.payExp < conf.paynum) return call.error(globalThis.lng.event_kfkh_9);
if (recArr.length >= conf.prize.length) return call.error(globalThis.lng.event_kfkh_3);
if (recArr.slice(-1)[0] && PublicShared.getToDayZeroTime() < recArr.slice(-1)[0]) return call.error(globalThis.lng.event_kfkh_10);
await PlayerFun.sendPrize(call, conf.prize[recArr.length]);
await G.mongodb.cEvent('shouchong').updateOne(
{ uid: call.uid, type: 'shouchong' },
await G.mongodb.cEvent('shouchongzhigou').updateOne(
{ uid: call.uid, type: 'shouchongzhigou' },
{ $push: G.mongodb.createTreeObj({ key: 'receive', k: call.req.k, val: G.time }) },
{ upsert: true }
);
@ -40,17 +43,16 @@ export default async function (call: ApiCall<ReqReceive, ResReceive>) {
}
export async function getShouChongRedPoint(call: ApiCall) {
let res = { show: false };
let data = await G.mongodb.cEvent('shouchong').findOne({ uid: call.uid, type: 'shouchong' });
// let data = await G.mongodb.cEvent('shouchong').findOne({ uid: call.uid, type: 'shouchong' });
//
// for (let [id, conf] of Object.entries(G.gc.shouchong)) {
// let rec = data?.receive?.[id] || [];
// if (call.conn.gud.payExp / 10 < conf.paynum || rec.length >= conf.prize.length) continue;
// if (rec.length == 0 || rec.slice(-1)[0] < PublicShared.getToDayZeroTime(G.time)) {
// res = { show: true };
// break;
// }
// }
for (let [id, conf] of Object.entries(G.gc.shouchong)) {
let rec = data?.receive?.[id] || [];
if (call.conn.gud.payExp / 10 < conf.paynum || rec.length >= conf.prize.length) continue;
if (rec.length == 0 || rec.slice(-1)[0] < PublicShared.getToDayZeroTime(G.time)) {
res = { show: true };
break;
}
}
return res;
return {show: false};
}

View File

@ -26,6 +26,9 @@ export type eventType = {
shouchong: {
receive: k_v<number[]>;
};
shouchongzhigou: {
receive: k_v<number[]>;
};
kaifukuanghuan: Omit<ResOpen, 'day' | 'taskFinished'>;
dayjijin: Omit<ResOpenJiJin, 'isPay' | 'finished'>;
dengjijijin: Omit<ResOpenJiJin, 'isPay' | 'finished'>;

View File

@ -640,25 +640,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;
}
// //@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;
// }

View File

@ -8,8 +8,10 @@ export type ReqOpen = {
};
export type ResOpen = {
payNum: number;
receive: {
[k: string]: number[];
};
buyLog:{
[k: string]: any;
}
};

View File

@ -10262,13 +10262,6 @@ export const serviceProto: ServiceProto<ServiceType> = {
"properties": [
{
"id": 0,
"name": "payNum",
"type": {
"type": "Number"
}
},
{
"id": 1,
"name": "receive",
"type": {
"type": "Interface",
@ -10282,6 +10275,19 @@ export const serviceProto: ServiceProto<ServiceType> = {
}
}
}
},
{
"id": 1,
"name": "buyLog",
"type": {
"type": "Interface",
"indexSignature": {
"keyType": "String",
"type": {
"type": "Any"
}
}
}
}
]
},