From 445cd6054886f498fdb0eada5f0fdde20462c4db Mon Sep 17 00:00:00 2001 From: dy Date: Fri, 22 Dec 2023 14:07:55 +0800 Subject: [PATCH 01/38] =?UTF-8?q?fix=20bug=20=20=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E3=80=81=E8=8B=B1=E9=9B=84=E4=B8=8A=E9=98=B5bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api_s2c/hero/ApiChangePos.ts | 10 ++++++++++ src/public/pay.ts | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/src/api_s2c/hero/ApiChangePos.ts b/src/api_s2c/hero/ApiChangePos.ts index 1ec5316..ad66394 100644 --- a/src/api_s2c/hero/ApiChangePos.ts +++ b/src/api_s2c/hero/ApiChangePos.ts @@ -57,6 +57,8 @@ export default async function (call: ApiCall) { } fightHeros.push(hero.heroId.toString()); + fightHeros = await checkFightHerosAndFix(call.uid, heroPos, fightHeros) + Wjjl.setVal(call.uid, 'fight_hero_colour_4', fightHeros.map(id => G.gc.hero[id].colour).filter(c => c >= 4).length); let checkMatrixPos = HeroFun.checkMatrixPosAndChange(call, heroPos, matrixPos) @@ -65,4 +67,12 @@ export default async function (call: ApiCall) { call.conn.refreshPower(); kfjsFun.setHeroLvCount(call) +} + +async function checkFightHerosAndFix(uid, heroPos, fightHeros) { + if (fightHeros.length == R.values(heroPos).length) { + return fightHeros + } + let heros = await HeroFun.getHeros({uid}, R.values(heroPos)); + return heros.map(i => i.heroId) } \ No newline at end of file diff --git a/src/public/pay.ts b/src/public/pay.ts index b1302b5..1516859 100644 --- a/src/public/pay.ts +++ b/src/public/pay.ts @@ -181,6 +181,10 @@ export class PayFun { return; } } + /** + * 不要轻易改动这个方法,不允许集成业务逻辑在内部 + * 如果有业务逻辑通过事件驱动,在支付成功后emit事件 + */ let conf: any = await this.getConf(payId, payArgs); From dda11bb1225f6ec7f9c0a83e155255db40e095b3 Mon Sep 17 00:00:00 2001 From: ciniao <4041990@qq.com> Date: Fri, 22 Dec 2023 14:33:49 +0800 Subject: [PATCH 02/38] =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E5=AE=B9=E9=94=99?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/global.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/global.ts b/src/global.ts index 30fa869..625df9f 100644 --- a/src/global.ts +++ b/src/global.ts @@ -140,7 +140,13 @@ class _G { } on(event: T, callback: gEventType[T]) { - return this.event.on(event, callback); + return this.event.on(event, (...args)=>{ + try{ + callback.call(this, ...args); + }catch(e){ + console.error(e) + } + }); } once(event: T, callback: gEventType[T]) { From a2d16fb5309c1fda19320243f2ed9bb497f3a8aa Mon Sep 17 00:00:00 2001 From: xcy <871622040@qq.com> Date: Fri, 22 Dec 2023 16:15:06 +0800 Subject: [PATCH 03/38] =?UTF-8?q?fix:=20email=20=E8=BF=87=E6=BB=A4=20prize?= =?UTF-8?q?list?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api_s2c/email/ApiOpen.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/api_s2c/email/ApiOpen.ts b/src/api_s2c/email/ApiOpen.ts index ff711cf..7523532 100644 --- a/src/api_s2c/email/ApiOpen.ts +++ b/src/api_s2c/email/ApiOpen.ts @@ -3,11 +3,15 @@ import {EmailFun} from '../../public/email'; import {ReqOpen, ResOpen} from "../../shared/protocols/email/PtlOpen"; export default async function (call: ApiCall) { + // 存入当前玩家多语言信息 + await G.redis.rawSet(`user:lng:${call.uid}`, call.req.lng, {EX: 259200}) + let list = await EmailFun.getAllEmail(call.uid, false); let obj: ResOpen = {}; - list.forEach(e => obj[e._id] = e); - call.succ(obj); + for (let email of list) { + obj[email._id] = email; + if (email.prizelist) delete email.prizelist; + } - // 存入当前玩家多语言信息 - G.redis.rawSet(`user:lng:${call.uid}`, call.req.lng, {EX: 259200}) + call.succ(obj); } \ No newline at end of file From e269b1412a7aee26f2816dc0243338c8a78f1ba1 Mon Sep 17 00:00:00 2001 From: dy Date: Fri, 22 Dec 2023 21:27:44 +0800 Subject: [PATCH 04/38] =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/shared/protocols/serviceProto.ts | 16 +++++++++++++++- src/shared/protocols/shop/PtlOpen.ts | 4 +--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/shared/protocols/serviceProto.ts b/src/shared/protocols/serviceProto.ts index 62ac7ca..bba26ab 100644 --- a/src/shared/protocols/serviceProto.ts +++ b/src/shared/protocols/serviceProto.ts @@ -19726,7 +19726,21 @@ export const serviceProto: ServiceProto = { "id": 2, "name": "t", "type": { - "type": "Number" + "type": "Union", + "members": [ + { + "id": 0, + "type": { + "type": "Number" + } + }, + { + "id": 1, + "type": { + "type": "String" + } + } + ] } }, { diff --git a/src/shared/protocols/shop/PtlOpen.ts b/src/shared/protocols/shop/PtlOpen.ts index 8ba4fc5..19341f9 100644 --- a/src/shared/protocols/shop/PtlOpen.ts +++ b/src/shared/protocols/shop/PtlOpen.ts @@ -1,5 +1,3 @@ - - /** * 商店open接口 */ @@ -32,7 +30,7 @@ export type shopItem = { /** 掉落类型 */ 'a': string; /** 掉落id */ - 't': number; + 't': number | string; /** 掉落数量 */ 'n': number; /** 权重 */ From ef6498c0d60bf71ceebcab63d0a1ac5b82c32e49 Mon Sep 17 00:00:00 2001 From: xcy <871622040@qq.com> Date: Sat, 23 Dec 2023 00:44:04 +0800 Subject: [PATCH 05/38] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=82=AE?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api_s2c/email/ApiAllRemove.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api_s2c/email/ApiAllRemove.ts b/src/api_s2c/email/ApiAllRemove.ts index d27b610..220bed2 100644 --- a/src/api_s2c/email/ApiAllRemove.ts +++ b/src/api_s2c/email/ApiAllRemove.ts @@ -5,7 +5,7 @@ import { ReqAllRemove, ResAllRemove } from "../../shared/protocols/email/PtlAllR export default async function (call: ApiCall) { // 筛选出没有奖励已读邮件和已经领取过奖励的邮件 let emailList = (await EmailFun.getAllEmail(call.uid, true)).filter(email => ( - (email.emailRead && email.prizeData.prize.length <= 0) || email.prizeData.isGet + (email.emailRead && email.prizeData?.prize.length <= 0) || email.prizeData.isGet )); if (emailList.length < 1) return call.error(globalThis.lng.email_2); From 14daa94dba2d9c490ffa77c75e2b556dbb5f051d Mon Sep 17 00:00:00 2001 From: dy Date: Sat, 23 Dec 2023 12:30:11 +0800 Subject: [PATCH 06/38] =?UTF-8?q?fix=20=E9=BB=91=E5=B8=AE=E4=BA=89?= =?UTF-8?q?=E9=9C=B8=E5=88=86=E7=BB=84=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/api_s2c/hbzb/zbs/fun.ts | 91 +++++++++++++++++++------------------ 1 file changed, 47 insertions(+), 44 deletions(-) diff --git a/src/api_s2c/hbzb/zbs/fun.ts b/src/api_s2c/hbzb/zbs/fun.ts index f6abd0d..9c0dd83 100644 --- a/src/api_s2c/hbzb/zbs/fun.ts +++ b/src/api_s2c/hbzb/zbs/fun.ts @@ -1,55 +1,58 @@ /** * 争霸赛分组,每300个玩家分一组 * 最后一组:如果是有100人即往上人数 那就自己一组打 -* 如果不够100 就合到前一组 + * 如果不够100 就合到前一组 */ -export async function zbsGroup(){ +export async function zbsGroup() { let arr = await G.mongodb.collection("hbzb_user_cross").find( - { "jifen": { $gt: -999999 } } - ).sort( - { "data.player.cTime": -1 } - ).project({ - uid:1, - jifen:1 - }).toArray(); - + {"jifen": {$gt: -999999}} + ).project({ + uid: 1, + jifen: 1, + 'data.player.cTime': 1 + }).toArray(); + + // 移除mongo查询里的排序,↑会造成内存超出报错, + // 在内存里按照玩家注册时间相近的排序分组 + R.sort((a, b) => b.data.player.cTime - a.data.player.cTime) + //有积分的玩家总数 let groups = []; let currGroup = []; - - arr.map((u,index)=>{ - if(currGroup.length >= 300){ + + arr.map((u, index) => { + if (currGroup.length >= 300) { //每300个丢一组 - groups.push( currGroup ); + groups.push(currGroup); currGroup = []; } currGroup.push({uid: u.uid, jifen: u.jifen}); }); //循环完毕后检查余量 - if(currGroup.length > 0){ - if(currGroup.length >= 100){ + if (currGroup.length > 0) { + if (currGroup.length >= 100) { //如果有100人 就自己一组 - groups.push( currGroup ); - }else{ + groups.push(currGroup); + } else { //不够100 就合到前一组 - groups[groups.length] = (groups[groups.length]||[]).concat(currGroup); + groups[groups.length] = (groups[groups.length] || []).concat(currGroup); } currGroup = []; } //循环groups里的数据,对每一组里按jifen降序排序,然后给每个玩家分组 - groups.map((group,groupIndex)=>{ - group.sort((a,b)=>{ + groups.map((group, groupIndex) => { + group.sort((a, b) => { return b.jifen - a.jifen; }); - for(let i=0;i { +export async function getZbsRankList(uid?: string, _zbsgroup?: string): Promise<{ myRank: any; rankList: any[]; }> { let myData; let zbsgroup = _zbsgroup; - if(uid){ - myData = await G.crossmongodb.collection("hbzb_user_cross").findOne({uid:uid}); - if(!myData || !myData?.zbsgroup)return null; + if (uid) { + myData = await G.crossmongodb.collection("hbzb_user_cross").findOne({uid: uid}); + if (!myData || !myData?.zbsgroup) return null; zbsgroup = myData?.zbsgroup; } - + let arr = await G.crossmongodb.collection("hbzb_user_cross").find( - { "zbsgroup": zbsgroup } + {"zbsgroup": zbsgroup} ).sort( - { "rank": 1 } + {"rank": 1} ).limit(100).toArray(); - + let rank = { - "myRank":{}, - "rankList" : [] + "myRank": {}, + "rankList": [] } - + let myRank = -1; - arr.map((u,index)=>{ - rank.rankList.push( { + arr.map((u, index) => { + rank.rankList.push({ player: ((u.data) as any).player || {}, roles: ((u.data) as any).roles || {}, - rank : (index+1), + rank: (index + 1), //兼容前端 - valArr: [ (index+1) ] + valArr: [(index + 1)] }); - if(u.uid == uid){ + if (u.uid == uid) { myRank = rank.rankList.length; rank.myRank = { player: ((u.data) as any).player || {}, roles: ((u.data) as any).roles || {}, - rank : (index+1), + rank: (index + 1), //兼容前端 - valArr: [ (index+1) ] + valArr: [(index + 1)] }; } }) return rank; - + } From c323a9e2553e694cc67865f0d96c79a5369a9c6e Mon Sep 17 00:00:00 2001 From: chenkai Date: Mon, 25 Dec 2023 11:06:45 +0800 Subject: [PATCH 07/38] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=8A=A2?= =?UTF-8?q?=E7=BA=A2=E5=8C=85=E6=97=A5=E5=BF=97=E5=88=97=E8=A1=A8=E9=95=BF?= =?UTF-8?q?=E5=BA=A6=E9=99=90=E5=88=B6=E6=9C=AA=E7=94=9F=E6=95=88=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api_s2c/event/payForDiamond/ApiReceive.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api_s2c/event/payForDiamond/ApiReceive.ts b/src/api_s2c/event/payForDiamond/ApiReceive.ts index 32cc9cb..a81b991 100644 --- a/src/api_s2c/event/payForDiamond/ApiReceive.ts +++ b/src/api_s2c/event/payForDiamond/ApiReceive.ts @@ -109,7 +109,7 @@ export default async function (call: ApiCall) { }); const showOffListKey = showOffListKeyPrefix + activityId; await G.iorediscross.lpush(showOffListKey, msg); - await G.ioredis.ltrim(showOffListKey, 0, 49); // 限制列表保存 50 条消息, 避免无限增长 + await G.iorediscross.ltrim(showOffListKey, 0, 49); // 限制列表保存 50 条消息, 避免无限增长 } } } else { From 43f640595be2a301046099e42694c0efe8881169 Mon Sep 17 00:00:00 2001 From: ciniao <4041990@qq.com> Date: Mon, 25 Dec 2023 13:50:28 +0800 Subject: [PATCH 08/38] =?UTF-8?q?=E8=84=9A=E6=9C=AC=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/fix_patch/patch_test.ts | 33 ++++++++++++++++++ src/patch.ts | 68 +++++++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 src/fix_patch/patch_test.ts create mode 100644 src/patch.ts diff --git a/src/fix_patch/patch_test.ts b/src/fix_patch/patch_test.ts new file mode 100644 index 0000000..f2e7e46 --- /dev/null +++ b/src/fix_patch/patch_test.ts @@ -0,0 +1,33 @@ +import { patchFun, patchInit } from "../patch"; + +class Path{ + @patchFun + async fun1(a:any) { + //这里执行脚本的内容,加了patchFun的函数,不允许重复执行 + console.log("这是第1个脚本里内容"); + return 12 + } + + @patchFun + async fun2(a:any) { + //这里执行脚本的内容,加了patchFun的函数,不允许重复执行 + console.log("这是第2个脚本里内容"); + return 12 + } + + async run(){ + await this.fun1(1); + await this.fun2(2); + } +} + +async function main(){ + await patchInit() + let patch = new Path(); + await patch.run(); + setInterval(() => { + console.log(new Date().format("MM-dd hh:mm:ss")); + }, 1000); + console.log("逻辑执行完成,等待退出"); +} +main(); diff --git a/src/patch.ts b/src/patch.ts new file mode 100644 index 0000000..c5b3d7a --- /dev/null +++ b/src/patch.ts @@ -0,0 +1,68 @@ +import { extendType } from "./extends"; +import { ctor } from "./global"; +import { initIORedis } from "./ioredis"; +import { initGcType } from "./jsonType"; +import { createLng } from "./lng"; +import { initMongoDB } from "./setMongodb"; +import { initRedis } from "./setRedis"; + +var path = require('path'); +var scriptName = path.basename(__filename); + +export function patchFun(target: any, key: string, descriptor: PropertyDescriptor) { + let scriptName; + try { + throw new Error(); + } catch (e) { + let caller = (e.stack.split("\n").slice(2)[0].split("\\").slice(-2)); + scriptName = caller[1].split(':')[0]; + } + + if(!scriptName){ + console.log('获取不到脚本名'); + return; + } + const originalMethod = descriptor.value; + descriptor.value = function(...args: any[]) { + //@ts-ignore + G.mongodb.collection("_patch_run_log").findOne({ fileName: scriptName, funName: key }).then(async runed=>{ + if(runed){ + console.log(`脚本${scriptName}已经执行过${key}方法,跳过`); + return (null as any); + } + + console.log(`调用了${scriptName}脚本里的${key}方法,参数为:${args}`); + const result = await originalMethod.apply(this, args); + console.log(`执行结果为:${result}`); + + //@ts-ignore + await G.mongodb.collection("_patch_run_log").insertOne({ + "fileName": scriptName, + "funName": key as any, + "ctime":Date.now(), + "res":result + }); + return (result as any); + }); + } +} + +export async function patchInit() { + await patchStart(); +} + +async function patchStart() { + //扩展框架 + extendType(); + //游戏配置提示文件 + initGcType(); + //连接mongodb + await initMongoDB(); + //连接redis + await initRedis(); + await initIORedis(); +} +// //定义全局变量 +ctor(); +//创建语言包 +createLng(); \ No newline at end of file From 88c39187a0e2af0eca1128f60e53be20f333aae3 Mon Sep 17 00:00:00 2001 From: dy Date: Mon, 25 Dec 2023 13:50:43 +0800 Subject: [PATCH 09/38] =?UTF-8?q?=E5=95=86=E5=BA=97=E5=8A=A0=E5=85=A5versi?= =?UTF-8?q?on=EF=BC=8C=E5=BD=93=E7=89=88=E6=9C=AC=E4=B8=8D=E4=B8=80?= =?UTF-8?q?=E8=87=B4=E6=97=B6=E5=88=B7=E6=96=B0=E5=95=86=E5=BA=97=E5=86=85?= =?UTF-8?q?=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api_s2c/shop/ApiBuy.ts | 2 +- src/api_s2c/shop/ApiOpen.ts | 2 +- src/api_s2c/shop/ApiRefresh.ts | 12 ++++++------ src/jsonType.ts | 1 + src/module/collection_shop.ts | 1 + src/public/shop.ts | 6 +++++- 6 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/api_s2c/shop/ApiBuy.ts b/src/api_s2c/shop/ApiBuy.ts index ea47e0f..6ce5924 100644 --- a/src/api_s2c/shop/ApiBuy.ts +++ b/src/api_s2c/shop/ApiBuy.ts @@ -11,7 +11,7 @@ export default async function (call: ApiCall) { let uid = shopId != "2" ? call.uid : call.conn.gud.ghId - let shopData = await ShopFun.getShopData(uid, shopId); + let shopData = await ShopFun.getShopData(uid, shopId, call.conn.gud.lv); let shopItem = shopData.shopItems[index]; diff --git a/src/api_s2c/shop/ApiOpen.ts b/src/api_s2c/shop/ApiOpen.ts index 809bb94..e78a366 100644 --- a/src/api_s2c/shop/ApiOpen.ts +++ b/src/api_s2c/shop/ApiOpen.ts @@ -17,7 +17,7 @@ export default async function (call: ApiCall) { let uid = shopId != "2" ? call.uid : call.conn.gud.ghId - let shopData = await ShopFun.getShopData(uid, shopId) + let shopData = await ShopFun.getShopData(uid, shopId, call.conn.gud.lv) call.succ(shopData); } diff --git a/src/api_s2c/shop/ApiRefresh.ts b/src/api_s2c/shop/ApiRefresh.ts index b77029c..e095dcd 100644 --- a/src/api_s2c/shop/ApiRefresh.ts +++ b/src/api_s2c/shop/ApiRefresh.ts @@ -1,7 +1,7 @@ -import { ApiCall } from "tsrpc"; -import { PlayerFun } from '../../public/player'; -import { ShopFun } from '../../public/shop'; -import { ReqRefresh, ResRefresh } from "../../shared/protocols/shop/PtlRefresh"; +import {ApiCall} from "tsrpc"; +import {PlayerFun} from '../../public/player'; +import {ShopFun} from '../../public/shop'; +import {ReqRefresh, ResRefresh} from "../../shared/protocols/shop/PtlRefresh"; export default async function (call: ApiCall) { let shopId = call.req.shopId; @@ -9,7 +9,7 @@ export default async function (call: ApiCall) { let uid = shopId != "2" ? call.uid : call.conn.gud.ghId - let shopData = await ShopFun.getShopData(uid, shopId); + let shopData = await ShopFun.getShopData(uid, shopId, call.conn.gud.lv); if (!shopData) return call.error(globalThis.lng.shop_1); @@ -46,6 +46,6 @@ export default async function (call: ApiCall) { await ShopFun.changeShopData(uid, shopId, change); - let { buyNum, shopItems, ...ops } = change; + let {buyNum, shopItems, ...ops} = change; call.succ({buyNum: buyNum, shopItems: shopItems, ...ops}); } \ No newline at end of file diff --git a/src/jsonType.ts b/src/jsonType.ts index aacb4a8..c953d75 100644 --- a/src/jsonType.ts +++ b/src/jsonType.ts @@ -1213,6 +1213,7 @@ type gc_shop = k_v<{ 'npcImg': number /** 商店看板娘说话 */ 'npcText': string + 'version': string | number }>; type gc_shopcom = k_v<{ diff --git a/src/module/collection_shop.ts b/src/module/collection_shop.ts index cf12500..657838b 100644 --- a/src/module/collection_shop.ts +++ b/src/module/collection_shop.ts @@ -4,4 +4,5 @@ import {ResOpen} from '../shared/protocols/shop/PtlOpen'; export type CollectionShop = ResOpen & { uid: string; // 玩家uid shopId: string; // 商店id + version: string | number; }; \ No newline at end of file diff --git a/src/public/shop.ts b/src/public/shop.ts index 9145f0f..a8c8e9e 100644 --- a/src/public/shop.ts +++ b/src/public/shop.ts @@ -94,7 +94,7 @@ export class ShopFun { )).value } - static async getShopData(uid: string, shopId: string) { + static async getShopData(uid: string, shopId: string, lv: number) { let where = { uid: uid, shopId: shopId @@ -114,6 +114,10 @@ export class ShopFun { await this.changeShopData(uid, shopId, {useFreeRefreshNum: 0, lastFreeRefreshTime: G.time}); } + if (shopConf.version && shopConf.version != shopData.version) { + await this.changeShopData(uid, shopId, {shopItems: this.getShopItems(shopId, lv)}) + } + return shopData } From a0d4c911d8e646ddc9f320f31a3cccd3511b27a4 Mon Sep 17 00:00:00 2001 From: ciniao <4041990@qq.com> Date: Mon, 25 Dec 2023 13:51:05 +0800 Subject: [PATCH 10/38] =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E5=85=81=E8=AE=B8?= =?UTF-8?q?=E8=A3=85=E9=A5=B0=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tsconfig.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index 4352908..dd6c539 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,7 +11,8 @@ "esModuleInterop": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true, - "moduleResolution": "node" + "moduleResolution": "node", + "experimentalDecorators": true }, "include": [ "src", From dd2962a80e7bf7bbba8de5cfdd87ed434f8be124 Mon Sep 17 00:00:00 2001 From: ciniao <4041990@qq.com> Date: Mon, 25 Dec 2023 14:32:52 +0800 Subject: [PATCH 11/38] =?UTF-8?q?=E6=B8=85=E7=90=86redis?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/public/gud.ts | 6 ++++++ src/setRedis.ts | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/public/gud.ts b/src/public/gud.ts index 8ba809b..c4a4dda 100644 --- a/src/public/gud.ts +++ b/src/public/gud.ts @@ -23,6 +23,12 @@ export async function clearGud(uid) { console.log('清空tanxian Redis',uid); G.redis.del("tanxian",uid); } + try{ + console.log('清空friend:list Redis',uid); + G.redis.hDel("friend:list",uid); + }catch(e){ + + } }; /** diff --git a/src/setRedis.ts b/src/setRedis.ts index b27ee0c..6e6b155 100644 --- a/src/setRedis.ts +++ b/src/setRedis.ts @@ -77,8 +77,9 @@ async function clearRedis() { G.redis.fromatKey('hero'), G.redis.fromatKey('equip'), G.redis.fromatKey('shiwu'), - //G.redis.fromatKey('gbtx'), - //G.redis.fromatKey('dxlt'), + G.redis.fromatKey('tanxian'), + G.redis.fromatKey('gbtx'), + G.redis.fromatKey('dxlt'), ]) } From 36d92262b7a8b534813030c0ab1e329713d589dd Mon Sep 17 00:00:00 2001 From: chenkai Date: Mon, 25 Dec 2023 15:50:06 +0800 Subject: [PATCH 12/38] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20boss=20?= =?UTF-8?q?=E9=94=81=E7=8A=B6=E6=80=81=E4=B8=8D=E9=87=8A=E6=94=BE=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/public/gonghui/gh.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/public/gonghui/gh.ts b/src/public/gonghui/gh.ts index 3b17a08..7676982 100644 --- a/src/public/gonghui/gh.ts +++ b/src/public/gonghui/gh.ts @@ -31,14 +31,21 @@ export class GH { } /**更改isFightBoss状态 */ - changeIsFightBoss(bool = false) { - G.redis.hSet('gonghui:isFightBoss', this.data._id, bool) + async changeIsFightBoss(bool = false) { + const key = 'gonghui:isFightBoss:' + this.data._id; + if (bool) { + await G.ioredis.setnx(key, 1); + await G.ioredis.expire(key, 1); + } else { + await G.ioredis.del(key); + } return } /**获取isFightBoss状态 */ async getIsFightBoss(): Promise { - return await G.redis.hGet('gonghui:isFightBoss', this.data._id) || false + const key = 'gonghui:isFightBoss:' + this.data._id; + return await G.ioredis.get(key)? true : false; } /** From 93f6b5b7ba4636b0f1fd10ec1f57b732330cfd3f Mon Sep 17 00:00:00 2001 From: dy Date: Mon, 25 Dec 2023 16:38:05 +0800 Subject: [PATCH 13/38] =?UTF-8?q?=E8=87=AA=E9=80=89=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E8=B4=AD=E4=B9=B0=E6=94=B9=E4=B8=BA=E7=BB=9F=E4=B8=80=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 - .vscode/launch.json | 50 ++++++++++++++++++++++++++++++ src/public/pay.ts | 74 +++++++++++++++++++++++++++++++++++---------- 3 files changed, 108 insertions(+), 17 deletions(-) create mode 100644 .vscode/launch.json diff --git a/.gitignore b/.gitignore index c1b085f..98d22b9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ /node_modules /.idea -/.vscode /dist /doc diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..aea870d --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,50 @@ +{ + // 使用 IntelliSense 了解相关属性。 + // 悬停以查看现有属性的描述。 + // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "消息服", + "type": "node", + "request": "launch", + "args": [ + "${workspaceRoot}/src/index.ts", + "-serverType", + "msg", + "-logModel", + "debug" + ], + "runtimeArgs": [ + "--nolazy", + "-r", + "ts-node/register" + ], + "sourceMaps": true, + "cwd": "${workspaceRoot}", + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen" + }, + { + "name": "跨服", + "type": "node", + "request": "launch", + "args": [ + "${workspaceRoot}/src/index.ts", + "-serverType", + "cross", + "-logModel", + "debug" + ], + "runtimeArgs": [ + "--nolazy", + "-r", + "ts-node/register" + ], + "sourceMaps": true, + "cwd": "${workspaceRoot}", + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen" + } + ] +} \ No newline at end of file diff --git a/src/public/pay.ts b/src/public/pay.ts index 1516859..90b9592 100644 --- a/src/public/pay.ts +++ b/src/public/pay.ts @@ -207,19 +207,20 @@ export class PayFun { payArgs: payArgs, orderNo: orderNo } - if (payId.indexOf('zixuanlibao') != -1) { - // 后端唯一标识 htype 4 自选/定制 礼包 - // @ts-ignore - let _hdList = await HuoDongFun.gethdList(call, 4) - _hdList.forEach(ele => { - let selectPrize = ele.data.gift.find(v => v.payId == payId)?.prize; - if (prize) { - let index = payArgs instanceof Array ? payArgs : []; - let select = selectPrize.map((v, i) => v[index[i]] ? v[index[i]] : v[0]); - prize.push(...select); - } - }) - } + //改为统一方法,此处自选不这样用 + // if (payId.indexOf('zixuanlibao') != -1) { + // // 后端唯一标识 htype 4 自选/定制 礼包 + // // @ts-ignore + // let _hdList = await HuoDongFun.gethdList(call, 4) + // _hdList.forEach(ele => { + // let selectPrize = ele.data.gift.find(v => v.payId == payId)?.prize; + // if (prize) { + // let index = payArgs instanceof Array ? payArgs : []; + // let select = selectPrize.map((v, i) => v[index[i]] ? v[index[i]] : v[0]); + // prize.push(...select); + // } + // }) + // } if (payId.indexOf('ycmb') != -1) { // @ts-ignore // 养成活动充值礼包 let _hdids = await YangChengMuBiaofun.getCon(call); @@ -236,11 +237,26 @@ export class PayFun { let conf = await zmlbGetConf(call, {payId}) prize.push(...conf.prize) } + + /** + * todo 不要轻易改动这个方法,不允许集成业务逻辑在内部 + * todo 此方法仅仅是支付成功后的发奖 + * todo 如果有业务逻辑通过事件驱动,在支付成功后emit事件 + * todo 下面这个方法不应该这样写 + */ //圣诞节活动充值 - try{ + try { await Christmasfun.payChristmas(payId, call); - }catch (e) { - console.log("Christmasfun.payChristmas Error",e); + } catch (e) { + console.log("Christmasfun.payChristmas Error", e); + } + + if (payArgs.selectPrize) { + let selectPrize = await G.ioredis.get(`pay:${payId}:${player.uid}`); + if (selectPrize) { + prize.push(...JSON.parse(selectPrize)) + G.ioredis.del(`pay:${payId}:${player.uid}`) + } } let isReplaceConf = await this.checkBuysAfterPay(uid, payId, conf, payArgs, player) @@ -400,6 +416,31 @@ export class PayFun { if (conf.time != -1 && buyLog.slice(-1)[0]?.eTime > G.time && conf.buys == 0 && payId.indexOf('wkdlibao') == -1) { return G.server.sendMsgByUid(player.uid, 'msg_s2c/PayResult', {code: -2}); } + + /** + * 活动相关的自选礼包,目前htype 4、14支持此方法 + * payArgs里传相应参数,selectList选择的奖励列表 + * 往后所有自选类型,走这个方法,配置格式同4、14 + */ + if (payArgs.htype && payArgs.selectList) { + // @ts-ignore + let _hdInfo = (await HuoDongFun.gethdList(call, payArgs.htype))[0] + // 活动类购买不符合条件返回-5 + if (!_hdInfo) G.server.sendMsgByUid(player.uid, 'msg_s2c/PayResult', {code: -5}) + let giftInfo = _hdInfo.data.gift.find(v => v.payId == payId); + if (!giftInfo) G.server.sendMsgByUid(player.uid, 'msg_s2c/PayResult', {code: -5}) + + let dlzPrize = R.flatten(giftInfo.dlz.map(i => R.values(i))) + let selectPrize = payArgs.selectList.map(v => { + let sPrize = dlzPrize.find(o => o.a == v.a && o.t == v.t && o.n == v.n) + // 严格判断,自选奖励不存在奖励列表,返回-6 + if (!sPrize) return G.server.sendMsgByUid(player.uid, 'msg_s2c/PayResult', {code: -6}); + return sPrize + }) + // 自选奖励过判断后,存入redis,6小时内支付有效 todo 6小时可能有些长 + G.ioredis.setex(`pay:${payId}:${player.uid}`, 21600, JSON.stringify(selectPrize)); + } + //针对每日礼包的单独处理 let zeroTime = PublicShared.getToDayZeroTime(G.time) if (payId.indexOf('136Gift') != -1 && payId != '136GiftAll') { @@ -456,6 +497,7 @@ export class PayFun { /** * 当玩家购买过有时间期效性的礼包 并且在生效期内每天有邮件奖励时 每天首次登陆时根据时间补发邮件 玩家每天首次登陆会进入检查 + * @param player * @param lastTime 上一次登陆时间 * @param curTime 每日首次登陆时间 */ From 4b8be68516eb0b02d4a359c7429f37efe92bd5ba Mon Sep 17 00:00:00 2001 From: dy Date: Mon, 25 Dec 2023 17:17:57 +0800 Subject: [PATCH 14/38] fix pay --- src/public/pay.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/public/pay.ts b/src/public/pay.ts index 90b9592..fcb2c5f 100644 --- a/src/public/pay.ts +++ b/src/public/pay.ts @@ -423,6 +423,7 @@ export class PayFun { * 往后所有自选类型,走这个方法,配置格式同4、14 */ if (payArgs.htype && payArgs.selectList) { + let call = this.getCall(player) // @ts-ignore let _hdInfo = (await HuoDongFun.gethdList(call, payArgs.htype))[0] // 活动类购买不符合条件返回-5 From 3274911772a18bf185182112274d21b18db0204f Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 25 Dec 2023 17:40:59 +0800 Subject: [PATCH 15/38] =?UTF-8?q?=E9=93=81=E7=AC=BC=E6=AD=BB=E6=96=97?= =?UTF-8?q?=E7=A7=AF=E5=88=86=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/extends.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/extends.ts b/src/extends.ts index 6264fc8..db0d2c1 100644 --- a/src/extends.ts +++ b/src/extends.ts @@ -1,4 +1,3 @@ - import 'tsrpc'; import { ApiCall, BaseConnection, ConnectionStatus, WsServer } from 'tsrpc'; import { Wjjl } from './module/collection_wjjl'; @@ -133,7 +132,7 @@ BaseConnection.prototype.getDefaultFightData = async function (this: BaseConnect posObj = this.gud.matrixPos[this.gud.selectMatrix]; } - let heros = await HeroFun.getHeros(this, Object.values(posObj).filter(_id => _id != '')); + let heros = await HeroFun.getHeros(this, Object.values(posObj).filter(_id => _id != '') as string[]); Object.entries(posObj).forEach(obj => { let pos = obj[0]; From 080665f24eb3317231b1d7b3540e53a7a0665f09 Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 25 Dec 2023 17:43:34 +0800 Subject: [PATCH 16/38] =?UTF-8?q?=E9=BB=91=E5=B8=AE=E4=BA=89=E9=9C=B8?= =?UTF-8?q?=E7=A7=AF=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/public/wzry.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/public/wzry.ts b/src/public/wzry.ts index ac87051..02e848b 100644 --- a/src/public/wzry.ts +++ b/src/public/wzry.ts @@ -179,7 +179,7 @@ export class WangZheRongYaofun { } } if (win_num > 1) { - return _score + win_num - 1 + return _score + win_num } return _score } From bb7495379e44fe8bf1d3abec847a8a495558fe08 Mon Sep 17 00:00:00 2001 From: ciniao <4041990@qq.com> Date: Mon, 25 Dec 2023 20:21:46 +0800 Subject: [PATCH 17/38] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E6=89=80=E6=9C=89?= =?UTF-8?q?=E6=B3=A8=E9=87=8A=E4=BA=86=E7=9A=84G.redis=E7=9A=84=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=EF=BC=8C=E4=B8=BA=E5=85=A8=E9=9D=A2=E5=BC=83=E7=94=A8?= =?UTF-8?q?=E8=AF=A5redisJson=E5=81=9A=E5=87=86=E5=A4=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api_o2s/user/Apidisable.ts | 1 - src/api_s2c/ApiBingo.ts | 1 - src/api_s2c/equip/ApiGetList.ts | 1 - src/api_s2c/friend/ApiList.ts | 3 -- src/api_s2c/gonghui/ApiApplyList.ts | 1 - src/api_s2c/gonghui/ApiFbOpen.ts | 2 -- src/api_s2c/gongyu/mingdao/fun.ts | 4 --- src/api_s2c/hero/ApiGetList.ts | 2 -- src/api_s2c/hero/ApiLvUp.ts | 20 ----------- src/api_s2c/hongdian/fun.ts | 21 ------------ src/api_s2c/item/ApiGetList.ts | 15 --------- src/api_s2c/jjc/ApiOpen.ts | 3 -- src/api_s2c/shiwu/ApiGetList.ts | 2 -- src/api_s2c/user/ApiLogin.ts | 2 -- src/extends.ts | 2 -- src/globalListener.ts | 3 -- src/public/email.ts | 32 ------------------ src/public/equip.ts | 3 -- src/public/fight.ts | 7 ---- src/public/gonghui/gh.ts | 3 -- src/public/gonghui/manage.ts | 1 - src/public/hero.ts | 15 +++------ src/public/pay.ts | 1 - src/public/player.ts | 43 ------------------------ src/public/scheduler/scheduler_newDay.ts | 3 -- src/public/scheduler/scheduler_wzry.ts | 35 ------------------- src/public/shiwu.ts | 4 --- src/public/shop.ts | 21 ------------ src/public/user.ts | 20 ----------- src/setStartAfther.ts | 7 ---- src/setWs.ts | 12 ------- src/test.ts | 9 ----- 32 files changed, 4 insertions(+), 295 deletions(-) diff --git a/src/api_o2s/user/Apidisable.ts b/src/api_o2s/user/Apidisable.ts index e07c69d..2ea1ecd 100644 --- a/src/api_o2s/user/Apidisable.ts +++ b/src/api_o2s/user/Apidisable.ts @@ -24,7 +24,6 @@ export default async function (call: ApiCall) { break; } let res = await G.mongodb.collection('user').updateOne({uid}, {$set: data}); - //G.redis.set('user', uid, typeStr, value); setGud(uid, data); let result = res.modifiedCount > 0 ? 0 : 1; //3. 返回结果 diff --git a/src/api_s2c/ApiBingo.ts b/src/api_s2c/ApiBingo.ts index 9ec8155..70a8a14 100644 --- a/src/api_s2c/ApiBingo.ts +++ b/src/api_s2c/ApiBingo.ts @@ -120,7 +120,6 @@ export default async function (call: ApiCall) { } } else if (shell[0] == 'heroMaxLv') { - //let heros = await G.redis.get('hero', call.uid); let s = await G.mongodb.collection('hero').find({ uid: call.uid diff --git a/src/api_s2c/equip/ApiGetList.ts b/src/api_s2c/equip/ApiGetList.ts index 06208e1..f4fede2 100644 --- a/src/api_s2c/equip/ApiGetList.ts +++ b/src/api_s2c/equip/ApiGetList.ts @@ -24,7 +24,6 @@ export default async function (call: ApiCall) { await G.mongodb.collection('playerInfo', 'usertasklog').updateOne({ uid: call.conn.uid, type: 'usertasklog' }, { $set: { maxequiplv: maxequiplv, equipcolor: color } }, { upsert: true }) - //G.redis.set('equip', call.uid, kvList); let recLshd = await G.mongodb.collection('playerInfo', 'lshd_equip').findOne({ uid: call.conn.uid, type: 'lshd_equip' }); let { uid, _id, type, ...equips } = (recLshd || {}); diff --git a/src/api_s2c/friend/ApiList.ts b/src/api_s2c/friend/ApiList.ts index bb1045c..16fbbc5 100644 --- a/src/api_s2c/friend/ApiList.ts +++ b/src/api_s2c/friend/ApiList.ts @@ -15,16 +15,13 @@ export default async function (call: ApiCall) { ]).toArray(); break; case 'friend': - //res = await G.redis.gets('user', ...my.data.friendList.map(uid => [uid] as [string])) res = (await G.mongodb.find('user',{uid:{$in:my.data.friendList}})) as any; break; case 'apply': // 预防申请列表出现脏数据(过滤已添加好友) - //res = await G.redis.gets('user', ...); res = (await G.mongodb.find('user',{uid:{$in: my.data.applyList.filter(uid => my.data.friendList.indexOf(uid) == -1) }})) as any break; case 'black': - //res = await G.redis.gets('user', ...my.data.blacklist.map(uid => [uid] as [string])) res = (await G.mongodb.find('user',{uid:{$in: my.data.blacklist}})) as any; break; diff --git a/src/api_s2c/gonghui/ApiApplyList.ts b/src/api_s2c/gonghui/ApiApplyList.ts index 3478522..d3ec67d 100644 --- a/src/api_s2c/gonghui/ApiApplyList.ts +++ b/src/api_s2c/gonghui/ApiApplyList.ts @@ -5,7 +5,6 @@ export default async function (call: ApiCall) { let GHdata = await call.conn.gonghui if (GHdata.data.applyList?.length > 0) { - //let players = await G.redis.gets('user', ...GHdata.data.applyList.map(a => [a.uid] as [string])); let uids = GHdata.data.applyList.map((i)=>i.uid); let players = (await G.mongodb.find('user',{uid:{$in: uids}})) as any; diff --git a/src/api_s2c/gonghui/ApiFbOpen.ts b/src/api_s2c/gonghui/ApiFbOpen.ts index b8c2bf5..7a9caa0 100644 --- a/src/api_s2c/gonghui/ApiFbOpen.ts +++ b/src/api_s2c/gonghui/ApiFbOpen.ts @@ -12,7 +12,6 @@ export default async function (call: ApiCall) { if (call.req.fbId != gh.data.fuben.id) { let md = await G.mongodb.collection('gonghuiFb').findOne({ ghId: gh.data._id, fbId: call.req.fbId }); let uids = Object.keys(md.rankList); - //let players = await G.redis.gets('user', ...uids.map(uid => [uid] as [string])); let players = (await G.mongodb.find('user',{uid:{$in: uids}})) as any; res.rankList = players.map(p => { return { @@ -22,7 +21,6 @@ export default async function (call: ApiCall) { }); } else { let uids = Object.keys(gh.data.fuben.dps); - //let players = await G.redis.gets('user', ...uids.map(uid => [uid] as [string])); let players = (await G.mongodb.find('user',{uid:{$in: uids}})) as any; res.rankList = players.map(p => { return { diff --git a/src/api_s2c/gongyu/mingdao/fun.ts b/src/api_s2c/gongyu/mingdao/fun.ts index a91472c..138014e 100644 --- a/src/api_s2c/gongyu/mingdao/fun.ts +++ b/src/api_s2c/gongyu/mingdao/fun.ts @@ -29,12 +29,8 @@ export async function getFinished(conn: BaseConnection, types: string[]) { else if (type == 'use_attr_rmbmoney') obj[type] = await ActionLog.getRetainLog(conn.uid, 'use_attr_rmbmoney'); else if (type == 'zccg') obj[type] = (await G.mongodb.collection('pata').findOne({ uid: conn.uid }))?.lv || 0; else if (type == 'equip_star_5') { - //let equips = await G.redis.get('equip', conn.uid); - //obj[type] = Object.values(equips).filter(e => e.star >= 5).length; obj[type] = await G.mongodb.collection('equip').count({ uid: conn.uid, star: { $gte: 5 } }); } else if (type == 'peijian_colour_5') { - //let peijians = await G.redis.get('peijian', conn.uid); - //obj[type] = Object.values(peijians).filter(p => G.gc.peijian[p.peijianId].colour >= 5).length; obj[type] = await G.mongodb.collection('peijian').count({ uid: conn.uid, peijianId: { $in: peijianGteColor5ID } }); } } diff --git a/src/api_s2c/hero/ApiGetList.ts b/src/api_s2c/hero/ApiGetList.ts index 5cc5a8f..db43836 100644 --- a/src/api_s2c/hero/ApiGetList.ts +++ b/src/api_s2c/hero/ApiGetList.ts @@ -54,8 +54,6 @@ export default async function (call: ApiCall) { await G.mongodb.collection('playerInfo', 'usertasklog').updateOne({uid: call.conn.uid, type: 'usertasklog'}, {$set: {maxherolv: maxherolv, herocolor: color}}, {upsert: true}); - //G.redis.set('hero', call.uid, kvList); - let recLshd = await G.mongodb.collection('playerInfo', 'lshd_hero').findOne({ uid: call.conn.uid, type: 'lshd_hero' diff --git a/src/api_s2c/hero/ApiLvUp.ts b/src/api_s2c/hero/ApiLvUp.ts index 6e52ad4..a631751 100644 --- a/src/api_s2c/hero/ApiLvUp.ts +++ b/src/api_s2c/hero/ApiLvUp.ts @@ -36,23 +36,3 @@ export default async function (call: ApiCall) { kfjsFun.setHeroLvCount(call) } - - - -// export default async function (call: ApiCall) { -// let hero = await G.redis.get('hero', call.uid, call.req.id); -// if (!hero) return call.errorCode(-1); -// if (hero.lv >= call.conn.gud.lv * 3) return call.errorCode(-2); -// -// let need = HeroShared.getHeroLvUpNeed(hero.heroId, hero.lv); -// await PlayerFun.checkNeedIsMeet(call, need); -// await PlayerFun.cutNeed(call, need); -// await HeroFun.changeHeroAttr(call, hero, { -// lv: hero.lv + 1 -// }); -// event_cszl_record(call.conn.gud, hero.heroId, hero.lv, 'lv') -// -// HongDianChange.sendChangeKey(call.uid, ['taskhd', 'huodonghd']); -// -// call.succ({ lv: hero.lv }); -// } \ No newline at end of file diff --git a/src/api_s2c/hongdian/fun.ts b/src/api_s2c/hongdian/fun.ts index 215f1f0..b00ce8b 100644 --- a/src/api_s2c/hongdian/fun.ts +++ b/src/api_s2c/hongdian/fun.ts @@ -221,27 +221,6 @@ export class HongDianFun { let prize = G.gc.pata[_myData.lv - 1]?.sdprize; _res.val.saodang.show = max - (_myData.saodangNum || 0) > 0 && !!prize _res.show = _res.show || _res.val.saodang.show - // 商店判断 - // 个人爬塔商店购买情况 - // let shopData = await G.redis.get('shop', call.uid, '7'); // 商店编号7,未理清商店id存放的数据表,后续该出尽量改为数据库读取 - - // 12.12策划确定爬塔id7的商店移除,此处商店不再需要红点 - // let shopData = await ShopFun.getShopData(call.uid, "7") - // if (shopData) { - // let {buyNum, shopItems} = shopData - // // 获取爬塔商店商品 - // for (let index in shopItems) { - // let x = shopItems[index] - // if (x.needZCCG > 0 && x.needZCCG < _myData.lv && (buyNum && !buyNum[index])) { - // // 验证是否达到购买条件 - // let isOk = await (await PlayerFun.checkNeedIsMeet(call, x.buyNeed, false)).isOk - // if (isOk) { - // _res.show = true - // _res.val.shopItems.show = true - // } - // } - // } - // } return _res; } diff --git a/src/api_s2c/item/ApiGetList.ts b/src/api_s2c/item/ApiGetList.ts index 14c8c50..cf155ca 100644 --- a/src/api_s2c/item/ApiGetList.ts +++ b/src/api_s2c/item/ApiGetList.ts @@ -4,21 +4,6 @@ import { ReqGetList, ResGetList } from "../../shared/protocols/item/PtlGetList"; import { getItemList } from "../../public/item"; export default async function (call: ApiCall) { - // let list: ResGetList['list'] = {}; - // let kvList: k_v = {}; - // let arrList = await G.mongodb.collection('item').find({ uid: call.uid,num:{$ne:0}}).toArray(); - - // arrList.forEach(v => { - // let d = G.mongodb.conversionIdObj(v); - // kvList[G.formatRedisKey(d.itemId)] = d; - // list[d.itemId] = d; - // }); - - //去掉item Redis相关 - //G.redis.set('item', call.uid, kvList); - - //call.conn.item = list; - let list = await getItemList(call.uid); call.succ({ list: list diff --git a/src/api_s2c/jjc/ApiOpen.ts b/src/api_s2c/jjc/ApiOpen.ts index dca944f..d9743a8 100644 --- a/src/api_s2c/jjc/ApiOpen.ts +++ b/src/api_s2c/jjc/ApiOpen.ts @@ -20,9 +20,6 @@ export default async function (call: ApiCall) { {$set: {resetTime: G.time, receivedArr: [], buyFightNum: 0, useFightNum: 0}}, ); } - - // G.redis.set('jjc', call.uid, data); - data.recordWin = data.recordWin || 0; let enemy = await JJCFun.randomEnemy(call.uid) diff --git a/src/api_s2c/shiwu/ApiGetList.ts b/src/api_s2c/shiwu/ApiGetList.ts index bcdd561..e5de801 100644 --- a/src/api_s2c/shiwu/ApiGetList.ts +++ b/src/api_s2c/shiwu/ApiGetList.ts @@ -13,8 +13,6 @@ export default async function (call: ApiCall) { list[d._id] = d; }); - // G.redis.set('shiwu', call.uid, kvList); - call.succ({ list: list }); diff --git a/src/api_s2c/user/ApiLogin.ts b/src/api_s2c/user/ApiLogin.ts index 6b54a15..560e7fb 100644 --- a/src/api_s2c/user/ApiLogin.ts +++ b/src/api_s2c/user/ApiLogin.ts @@ -128,8 +128,6 @@ async function doLogin(call: ApiCall) { return call.error(lng.user_10); } - //去掉userRedis相关 - //await G.redis.set('user', gud.uid, gud); await initGud(gud.uid, gud); // 修复公会id diff --git a/src/extends.ts b/src/extends.ts index db0d2c1..28a6730 100644 --- a/src/extends.ts +++ b/src/extends.ts @@ -241,12 +241,10 @@ BaseConnection.prototype.refreshPower = async function (this: BaseConnection this.gud?.maxpower){ //记录历史最大战力 //this.gud.maxpower = power; - //G.redis.set('user', this.uid, 'maxpower', power); dbUpdate['maxpower'] = power; } //this.gud.power = power; - //G.redis.set('user', this.uid, 'power', power); setGud(this.uid,dbUpdate); G.mongodb.collection('user').updateOne({ uid: this.uid }, { $set: dbUpdate }); diff --git a/src/globalListener.ts b/src/globalListener.ts index 6a5bec8..24fd6eb 100644 --- a/src/globalListener.ts +++ b/src/globalListener.ts @@ -162,9 +162,6 @@ export function addListener() { XstaskFun.uidTask[uid] = null; delete XstaskFun.uidTask[uid]; } - - //离线时更新该玩家的登出时间 - //G.redis.set('user', uid, 'logoutTime', G.time); setGud(uid,{ logoutTime: G.time }); G.mongodb.collection('user').updateOne({ uid: uid }, { $set: { logoutTime: G.time } }); }); diff --git a/src/public/email.ts b/src/public/email.ts index b068322..a8527b1 100644 --- a/src/public/email.ts +++ b/src/public/email.ts @@ -53,22 +53,7 @@ export class EmailFun { if (email.uid == "system" && email.prizeData) _email.prizeData.isGet = _email.prizelist.includes(uid); delete _email.readlist; - // let emailRead = await G.redis.get('email', uid, _email._id, 'emailRead'); - // let emailRead = await G.redis.get('email', uid, _email._id, 'emailRead'); - - // if (email.uid != "system") { - // - // } else { - // // 全服邮件 数据操作 - // if (email?.dellist?.indexOf(uid) == -1 && gud?.cTime && gud.cTime <= email.createTime) { - // if (_email.prizeData) _email.prizeData.isGet = email?.prizelist.indexOf(uid) != -1 - // kvList[G.formatRedisKey(_email._id)] = _email; - // } - // } } - - // G.redis.set('email', uid, kvList); - let lng = await G.redis.rawGet(`user:lng:${uid}`) return Object.values(kvList).map(i => ({ @@ -76,9 +61,6 @@ export class EmailFun { title: i.lngTitle ? (i.lngTitle[lng] || i.lngTitle['ja']) : i.title, content: i.lngContent ? (i.lngContent[lng] || i.lngContent['ja']) : i.content })); - // } else { - // return Object.values(await G.redis.get('email', uid)); - // } } /**领取邮件 */ @@ -89,7 +71,6 @@ export class EmailFun { let change: k_v = {}; let oids = _ids.map(id => { change[id] = true; - // G.redis.set('email', uid, id, 'prizeData', 'isGet', true); return G.mongodb.conversionId(id); }) @@ -111,11 +92,6 @@ export class EmailFun { // 更改邮件状态为已读-仅限没有奖励的邮件 static async readEmail(uid: string, id: string) { - // G.mongodb.collection('email').updateMany({ uid: uid, id: {$in: ids}}, {$set: { emailRead: true}}) - // 查询系统邮件, - // let systemEmail = await G.mongodb.collection('email').find({ uid: "system", id: {$in: ids}}); - // console.log(systemEmail) - // G.redis.set('email', uid, id, 'emailRead', true); G.mongodb.collection('email').updateOne(G.mongodb.conversionIdObj({ uid: uid, _id: id }), {$set: {emailRead: true}}); @@ -151,11 +127,6 @@ export class EmailFun { /**增加 跨服定时器发送邮件 直接写入数据 (跨服定时器执行检测时会报错)*/ static async addEmail(email: ReqEmail & { createTime?: number; }, isCross: boolean = false) { let {prize, uid, ...e} = email; - // if (!isCross) { - // let existUid = await G.redis.hGet('player:uids', uid) - // if (!existUid) return '玩家uid不存在: ' + uid; - // } - let lng = await G.redis.rawGet(`user:lng:${uid}`) let sendEmail: MsgEmail = { @@ -218,7 +189,6 @@ export class EmailFun { if (isCross) return _id sendEmail._id = _id; - // G.redis.set('email', uid, _id, sendEmail); G.server.sendMsgByUid(uid, 'msg_s2c/Email', sendEmail); return _id; @@ -260,8 +230,6 @@ export class EmailFun { })).insertedId.toHexString(); sendEmail._id = _id; - // let conns = G.server.connections; - // G.redis.set('email', uid, _id, sendEmail); G.server.broadcastMsg('msg_s2c/Email', sendEmail); return _id; diff --git a/src/public/equip.ts b/src/public/equip.ts index 0cfba4e..534f2be 100644 --- a/src/public/equip.ts +++ b/src/public/equip.ts @@ -27,9 +27,6 @@ export class EquipFun { Object.assign(equip, change); - // for (let k in change) { - // G.redis.set('equip', call.uid, equip._id, k as keyof CollectionEquip, change[k]); - // } G.mongodb.collection('equip').updateOne({uid: call.uid, _id: new ObjectId(equip._id)}, {$set: {...change}}); call.addEventMsg('msg_s2c/EquipChange', equip._id, change); } diff --git a/src/public/fight.ts b/src/public/fight.ts index c2388b5..2e99911 100644 --- a/src/public/fight.ts +++ b/src/public/fight.ts @@ -135,16 +135,9 @@ export class FightFun { G.mongodb.collection('fightLog').insertOne({uid, type, ...result}) - // if (await G.redis.type('fightLog', type, uid) == null) await G.redis.set('fightLog', type, uid, []); - - // G.redis.arrAppend('fightLog', type, uid, result).then(len => { - // if (len > maxLen) G.redis.arrPop('fightLog', type, uid, 0); - // }); } static async readLog(uid: string, type: string, len = 20) { - // return await G.redis.get('fightLog', type, uid) || []; - return await G.mongodb.collection('fightLog').find({uid, type}).limit(len).toArray() || [] } } \ No newline at end of file diff --git a/src/public/gonghui/gh.ts b/src/public/gonghui/gh.ts index 7676982..99d1206 100644 --- a/src/public/gonghui/gh.ts +++ b/src/public/gonghui/gh.ts @@ -192,7 +192,6 @@ export class GH { * 公会申请审批 */ async apply(...p: string[]) { - //let players = await G.redis.gets('user', ...p.map(u => [u] as [string])); let players = await G.mongodb.find('user',{uid:{$in:p}}); for (let i=0;i [p.uid] as [string])); - // let players = await G.mongodb.find('user',{uid:{$in: this.data.players}}); let uids = this.data.players.map(p => p.uid); let players = await G.mongodb.collection('user').find({uid:{$in: uids}}).toArray(); diff --git a/src/public/gonghui/manage.ts b/src/public/gonghui/manage.ts index d1015c4..e7583ae 100644 --- a/src/public/gonghui/manage.ts +++ b/src/public/gonghui/manage.ts @@ -133,7 +133,6 @@ export class GHManage { } this.countInterval = 0; let list:k_v = await this.getGHList() - // let list = await G.redis.hGetAll('key') Object.entries(list).forEach(v => { let [_id, gh] = v; if (gh.data?.tanhe && G.time >= gh.data.tanhe.time) { diff --git a/src/public/hero.ts b/src/public/hero.ts index 52e104a..edcffc2 100644 --- a/src/public/hero.ts +++ b/src/public/hero.ts @@ -24,10 +24,6 @@ export class HeroFun { hero.zhanli = HeroShared.getHeroZhanLi(hero, call.otherBuff, Object.values(call.conn.gud.heroPos).indexOf(hero._id)); change.zhanli = hero.zhanli; - // for (let k in change) { - // await G.redis.set('hero', call.uid, hero._id, k as any, change[k]); - // } - await G.mongodb.collection('hero').updateOne({uid: call.uid, _id: new ObjectId(hero._id)}, { $set: { ...change @@ -41,13 +37,10 @@ export class HeroFun { /**获取英雄 */ static async getHero(call: call, oid: string) { - //let data = await G.redis.get('hero', call.uid, oid); - //if (!data) { // 如果redis中的hero数据被清理掉 直接查询数据库 - let {_id, ...info} = await G.mongodb.collection("hero").findOne({ - _id: G.mongodb.conversionId(oid) - }) - let data = Object.assign({_id: _id.toHexString()}, info) - //} + let {_id, ...info} = await G.mongodb.collection("hero").findOne({ + _id: G.mongodb.conversionId(oid) + }) + let data = Object.assign({_id: _id.toHexString()}, info) return data } diff --git a/src/public/pay.ts b/src/public/pay.ts index fcb2c5f..fb6fc57 100644 --- a/src/public/pay.ts +++ b/src/public/pay.ts @@ -189,7 +189,6 @@ export class PayFun { let conf: any = await this.getConf(payId, payArgs); let prize = [...conf.prize]; - //let player = await G.redis.get('user', uid); let player = await getGud(uid); if (conf.firstPayPrize.length > 0) { diff --git a/src/public/player.ts b/src/public/player.ts index b8f5bf5..00caf78 100644 --- a/src/public/player.ts +++ b/src/public/player.ts @@ -228,9 +228,6 @@ export class PlayerFun { } static async changeAttr(uid: string, change: Partial) { - //for (let k in change) { - //G.redis.set('user', uid, k as any, change[k]); - //} setGud(uid, change); G.mongodb.collection('user').updateOne({uid: uid}, {$set: change}); @@ -307,9 +304,6 @@ export class PlayerFun { firstTime: upObj.update.$setOnInsert.firstTime, lastTime: upObj.update.$setOnInsert.firstTime }; - //去掉item Redis相关 - //G.redis.set('item', call.uid, atn.t, data); - G.mongodb.collection('item').updateOne(upObj.filter, upObj.update, upObj.options); call.addEventMsg('msg_s2c/ItemChange', atn.t, data); addGameLog(call.uid, "_itemChange", {"additem": 1}, { @@ -320,26 +314,14 @@ export class PlayerFun { } else { if (item.num + atn.n <= 0) { await Promise.all([ - //去掉item Redis相关 - //G.redis.del('item', call.uid, atn.t), - G.mongodb.collection('item').deleteOne({uid: call.uid, itemId: atn.t}) ]); - //await G.redis.del('item', call.uid, atn.t); - //await G.mongodb.collection('item').deleteOne({uid: call.uid, itemId: atn.t}); call.addEventMsg('msg_s2c/ItemChange', atn.t, {num: 0}); addGameLog(call.uid, "_itemChange", {"delitem": 1}, {"itemId": atn.t}) } else { await Promise.all([ - ////去掉item Redis相关 - //G.redis.set('item', call.uid, atn.t, 'lastTime', upObj.update.$set.lastTime), - //G.redis.numIncrBy('item', call.uid, atn.t, 'num', atn.n), - G.mongodb.collection('item').updateOne(upObj.filter, upObj.update, upObj.options) ]); - // await G.redis.set('item', call.uid, atn.t, 'lastTime', upObj.update.$set.lastTime); - // await G.redis.numIncrBy('item', call.uid, atn.t, 'num', atn.n); - // await G.mongodb.collection('item').updateOne(upObj.filter, upObj.update, upObj.options); call.addEventMsg('msg_s2c/ItemChange', atn.t, { num: item.num + atn.n, lastTime: upObj.update.$set.lastTime @@ -381,11 +363,6 @@ export class PlayerFun { let id = result.insertedIds[key].toHexString(); let {_id, ...ops} = v; - // G.redis.set('equip', call.uid, id, { - // _id: id, - // ...ops - // }); - Wjjl.setVal(call.uid, `has_equip_color_${G.gc.equip[ops.equipId].colour}`, 1, false); call.addEventMsg('msg_s2c/EquipChange', id, { @@ -458,19 +435,6 @@ export class PlayerFun { let id = result.insertedIds[key].toHexString(); let {_id, ...ops} = v; - //https://www.codenong.com/53116318/ - //新号创建时,hero下默认没有uid开头的key,这里会触发(error) ERR missing key at non-terminal path level错误 - //hero/apiGetList里会G.redis.set('hero', call.uid, kvList); - //在这之后再执行下面的代码则不会报错 - - // if (await G.redis.type('hero', call.uid) != null) { - // G.redis.set('hero', call.uid, id, { - // _id: id, - // ...ops - // }); - // } - - call.addEventMsg('msg_s2c/HeroChange', id, { _id: id, ...ops @@ -541,12 +505,6 @@ export class PlayerFun { insertData.forEach((v, key) => { let id = result.insertedIds[key].toHexString(); let {_id, ...ops} = v; - - // G.redis.set('shiwu', call.uid, id, { - // _id: id, - // ...ops - // }); - call.addEventMsg('msg_s2c/ShiwuChange', id, { _id: id, ...ops @@ -565,7 +523,6 @@ export class PlayerFun { */ static async cutShiwu(call: call, _idArr: string[]) { for (let _id of _idArr) { - // G.redis.del('shiwu', call.uid, _id); G.mongodb.collection('shiwu').deleteOne({uid: call.uid, _id: new ObjectId(_id)}); call.addEventMsg('msg_s2c/ShiwuChange', _id, {num: 0}); addGameLog(call.uid, "_cutShiwu", {}, {_id: _id}) diff --git a/src/public/scheduler/scheduler_newDay.ts b/src/public/scheduler/scheduler_newDay.ts index 9014647..59240aa 100644 --- a/src/public/scheduler/scheduler_newDay.ts +++ b/src/public/scheduler/scheduler_newDay.ts @@ -47,9 +47,6 @@ export class SchedulerNewDayLocalCtor extends Scheduler { ...add } }); - // for (let k in add) { - // G.redis.set('user', gud.uid, k as any, add[k] as any); - // } setGud(gud.uid,add); } G.server.sendMsgByUid(gud.uid, 'msg_s2c/PlayerChange', gud) diff --git a/src/public/scheduler/scheduler_wzry.ts b/src/public/scheduler/scheduler_wzry.ts index 02d3a8a..0f78bf7 100644 --- a/src/public/scheduler/scheduler_wzry.ts +++ b/src/public/scheduler/scheduler_wzry.ts @@ -545,41 +545,6 @@ export class SchedulerWzryendDel extends SchedulerWzryAutoBaoMing { } } - -// export class SchedulerWzrycrossEmail extends SchedulerWzryAutoBaoMing { -// id: schedulerType = 'crosseamil_wzry'; -// //每天晚上的20:15分,从跨服里拉取邮件数据到本地 -// time = 72900; -// name = '拉跨服邮件到本服定时器(每天20:15)'; -// type = 'day'; -// -// async start() { -// let _res = await G.clientCross.callApi('wzry/WzFightData', { uid: '', isemail: true }); -// if (_res.isSucc && Object.keys(_res.res.crossEmail).length) { -// let crossEmail = _res.res.crossEmail -// let delEmail = [] -// for (let index = 0; index < crossEmail.length; index++) { -// const element = crossEmail[index]; -// let _prize = element?.prizeData?.prize || [] -// if (element?.prizeData) delete element.prizeData -// element["prize"] = _prize -// if (element.uid == "system") { -// delEmail.push(element._id) -// delete element._id -// EmailFun.addQuanFuEmail(element) -// -// } else if ( await G.redis.hGet('player:uids', element.uid)) { -// delEmail.push(element._id) -// delete element._id -// EmailFun.addEmail(element) -// } -// } -// await G.clientCross.callApi('wzry/UpdateFight', { uid: '', isdelemail: { isdel: true, email: delEmail } }) -// } -// await this.record(); -// } -// } - // 分组 export async function wzrygroup(userList) { let _u = shuffle(userList) diff --git a/src/public/shiwu.ts b/src/public/shiwu.ts index e05018e..0e08382 100644 --- a/src/public/shiwu.ts +++ b/src/public/shiwu.ts @@ -66,10 +66,6 @@ export class ShiwuFun { } } } - - // for (let k in change) { - // G.redis.set('shiwu', call.uid, shiwu._id, k as keyof shiwuType, change[k]); - // } G.mongodb.collection('shiwu').updateOne( {uid: call.uid, _id: new ObjectId(shiwu._id)}, {$set: {...change}} ); diff --git a/src/public/shop.ts b/src/public/shop.ts index a8c8e9e..f212ce0 100644 --- a/src/public/shop.ts +++ b/src/public/shop.ts @@ -47,16 +47,6 @@ export class ShopFun { return shopItems.filter(s => s.openDay <= sDay); } - /**修改商店数据 */ - // static async changeShopData(rId: string, shopId: string, shopData: Partial, change: Partial) { - // - // Object.assign(shopData, change); - // - // for (let k in change) { - // G.redis.set('shop', rId, shopId, k as keyof CollectionShop, change[k]); - // } - // } - static async changeShopData(uid: string, shopId: string, change: Partial) { let where = {uid: uid, shopId: shopId} G.mongodb.collection("shop").updateOne(where, {$set: change}) @@ -120,17 +110,6 @@ export class ShopFun { return shopData } - - /**修改工会商店数据 */ - // static async changeGHShopData(call: ApiCall, shopId: string, shopData: Partial, change: Partial) { - // - // Object.assign(shopData, change); - // - // for (let k in change) { - // G.redis.set('shop', call.conn.gud.ghId, shopId, k as keyof CollectionShop, change[k]); - // } - // } - static async changeGHShopData(ghid: string, shopId: string, change: Partial) { this.changeShopData(ghid, shopId, change) } diff --git a/src/public/user.ts b/src/public/user.ts index 55fcd89..bc7dd6c 100644 --- a/src/public/user.ts +++ b/src/public/user.ts @@ -202,10 +202,6 @@ export class UserFun { ...add } }); - - // for (let k in add) { - // G.redis.set('user', gud.uid, k as any, add[k] as any); - // } setGud(gud.uid, add); } @@ -266,18 +262,12 @@ export class UserFun { } static async getGud(uid: string) { - //return await G.redis.get('user', uid); return await getGud(uid); } /**激活头像框 */ static async activeHeadFrame(uid: string, k: string, v: number) { let gud: player; - // if (G.server.uid_connections[uid]) { - // gud = G.server.uid_connections[uid].gud; - // } else { - // gud = await G.redis.get('user', uid); - // } gud = await getGud(uid); let change = false; @@ -325,11 +315,6 @@ export class UserFun { /**激活聊天框 */ static async activeChatFrame(uid: string, k: string, v: number) { let gud: player; - // if (G.server.uid_connections[uid]) { - // gud = G.server.uid_connections[uid].gud; - // } else { - // gud = await G.redis.get('user', uid); - // } gud = await getGud(uid); let change = false; @@ -377,11 +362,6 @@ export class UserFun { /**激活造型 */ static async activeModel(uid: string, k: string, v: number) { let gud: player; - // if (G.server.uid_connections[uid]) { - // gud = G.server.uid_connections[uid].gud; - // } else { - // gud = await G.redis.get('user', uid); - // } gud = await getGud(uid); let change = false; diff --git a/src/setStartAfther.ts b/src/setStartAfther.ts index 2497190..ba3f732 100644 --- a/src/setStartAfther.ts +++ b/src/setStartAfther.ts @@ -94,13 +94,6 @@ export async function startAfter() { arr.forEach(async u => G.redis.hSet('player:uids', u.uid, 1)) }); - // G.mongodb.collection('payLog').find({}).toArray().then(arr => { - // arr.forEach(a => { - // let { _id, uid, ...logs } = a; - // G.redis.hSet('player:payLog', uid, logs) - // }); - // }); - } else if (G.argv.serverType == 'cross') { RankKbzz.init(); diff --git a/src/setWs.ts b/src/setWs.ts index f5af54c..adc7f4b 100644 --- a/src/setWs.ts +++ b/src/setWs.ts @@ -182,18 +182,6 @@ function setWs(server: WsServer) { if (node.call.service.name == 'user/Login' && node.return.isSucc) { //玩家uid已经登陆在线 通知账号在其他地方登录 const uid = node.return.res.gud.uid; - // const loginConn = server.uid_connections[uid]; - - // let checkPid = await G.redis.hGet("uid2processId", uid); - // if (checkPid && ~~checkPid == process.pid && loginConn) { - // // 本进程踢线 - // loginConn.sendMsg('msg_s2c/OtherLogin', loginConn.ip).then(v => { - // loginConn.close('otherLogin'); - // }); - // } else if (checkPid) { - // // 跨进程踢线,注意这里是异步的 - // await G.server.sendMsgByUid(uid, 'msg_s2c/OtherLogin', '1', String(process.pid)); - // } server.uid_connections[uid] = node.call.conn; setUidProcessId(uid); } diff --git a/src/test.ts b/src/test.ts index 8a12f34..dc482ec 100644 --- a/src/test.ts +++ b/src/test.ts @@ -42,15 +42,6 @@ async function start() { // let c = await getItemNum('0_64e7024f1b2a9acc9e6900fb',['27382','12']); // console.log('c',c) - redisClient.del([ - G.redis.fromatKey('item'), - G.redis.fromatKey('equip'), - G.redis.fromatKey('hero'), - G.redis.fromatKey('shiwu'), - G.redis.fromatKey('gbtx'), - G.redis.fromatKey('dxlt'), - ]) -} //定义全局变量 ctor(); From 91c2827b332263e460651cd98c1eced233a23265 Mon Sep 17 00:00:00 2001 From: dy Date: Mon, 25 Dec 2023 20:27:39 +0800 Subject: [PATCH 18/38] =?UTF-8?q?fix=20=E8=87=AA=E9=80=89=E6=94=AF?= =?UTF-8?q?=E4=BB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/public/pay.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/public/pay.ts b/src/public/pay.ts index fcb2c5f..a8c75ec 100644 --- a/src/public/pay.ts +++ b/src/public/pay.ts @@ -251,7 +251,7 @@ export class PayFun { console.log("Christmasfun.payChristmas Error", e); } - if (payArgs.selectPrize) { + if (payArgs && payArgs?.selectPrize) { let selectPrize = await G.ioredis.get(`pay:${payId}:${player.uid}`); if (selectPrize) { prize.push(...JSON.parse(selectPrize)) @@ -422,7 +422,7 @@ export class PayFun { * payArgs里传相应参数,selectList选择的奖励列表 * 往后所有自选类型,走这个方法,配置格式同4、14 */ - if (payArgs.htype && payArgs.selectList) { + if (payArgs && payArgs?.htype && payArgs?.selectList) { let call = this.getCall(player) // @ts-ignore let _hdInfo = (await HuoDongFun.gethdList(call, payArgs.htype))[0] From 905ed441e41eabfd8a3f650a824306f564e5a99e Mon Sep 17 00:00:00 2001 From: dy Date: Mon, 25 Dec 2023 20:54:59 +0800 Subject: [PATCH 19/38] =?UTF-8?q?redis=E4=B8=B4=E6=97=B6=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/module/redis.ts | 35 +++++++++++++++++------------------ src/public/gud.ts | 18 ++++++++++-------- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/src/module/redis.ts b/src/module/redis.ts index 4e14ff2..e62562b 100644 --- a/src/module/redis.ts +++ b/src/module/redis.ts @@ -1,21 +1,20 @@ -import { PeiJian } from '../shared/protocols/peijian/PtlGetList'; -import { CollectionDxlt } from './collection_dxlt'; -import { CollectionEmail } from './collection_email'; -import { CollectionEquip } from './collection_equip'; -import { CollectionFightLog } from './collection_fightLog'; -import { CollectionGBTX } from './collection_gbtx'; -import { CollectionHero } from './collection_hero'; -import { CollectionItem } from './collection_item'; -import { CollectionJJC } from './collection_jjc'; -import { CollectionShiwu } from './collection_shiwu'; -import { CollectionShop } from './collection_shop'; -import { CollectionTanXian } from './collection_tanxian'; -import { CollectionUser } from './collection_user'; +import {PeiJian} from '../shared/protocols/peijian/PtlGetList'; +import {CollectionDxlt} from './collection_dxlt'; +import {CollectionEmail} from './collection_email'; +import {CollectionEquip} from './collection_equip'; +import {CollectionFightLog} from './collection_fightLog'; +import {CollectionGBTX} from './collection_gbtx'; +import {CollectionHero} from './collection_hero'; +import {CollectionItem} from './collection_item'; +import {CollectionJJC} from './collection_jjc'; +import {CollectionShiwu} from './collection_shiwu'; +import {CollectionShop} from './collection_shop'; +import {CollectionTanXian} from './collection_tanxian'; +import {CollectionUser} from './collection_user'; import {payLog} from '../shared/protocols/pay/PtlGetList'; -import { rankInfo } from '../shared/protocols/type'; -import { CollectionFriend } from '../module/collection_friend'; -import { CollectionGongHui } from '../module/collection_gonghui'; - +import {rankInfo} from '../shared/protocols/type'; +import {CollectionFriend} from '../module/collection_friend'; +import {CollectionGongHui} from '../module/collection_gonghui'; export type sortEd = { @@ -29,7 +28,7 @@ export type sortEd = { export type RedisCollections1 = { user: CollectionUser; gbtx: CollectionGBTX; - tanxian: Omit; + tanxian: Omit | any; dxlt: CollectionDxlt; jjc: CollectionJJC; }; diff --git a/src/public/gud.ts b/src/public/gud.ts index c4a4dda..7ff21d5 100644 --- a/src/public/gud.ts +++ b/src/public/gud.ts @@ -18,15 +18,17 @@ export async function clearGud(uid) { G.ioredis.del(`gudVersion:${uid}_pid`); G.ioredis.del(`gudVersion:${uid}_ver`); } - - if(await G.redis.type('tanxian', uid)){ - console.log('清空tanxian Redis',uid); - G.redis.del("tanxian",uid); + + if (await G.redis.type('tanxian', uid)) { + console.log('清空tanxian Redis', uid); + // G.redis.del("tanxian", uid); + G.redis.set('tanxian', uid, {}) } - try{ - console.log('清空friend:list Redis',uid); - G.redis.hDel("friend:list",uid); - }catch(e){ + try { + // console.log('清空friend:list Redis', uid); + // G.redis.hDel("friend:list", uid); + // G.redis.hSet('friend:list', uid, {}) + } catch (e) { } }; From 9c4ba3a3342bfa8ff4376a8dec4fe3e86a61bd05 Mon Sep 17 00:00:00 2001 From: dy Date: Tue, 26 Dec 2023 09:47:06 +0800 Subject: [PATCH 20/38] fix --- src/test.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test.ts b/src/test.ts index dc482ec..5c67607 100644 --- a/src/test.ts +++ b/src/test.ts @@ -42,6 +42,7 @@ async function start() { // let c = await getItemNum('0_64e7024f1b2a9acc9e6900fb',['27382','12']); // console.log('c',c) +} //定义全局变量 ctor(); From ba364e13f6ddcab688392ee83a9fb93b56fd6f76 Mon Sep 17 00:00:00 2001 From: chenkai Date: Tue, 26 Dec 2023 10:24:35 +0800 Subject: [PATCH 21/38] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=A2=86?= =?UTF-8?q?=E4=B8=BB=E6=9D=A5=E8=A2=AD=E6=8E=A5=E5=8F=A3=E5=9B=9E=E5=8F=82?= =?UTF-8?q?=E7=BC=BA=E5=B0=91=20num=20=E5=AD=97=E6=AE=B5=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/public/lingzhulaixi.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/public/lingzhulaixi.ts b/src/public/lingzhulaixi.ts index eb4e6a7..dc27050 100644 --- a/src/public/lingzhulaixi.ts +++ b/src/public/lingzhulaixi.ts @@ -74,7 +74,7 @@ export class LingZhuLaiXifun { // 隔天清零 if (_myData && PublicShared.chkSameDate(_myData.time, G.time)) { _res = { - num: _myData.num, + num: _myData.num || 0, time: _myData.time, maxdps: _myData.maxdps } From 7537f108ad11a6faab0fb37e59935433306ae8a9 Mon Sep 17 00:00:00 2001 From: ciniao <4041990@qq.com> Date: Tue, 26 Dec 2023 10:32:27 +0800 Subject: [PATCH 22/38] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=B4=A2=E5=BC=95?= =?UTF-8?q?=EF=BC=8C=E8=A7=A3=E5=86=B3=E6=85=A2=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/setMongodb.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/setMongodb.ts b/src/setMongodb.ts index ec7356a..7860f9c 100644 --- a/src/setMongodb.ts +++ b/src/setMongodb.ts @@ -93,6 +93,9 @@ const indexs: Partial<{ [k in keyof MongodbCollections]: IndexDescription[] }> = }, { key: {uid: 1} + }, + { + key: {type: 1} } ], pata: [ From 2a78f515b1644383ac729ba53e9a040fc2a7c791 Mon Sep 17 00:00:00 2001 From: chenkai Date: Tue, 26 Dec 2023 11:50:17 +0800 Subject: [PATCH 23/38] =?UTF-8?q?fix:=20=E5=A4=A7=E4=B9=B1=E6=96=97?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=A7=AF=E5=88=86=E4=B8=8A=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api_s2c/wzry/ApiDldFight.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/api_s2c/wzry/ApiDldFight.ts b/src/api_s2c/wzry/ApiDldFight.ts index abe561f..1f1b56e 100644 --- a/src/api_s2c/wzry/ApiDldFight.ts +++ b/src/api_s2c/wzry/ApiDldFight.ts @@ -7,6 +7,8 @@ import { ReqDldFight, ResDldFight } from "../../shared/protocols/wzry/PtlDldFigh import { PublicShared } from "../../shared/public/public"; import { HongDianChange } from "../hongdian/fun"; +const maxScore = 269; // 积分上限 + export default async function (call: ApiCall) { let status = await WangZheRongYaofun.getWangZheStatus(); if (status.status != 3) { @@ -41,6 +43,10 @@ export default async function (call: ApiCall) { let _jifen = _myFight.jifen; _myFight.jifen = _myFight.jifen + await WangZheRongYaofun.getMyScore(dldfight); + // 添加积分上限 (策划要求) + if (_myFight.jifen > maxScore) { + _myFight.jifen = maxScore; + } // 设置数据 let _r = await WangZheRongYaofun.setWzryDldFight(call, _myFight); From 4a9f5cb02e73f6abf6aadf8e4a76edbb7e304796 Mon Sep 17 00:00:00 2001 From: chenkai Date: Tue, 26 Dec 2023 13:54:49 +0800 Subject: [PATCH 24/38] =?UTF-8?q?fix:=20DldFight=20=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=8E=A9=E5=AE=B6=E9=94=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api_s2c/wzry/ApiDldFight.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/api_s2c/wzry/ApiDldFight.ts b/src/api_s2c/wzry/ApiDldFight.ts index 1f1b56e..bb98360 100644 --- a/src/api_s2c/wzry/ApiDldFight.ts +++ b/src/api_s2c/wzry/ApiDldFight.ts @@ -8,8 +8,15 @@ import { PublicShared } from "../../shared/public/public"; import { HongDianChange } from "../hongdian/fun"; const maxScore = 269; // 积分上限 +const lockPrefix = 'lock:DldFight:'; export default async function (call: ApiCall) { + const lockKey = lockPrefix + call.uid; + const gotLock = await G.ioredis.setnx(lockKey, 1); + if (!gotLock) { + return call.errorCode(-101); // -101 并发请求, 告知客户端稍后再试 request_too_fast + } + await G.ioredis.pexpire(lockKey, 500); // 设置 ttl 避免死锁. 策划要求: 500ms let status = await WangZheRongYaofun.getWangZheStatus(); if (status.status != 3) { // 未到大乱斗时间 @@ -75,7 +82,7 @@ export default async function (call: ApiCall) { _mydata.jifen = _myFight.jifen; HongDianChange.sendChangeKey(call.uid, ['wzryhd']); - + await G.ioredis.del(lockKey); call.succ({ mydata: _mydata, result: result, From 5f81ba11898461d042eb728727ca667e48334676 Mon Sep 17 00:00:00 2001 From: ciniao <4041990@qq.com> Date: Tue, 26 Dec 2023 14:03:15 +0800 Subject: [PATCH 25/38] =?UTF-8?q?=E6=9B=BF=E6=8D=A2tanxian=E7=9A=84redis?= =?UTF-8?q?=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/public/gud.ts | 14 ++------------ src/public/tanxian.ts | 15 ++++++++------- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/src/public/gud.ts b/src/public/gud.ts index 7ff21d5..f861e1f 100644 --- a/src/public/gud.ts +++ b/src/public/gud.ts @@ -19,18 +19,8 @@ export async function clearGud(uid) { G.ioredis.del(`gudVersion:${uid}_ver`); } - if (await G.redis.type('tanxian', uid)) { - console.log('清空tanxian Redis', uid); - // G.redis.del("tanxian", uid); - G.redis.set('tanxian', uid, {}) - } - try { - // console.log('清空friend:list Redis', uid); - // G.redis.hDel("friend:list", uid); - // G.redis.hSet('friend:list', uid, {}) - } catch (e) { - - } + //清空探险缓存 + G.ioredis.del(`tanxian:${uid}`); }; /** diff --git a/src/public/tanxian.ts b/src/public/tanxian.ts index 00c91b8..3605819 100644 --- a/src/public/tanxian.ts +++ b/src/public/tanxian.ts @@ -9,21 +9,22 @@ export class TanXianFun { static async changeData(call: ApiCall, change: dataChange) { G.mongodb.collection('tanxian').updateOne({ uid: call.uid }, { $set: { ...change } }); - - for (let k in change) { - G.redis.set('tanxian', call.uid, k as any, change[k]); - } + let data = await this.getData(call); + Object.assign(data, change); + G.ioredis.set(`tanxian:${call.uid}`, JSON.stringify(data)); } /**获取探险数据 */ static async getData(call: ApiCall, cache = true) { - if (cache && await G.redis.type('tanxian', call.uid) != null) return await G.redis.get('tanxian', call.uid); + if(cache){ + let data = await G.ioredis.get(`tanxian:${call.uid}`); + if (data) return JSON.parse(data); + } let { _id, uid, ...data } = await G.mongodb.collection('tanxian').findOne({ uid: call.uid }); if (!data.eventTime) { data.eventTime = G.time; G.mongodb.collection('tanxian').updateOne({ uid: call.uid }, { $set: { eventTime: G.time } }); } - - await G.redis.set('tanxian', call.uid, data); + await G.ioredis.set(`tanxian:${call.uid}`, JSON.stringify(data)); return data; } /**获取快速探险次数 */ From da35c5ecdeddf814a7d9e1de9e3a9aeb993420ad Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 26 Dec 2023 14:10:21 +0800 Subject: [PATCH 26/38] =?UTF-8?q?=E5=95=86=E5=BA=97=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/public/shop.ts | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/public/shop.ts b/src/public/shop.ts index f212ce0..85b7e16 100644 --- a/src/public/shop.ts +++ b/src/public/shop.ts @@ -1,11 +1,11 @@ -import {CollectionShop} from '../module/collection_shop'; -import {ResOpen, shopItem} from '../shared/protocols/shop/PtlOpen'; -import {PublicShared} from '../shared/public/public'; -import {ShiwuFun} from './shiwu'; +import { CollectionShop } from '../module/collection_shop'; +import { ResOpen, shopItem } from '../shared/protocols/shop/PtlOpen'; +import { PublicShared } from '../shared/public/public'; +import { ShiwuFun } from './shiwu'; type shopData = ResOpen; type changeData = { - [k in keyof shopData]: shopData[k] + [k in keyof (shopData & { version?: number | string })]: (shopData & { version?: number | string })[k] }; export class ShopFun { @@ -48,13 +48,13 @@ export class ShopFun { } static async changeShopData(uid: string, shopId: string, change: Partial) { - let where = {uid: uid, shopId: shopId} - G.mongodb.collection("shop").updateOne(where, {$set: change}) + let where = { uid: uid, shopId: shopId } + G.mongodb.collection("shop").updateOne(where, { $set: change }) } static async initShopData(uid: string, shopId: string) { - let gud = await G.mongodb.collection("user").findOne({uid: uid}, { - projection: {lv: 1, _id: 0} + let gud = await G.mongodb.collection("user").findOne({ uid: uid }, { + projection: { lv: 1, _id: 0 } }) let lv = gud?.lv || 1; @@ -69,7 +69,7 @@ export class ShopFun { } return (await G.mongodb.collection("shop").findOneAndUpdate( - {uid: uid, shopId: shopId}, + { uid: uid, shopId: shopId }, { $set: { buyNum: {}, @@ -80,7 +80,7 @@ export class ShopFun { lastFreeRefreshTime: G.time } }, - {upsert: true, returnDocument: 'after'} + { upsert: true, returnDocument: 'after' } )).value } @@ -101,11 +101,12 @@ export class ShopFun { if (shopConf.freeRefreshInterval > 0 && G.time - shopData.lastFreeRefreshTime >= shopConf.freeRefreshInterval) { shopData.useFreeRefreshNum = 0; shopData.lastFreeRefreshTime = G.time; - await this.changeShopData(uid, shopId, {useFreeRefreshNum: 0, lastFreeRefreshTime: G.time}); + await this.changeShopData(uid, shopId, { useFreeRefreshNum: 0, lastFreeRefreshTime: G.time }); } if (shopConf.version && shopConf.version != shopData.version) { - await this.changeShopData(uid, shopId, {shopItems: this.getShopItems(shopId, lv)}) + shopData.shopItems = this.getShopItems(shopId, lv); + await this.changeShopData(uid, shopId, { shopItems: shopData.shopItems, version: shopConf.version }); } return shopData From c0103565a75901e71a059b5300fbd93dfeca1b08 Mon Sep 17 00:00:00 2001 From: chenkai Date: Tue, 26 Dec 2023 14:14:15 +0800 Subject: [PATCH 27/38] =?UTF-8?q?fix:=20=E8=B0=83=E6=95=B4=E5=9C=B0?= =?UTF-8?q?=E4=B8=8B=E6=93=82=E5=8F=B0=20fight=20=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E7=9A=84=E5=A4=9A=E8=AF=AD=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api_s2c/dixialeitai/ApiFight.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api_s2c/dixialeitai/ApiFight.ts b/src/api_s2c/dixialeitai/ApiFight.ts index 975dfa5..a70ac5c 100644 --- a/src/api_s2c/dixialeitai/ApiFight.ts +++ b/src/api_s2c/dixialeitai/ApiFight.ts @@ -12,7 +12,7 @@ export default async function (call: ApiCall) { let change: Partial = {}; let data = await DxltFun.getData(call); - if (data.killBoss >= G.gc.dxlt_com.dayFightLayer) return call.error(globalThis.lng.dixialeitai_2); + if (data.killBoss >= G.gc.dxlt_com.dayFightLayer) return call.error(globalThis.lng.dixialeitai_13); if (G.gc.dxlt_layer[data.curLayer].type != 1) return call.error(globalThis.lng.dixialeitai_3); if (data.over) return call.error(globalThis.lng.dixialeitai_4); if (!data.heros[call.req]) return call.error(globalThis.lng.dixialeitai_5); From 58abdd2fd4fcf55bea1897731e2605f48f561343 Mon Sep 17 00:00:00 2001 From: chenkai Date: Tue, 26 Dec 2023 14:22:07 +0800 Subject: [PATCH 28/38] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=E5=A4=9A?= =?UTF-8?q?=E8=AF=AD=E8=A8=80=20dixialeitai=5F13?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lng.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lng.ts b/src/lng.ts index f0c9344..dc754fb 100644 --- a/src/lng.ts +++ b/src/lng.ts @@ -131,6 +131,7 @@ class Lng { dixialeitai_10 = "dixialeitai_10"; dixialeitai_11 = "dixialeitai_11"; dixialeitai_12 = "dixialeitai_12"; + dixialeitai_13 = "dixialeitai_13"; email_1 = "email_1"; email_2 = "email_2"; From cd2a54e4315a1b6dbb5936d2b4c928f15c88a3a2 Mon Sep 17 00:00:00 2001 From: ciniao <4041990@qq.com> Date: Tue, 26 Dec 2023 14:33:04 +0800 Subject: [PATCH 29/38] =?UTF-8?q?=E6=9B=B4=E6=8D=A2=E5=9C=B0=E4=B8=8B?= =?UTF-8?q?=E6=93=82=E5=8F=B0=E5=8A=9F=E8=83=BDredis?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api_s2c/dixialeitai/ApiOpen.ts | 3 +-- src/public/dxlt.ts | 10 +++++----- src/public/gud.ts | 3 ++- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/api_s2c/dixialeitai/ApiOpen.ts b/src/api_s2c/dixialeitai/ApiOpen.ts index fd0583f..66f432d 100644 --- a/src/api_s2c/dixialeitai/ApiOpen.ts +++ b/src/api_s2c/dixialeitai/ApiOpen.ts @@ -41,7 +41,6 @@ export default async function (call: ApiCall) { } else { call.succ(data); } - - G.redis.set('dxlt', call.uid, data); + G.ioredis.set(`dxlt:${call.uid}`, JSON.stringify(data)); G.mongodb.collection('dxlt').updateOne({ uid: call.uid }, { $set: { ...data } }); } \ No newline at end of file diff --git a/src/public/dxlt.ts b/src/public/dxlt.ts index 10fddb2..008e62f 100644 --- a/src/public/dxlt.ts +++ b/src/public/dxlt.ts @@ -7,15 +7,15 @@ export class DxltFun { /**修改数据 */ static async changeData(call: ApiCall, change: Partial) { - Object.entries(change).forEach(v => { - G.redis.set('dxlt', call.uid, v[0] as any, v[1]); - }); - G.mongodb.collection('dxlt').updateOne({ uid: call.uid }, { $set: { ...change } }); + let data = await this.getData(call); + Object.assign(data, change); + G.ioredis.set(`dxlt:${call.uid}`, JSON.stringify(data)); + G.mongodb.collection('dxlt').updateOne({ uid: call.uid }, { $set: { ...change } }); return change; } static async getData(call: ApiCall) { - return await G.redis.get('dxlt', call.uid); + return JSON.parse(await G.ioredis.get(`dxlt:${call.uid}`)) ; } /**回退层数 */ static backLayer(data: ResOpen) { diff --git a/src/public/gud.ts b/src/public/gud.ts index f861e1f..15aab84 100644 --- a/src/public/gud.ts +++ b/src/public/gud.ts @@ -19,8 +19,9 @@ export async function clearGud(uid) { G.ioredis.del(`gudVersion:${uid}_ver`); } - //清空探险缓存 + //清空Redis缓存 G.ioredis.del(`tanxian:${uid}`); + G.ioredis.del(`dxlt:${uid}`); }; /** From 884c2570a0db2eaa07eaed7c35db21e1af8bf982 Mon Sep 17 00:00:00 2001 From: chenkai Date: Tue, 26 Dec 2023 14:34:30 +0800 Subject: [PATCH 30/38] =?UTF-8?q?fix:=20=E8=B0=83=E6=95=B4=E9=94=81?= =?UTF-8?q?=E8=B6=85=E6=97=B6=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api_s2c/wzry/ApiDldFight.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api_s2c/wzry/ApiDldFight.ts b/src/api_s2c/wzry/ApiDldFight.ts index bb98360..931c1b1 100644 --- a/src/api_s2c/wzry/ApiDldFight.ts +++ b/src/api_s2c/wzry/ApiDldFight.ts @@ -16,7 +16,7 @@ export default async function (call: ApiCall) { if (!gotLock) { return call.errorCode(-101); // -101 并发请求, 告知客户端稍后再试 request_too_fast } - await G.ioredis.pexpire(lockKey, 500); // 设置 ttl 避免死锁. 策划要求: 500ms + await G.ioredis.expire(lockKey, 1); // 设置 ttl 避免死锁 let status = await WangZheRongYaofun.getWangZheStatus(); if (status.status != 3) { // 未到大乱斗时间 From b67087a3bf85d284d0070c9c6d144d9ff0c831ba Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 26 Dec 2023 16:12:09 +0800 Subject: [PATCH 31/38] =?UTF-8?q?=E4=BF=AE=E6=94=B9api=E8=BF=9B=E7=A8=8B?= =?UTF-8?q?=E9=94=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/setWs.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/setWs.ts b/src/setWs.ts index adc7f4b..372bcc1 100644 --- a/src/setWs.ts +++ b/src/setWs.ts @@ -136,7 +136,7 @@ function setWs(server: WsServer) { //处理API锁,极限情况下只锁10s,防止死锁 //在下方postApiReturnFlow里会解锁 - if (call.conn.apiLock[call.service.name] && new Date().getTime() - call.conn.requstApiTime[call.service.name] < 10000) { + if (call.conn.apiLock[call.service.name] && new Date().getTime() - call.conn.apiLock[call.service.name] < 10000) { call.error('', {code: -100, message: '', time: 0}); return null; } From 0e089582023cdde47964578eca6ce97d70f12529 Mon Sep 17 00:00:00 2001 From: dy Date: Mon, 25 Dec 2023 20:54:59 +0800 Subject: [PATCH 32/38] =?UTF-8?q?redis=E4=B8=B4=E6=97=B6=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/module/redis.ts | 35 +++++++++++++++++------------------ src/public/gud.ts | 18 ++++++++++-------- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/src/module/redis.ts b/src/module/redis.ts index 4e14ff2..e62562b 100644 --- a/src/module/redis.ts +++ b/src/module/redis.ts @@ -1,21 +1,20 @@ -import { PeiJian } from '../shared/protocols/peijian/PtlGetList'; -import { CollectionDxlt } from './collection_dxlt'; -import { CollectionEmail } from './collection_email'; -import { CollectionEquip } from './collection_equip'; -import { CollectionFightLog } from './collection_fightLog'; -import { CollectionGBTX } from './collection_gbtx'; -import { CollectionHero } from './collection_hero'; -import { CollectionItem } from './collection_item'; -import { CollectionJJC } from './collection_jjc'; -import { CollectionShiwu } from './collection_shiwu'; -import { CollectionShop } from './collection_shop'; -import { CollectionTanXian } from './collection_tanxian'; -import { CollectionUser } from './collection_user'; +import {PeiJian} from '../shared/protocols/peijian/PtlGetList'; +import {CollectionDxlt} from './collection_dxlt'; +import {CollectionEmail} from './collection_email'; +import {CollectionEquip} from './collection_equip'; +import {CollectionFightLog} from './collection_fightLog'; +import {CollectionGBTX} from './collection_gbtx'; +import {CollectionHero} from './collection_hero'; +import {CollectionItem} from './collection_item'; +import {CollectionJJC} from './collection_jjc'; +import {CollectionShiwu} from './collection_shiwu'; +import {CollectionShop} from './collection_shop'; +import {CollectionTanXian} from './collection_tanxian'; +import {CollectionUser} from './collection_user'; import {payLog} from '../shared/protocols/pay/PtlGetList'; -import { rankInfo } from '../shared/protocols/type'; -import { CollectionFriend } from '../module/collection_friend'; -import { CollectionGongHui } from '../module/collection_gonghui'; - +import {rankInfo} from '../shared/protocols/type'; +import {CollectionFriend} from '../module/collection_friend'; +import {CollectionGongHui} from '../module/collection_gonghui'; export type sortEd = { @@ -29,7 +28,7 @@ export type sortEd = { export type RedisCollections1 = { user: CollectionUser; gbtx: CollectionGBTX; - tanxian: Omit; + tanxian: Omit | any; dxlt: CollectionDxlt; jjc: CollectionJJC; }; diff --git a/src/public/gud.ts b/src/public/gud.ts index c4a4dda..7ff21d5 100644 --- a/src/public/gud.ts +++ b/src/public/gud.ts @@ -18,15 +18,17 @@ export async function clearGud(uid) { G.ioredis.del(`gudVersion:${uid}_pid`); G.ioredis.del(`gudVersion:${uid}_ver`); } - - if(await G.redis.type('tanxian', uid)){ - console.log('清空tanxian Redis',uid); - G.redis.del("tanxian",uid); + + if (await G.redis.type('tanxian', uid)) { + console.log('清空tanxian Redis', uid); + // G.redis.del("tanxian", uid); + G.redis.set('tanxian', uid, {}) } - try{ - console.log('清空friend:list Redis',uid); - G.redis.hDel("friend:list",uid); - }catch(e){ + try { + // console.log('清空friend:list Redis', uid); + // G.redis.hDel("friend:list", uid); + // G.redis.hSet('friend:list', uid, {}) + } catch (e) { } }; From d6c801db91898452f7c8f0fa92795d4772acabfa Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 26 Dec 2023 14:10:21 +0800 Subject: [PATCH 33/38] =?UTF-8?q?=E5=95=86=E5=BA=97=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/public/shop.ts | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/public/shop.ts b/src/public/shop.ts index a8c8e9e..9c69575 100644 --- a/src/public/shop.ts +++ b/src/public/shop.ts @@ -1,11 +1,11 @@ -import {CollectionShop} from '../module/collection_shop'; -import {ResOpen, shopItem} from '../shared/protocols/shop/PtlOpen'; -import {PublicShared} from '../shared/public/public'; -import {ShiwuFun} from './shiwu'; +import { CollectionShop } from '../module/collection_shop'; +import { ResOpen, shopItem } from '../shared/protocols/shop/PtlOpen'; +import { PublicShared } from '../shared/public/public'; +import { ShiwuFun } from './shiwu'; type shopData = ResOpen; type changeData = { - [k in keyof shopData]: shopData[k] + [k in keyof (shopData & { version?: number | string })]: (shopData & { version?: number | string })[k] }; export class ShopFun { @@ -58,13 +58,13 @@ export class ShopFun { // } static async changeShopData(uid: string, shopId: string, change: Partial) { - let where = {uid: uid, shopId: shopId} - G.mongodb.collection("shop").updateOne(where, {$set: change}) + let where = { uid: uid, shopId: shopId } + G.mongodb.collection("shop").updateOne(where, { $set: change }) } static async initShopData(uid: string, shopId: string) { - let gud = await G.mongodb.collection("user").findOne({uid: uid}, { - projection: {lv: 1, _id: 0} + let gud = await G.mongodb.collection("user").findOne({ uid: uid }, { + projection: { lv: 1, _id: 0 } }) let lv = gud?.lv || 1; @@ -79,7 +79,7 @@ export class ShopFun { } return (await G.mongodb.collection("shop").findOneAndUpdate( - {uid: uid, shopId: shopId}, + { uid: uid, shopId: shopId }, { $set: { buyNum: {}, @@ -90,7 +90,7 @@ export class ShopFun { lastFreeRefreshTime: G.time } }, - {upsert: true, returnDocument: 'after'} + { upsert: true, returnDocument: 'after' } )).value } @@ -111,11 +111,12 @@ export class ShopFun { if (shopConf.freeRefreshInterval > 0 && G.time - shopData.lastFreeRefreshTime >= shopConf.freeRefreshInterval) { shopData.useFreeRefreshNum = 0; shopData.lastFreeRefreshTime = G.time; - await this.changeShopData(uid, shopId, {useFreeRefreshNum: 0, lastFreeRefreshTime: G.time}); + await this.changeShopData(uid, shopId, { useFreeRefreshNum: 0, lastFreeRefreshTime: G.time }); } if (shopConf.version && shopConf.version != shopData.version) { - await this.changeShopData(uid, shopId, {shopItems: this.getShopItems(shopId, lv)}) + shopData.shopItems = this.getShopItems(shopId, lv); + await this.changeShopData(uid, shopId, { shopItems: shopData.shopItems, version: shopConf.version }); } return shopData From 7b7a4486ebe69a8e7aa5535b39fdc169461d9535 Mon Sep 17 00:00:00 2001 From: dy Date: Tue, 26 Dec 2023 14:44:33 +0800 Subject: [PATCH 34/38] shop json --- src/json/shop.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/json/shop.json b/src/json/shop.json index 4e0b020..c27331a 100644 --- a/src/json/shop.json +++ b/src/json/shop.json @@ -2,6 +2,7 @@ "1": { "id": 1, "type": 1, + "version": 1, "name": "wsw_wz_zhsd", "undefined": "杂货店", "openCond": [ @@ -46,6 +47,7 @@ "2": { "id": 2, "type": 5, + "version": 1, "name": "wsw_wz_slsd", "undefined": "势力商店", "openCond": [ @@ -84,6 +86,7 @@ "3": { "id": 3, "type": 6, + "version": 1, "name": "wsw_wz_zzsd", "undefined": "战争商店", "openCond": [ @@ -125,6 +128,7 @@ "4": { "id": 4, "type": 7, + "version": 1, "name": "wsw_wz_spsd", "undefined": "饰品商店", "openCond": [ @@ -169,6 +173,7 @@ "5": { "id": 5, "type": 2, + "version": 1, "name": "intr_shop_name_5", "undefined": "杂货", "openCond": [ @@ -208,6 +213,7 @@ "6": { "id": 6, "type": 2, + "version": 1, "name": "intr_shop_name_6", "undefined": "紫装", "openCond": [ @@ -264,6 +270,7 @@ "8": { "id": 8, "type": 3, + "version": 1, "name": "wsw_wz_rcsc", "undefined": "人才市场", "openCond": [ @@ -327,6 +334,7 @@ "9": { "id": 9, "type": 4, + "version": 1, "name": "wsw_wz_pjsd", "undefined": "配件商店", "openCond": [ @@ -384,6 +392,7 @@ "10": { "id": 10, "type": 8, + "version": 1, "name": "wsw_wz_rysd", "undefined": "荣誉商店", "openCond": [ @@ -427,6 +436,7 @@ "11": { "id": 11, "type": 9, + "version": 1, "name": "wsw_wz_jgsd", "undefined": "军功商店", "openCond": [ @@ -468,6 +478,7 @@ "12": { "id": 12, "type": 11, + "version": 1, "name": "wsw_wz_ltsd", "undefined": "擂台商店", "openCond": [ @@ -499,6 +510,7 @@ "13": { "id": 13, "type": 12, + "version": 1, "name": "wsw_wz_mrjxdh", "undefined": "每日精选兑换商店", "openCond": [ From 9e3d1b92aa0402cd81fd641ddc6dcc73b8b4b8a8 Mon Sep 17 00:00:00 2001 From: dy Date: Tue, 26 Dec 2023 17:02:15 +0800 Subject: [PATCH 35/38] =?UTF-8?q?Revert=20"fix=20=E8=87=AA=E9=80=89?= =?UTF-8?q?=E6=94=AF=E4=BB=98"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 91c2827b332263e460651cd98c1eced233a23265. --- src/public/pay.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/public/pay.ts b/src/public/pay.ts index 39700d4..fb6fc57 100644 --- a/src/public/pay.ts +++ b/src/public/pay.ts @@ -250,7 +250,7 @@ export class PayFun { console.log("Christmasfun.payChristmas Error", e); } - if (payArgs && payArgs?.selectPrize) { + if (payArgs.selectPrize) { let selectPrize = await G.ioredis.get(`pay:${payId}:${player.uid}`); if (selectPrize) { prize.push(...JSON.parse(selectPrize)) @@ -421,7 +421,7 @@ export class PayFun { * payArgs里传相应参数,selectList选择的奖励列表 * 往后所有自选类型,走这个方法,配置格式同4、14 */ - if (payArgs && payArgs?.htype && payArgs?.selectList) { + if (payArgs.htype && payArgs.selectList) { let call = this.getCall(player) // @ts-ignore let _hdInfo = (await HuoDongFun.gethdList(call, payArgs.htype))[0] From d13b9fcae0fdb4bc849ea999f11a866cb7011b1b Mon Sep 17 00:00:00 2001 From: dy Date: Tue, 26 Dec 2023 17:02:33 +0800 Subject: [PATCH 36/38] Revert "fix pay" This reverts commit 4b8be68516eb0b02d4a359c7429f37efe92bd5ba. --- src/public/pay.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/public/pay.ts b/src/public/pay.ts index fb6fc57..96451e1 100644 --- a/src/public/pay.ts +++ b/src/public/pay.ts @@ -422,7 +422,6 @@ export class PayFun { * 往后所有自选类型,走这个方法,配置格式同4、14 */ if (payArgs.htype && payArgs.selectList) { - let call = this.getCall(player) // @ts-ignore let _hdInfo = (await HuoDongFun.gethdList(call, payArgs.htype))[0] // 活动类购买不符合条件返回-5 From 9837d271321c261f69be5320be9baaa7e3d0c8f4 Mon Sep 17 00:00:00 2001 From: dy Date: Tue, 26 Dec 2023 17:02:36 +0800 Subject: [PATCH 37/38] =?UTF-8?q?Revert=20"=E8=87=AA=E9=80=89=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E8=B4=AD=E4=B9=B0=E6=94=B9=E4=B8=BA=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E6=96=B9=E6=B3=95"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 93f6b5b7ba4636b0f1fd10ec1f57b732330cfd3f. --- .gitignore | 1 + .vscode/launch.json | 50 ------------------------------ src/public/pay.ts | 74 ++++++++++----------------------------------- 3 files changed, 17 insertions(+), 108 deletions(-) delete mode 100644 .vscode/launch.json diff --git a/.gitignore b/.gitignore index 98d22b9..c1b085f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ /node_modules /.idea +/.vscode /dist /doc diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index aea870d..0000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - // 使用 IntelliSense 了解相关属性。 - // 悬停以查看现有属性的描述。 - // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "消息服", - "type": "node", - "request": "launch", - "args": [ - "${workspaceRoot}/src/index.ts", - "-serverType", - "msg", - "-logModel", - "debug" - ], - "runtimeArgs": [ - "--nolazy", - "-r", - "ts-node/register" - ], - "sourceMaps": true, - "cwd": "${workspaceRoot}", - "console": "integratedTerminal", - "internalConsoleOptions": "neverOpen" - }, - { - "name": "跨服", - "type": "node", - "request": "launch", - "args": [ - "${workspaceRoot}/src/index.ts", - "-serverType", - "cross", - "-logModel", - "debug" - ], - "runtimeArgs": [ - "--nolazy", - "-r", - "ts-node/register" - ], - "sourceMaps": true, - "cwd": "${workspaceRoot}", - "console": "integratedTerminal", - "internalConsoleOptions": "neverOpen" - } - ] -} \ No newline at end of file diff --git a/src/public/pay.ts b/src/public/pay.ts index 96451e1..1a812d0 100644 --- a/src/public/pay.ts +++ b/src/public/pay.ts @@ -206,20 +206,19 @@ export class PayFun { payArgs: payArgs, orderNo: orderNo } - //改为统一方法,此处自选不这样用 - // if (payId.indexOf('zixuanlibao') != -1) { - // // 后端唯一标识 htype 4 自选/定制 礼包 - // // @ts-ignore - // let _hdList = await HuoDongFun.gethdList(call, 4) - // _hdList.forEach(ele => { - // let selectPrize = ele.data.gift.find(v => v.payId == payId)?.prize; - // if (prize) { - // let index = payArgs instanceof Array ? payArgs : []; - // let select = selectPrize.map((v, i) => v[index[i]] ? v[index[i]] : v[0]); - // prize.push(...select); - // } - // }) - // } + if (payId.indexOf('zixuanlibao') != -1) { + // 后端唯一标识 htype 4 自选/定制 礼包 + // @ts-ignore + let _hdList = await HuoDongFun.gethdList(call, 4) + _hdList.forEach(ele => { + let selectPrize = ele.data.gift.find(v => v.payId == payId)?.prize; + if (prize) { + let index = payArgs instanceof Array ? payArgs : []; + let select = selectPrize.map((v, i) => v[index[i]] ? v[index[i]] : v[0]); + prize.push(...select); + } + }) + } if (payId.indexOf('ycmb') != -1) { // @ts-ignore // 养成活动充值礼包 let _hdids = await YangChengMuBiaofun.getCon(call); @@ -236,26 +235,11 @@ export class PayFun { let conf = await zmlbGetConf(call, {payId}) prize.push(...conf.prize) } - - /** - * todo 不要轻易改动这个方法,不允许集成业务逻辑在内部 - * todo 此方法仅仅是支付成功后的发奖 - * todo 如果有业务逻辑通过事件驱动,在支付成功后emit事件 - * todo 下面这个方法不应该这样写 - */ //圣诞节活动充值 - try { + try{ await Christmasfun.payChristmas(payId, call); - } catch (e) { - console.log("Christmasfun.payChristmas Error", e); - } - - if (payArgs.selectPrize) { - let selectPrize = await G.ioredis.get(`pay:${payId}:${player.uid}`); - if (selectPrize) { - prize.push(...JSON.parse(selectPrize)) - G.ioredis.del(`pay:${payId}:${player.uid}`) - } + }catch (e) { + console.log("Christmasfun.payChristmas Error",e); } let isReplaceConf = await this.checkBuysAfterPay(uid, payId, conf, payArgs, player) @@ -415,31 +399,6 @@ export class PayFun { if (conf.time != -1 && buyLog.slice(-1)[0]?.eTime > G.time && conf.buys == 0 && payId.indexOf('wkdlibao') == -1) { return G.server.sendMsgByUid(player.uid, 'msg_s2c/PayResult', {code: -2}); } - - /** - * 活动相关的自选礼包,目前htype 4、14支持此方法 - * payArgs里传相应参数,selectList选择的奖励列表 - * 往后所有自选类型,走这个方法,配置格式同4、14 - */ - if (payArgs.htype && payArgs.selectList) { - // @ts-ignore - let _hdInfo = (await HuoDongFun.gethdList(call, payArgs.htype))[0] - // 活动类购买不符合条件返回-5 - if (!_hdInfo) G.server.sendMsgByUid(player.uid, 'msg_s2c/PayResult', {code: -5}) - let giftInfo = _hdInfo.data.gift.find(v => v.payId == payId); - if (!giftInfo) G.server.sendMsgByUid(player.uid, 'msg_s2c/PayResult', {code: -5}) - - let dlzPrize = R.flatten(giftInfo.dlz.map(i => R.values(i))) - let selectPrize = payArgs.selectList.map(v => { - let sPrize = dlzPrize.find(o => o.a == v.a && o.t == v.t && o.n == v.n) - // 严格判断,自选奖励不存在奖励列表,返回-6 - if (!sPrize) return G.server.sendMsgByUid(player.uid, 'msg_s2c/PayResult', {code: -6}); - return sPrize - }) - // 自选奖励过判断后,存入redis,6小时内支付有效 todo 6小时可能有些长 - G.ioredis.setex(`pay:${payId}:${player.uid}`, 21600, JSON.stringify(selectPrize)); - } - //针对每日礼包的单独处理 let zeroTime = PublicShared.getToDayZeroTime(G.time) if (payId.indexOf('136Gift') != -1 && payId != '136GiftAll') { @@ -496,7 +455,6 @@ export class PayFun { /** * 当玩家购买过有时间期效性的礼包 并且在生效期内每天有邮件奖励时 每天首次登陆时根据时间补发邮件 玩家每天首次登陆会进入检查 - * @param player * @param lastTime 上一次登陆时间 * @param curTime 每日首次登陆时间 */ From 720dc255fe0c38072319ebafbc08641b9fe837fd Mon Sep 17 00:00:00 2001 From: dy Date: Tue, 26 Dec 2023 17:03:32 +0800 Subject: [PATCH 38/38] =?UTF-8?q?Revert=20"redis=E4=B8=B4=E6=97=B6?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 0e089582 --- src/module/redis.ts | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/src/module/redis.ts b/src/module/redis.ts index e62562b..4e14ff2 100644 --- a/src/module/redis.ts +++ b/src/module/redis.ts @@ -1,20 +1,21 @@ -import {PeiJian} from '../shared/protocols/peijian/PtlGetList'; -import {CollectionDxlt} from './collection_dxlt'; -import {CollectionEmail} from './collection_email'; -import {CollectionEquip} from './collection_equip'; -import {CollectionFightLog} from './collection_fightLog'; -import {CollectionGBTX} from './collection_gbtx'; -import {CollectionHero} from './collection_hero'; -import {CollectionItem} from './collection_item'; -import {CollectionJJC} from './collection_jjc'; -import {CollectionShiwu} from './collection_shiwu'; -import {CollectionShop} from './collection_shop'; -import {CollectionTanXian} from './collection_tanxian'; -import {CollectionUser} from './collection_user'; +import { PeiJian } from '../shared/protocols/peijian/PtlGetList'; +import { CollectionDxlt } from './collection_dxlt'; +import { CollectionEmail } from './collection_email'; +import { CollectionEquip } from './collection_equip'; +import { CollectionFightLog } from './collection_fightLog'; +import { CollectionGBTX } from './collection_gbtx'; +import { CollectionHero } from './collection_hero'; +import { CollectionItem } from './collection_item'; +import { CollectionJJC } from './collection_jjc'; +import { CollectionShiwu } from './collection_shiwu'; +import { CollectionShop } from './collection_shop'; +import { CollectionTanXian } from './collection_tanxian'; +import { CollectionUser } from './collection_user'; import {payLog} from '../shared/protocols/pay/PtlGetList'; -import {rankInfo} from '../shared/protocols/type'; -import {CollectionFriend} from '../module/collection_friend'; -import {CollectionGongHui} from '../module/collection_gonghui'; +import { rankInfo } from '../shared/protocols/type'; +import { CollectionFriend } from '../module/collection_friend'; +import { CollectionGongHui } from '../module/collection_gonghui'; + export type sortEd = { @@ -28,7 +29,7 @@ export type sortEd = { export type RedisCollections1 = { user: CollectionUser; gbtx: CollectionGBTX; - tanxian: Omit | any; + tanxian: Omit; dxlt: CollectionDxlt; jjc: CollectionJJC; };