From 82b4b6172510b1357fcb1eb041e329d45c405205 Mon Sep 17 00:00:00 2001 From: chenkai Date: Thu, 21 Dec 2023 19:52:19 +0800 Subject: [PATCH 01/19] =?UTF-8?q?feat:=20=E6=8A=A2=E7=BA=A2=E5=8C=85?= =?UTF-8?q?=E5=88=86=E9=92=BB=E7=9F=B3=E6=8E=A5=E5=8F=A3=20=E5=88=9D?= =?UTF-8?q?=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../event/payForDiamond/ApiCanReceive.ts | 45 ++++++++ src/api_s2c/event/payForDiamond/ApiReceive.ts | 104 ++++++++++++++++++ .../event/payForDiamond/PtlCanReceive.ts | 9 ++ .../event/payForDiamond/PtlReceive.ts | 8 ++ 4 files changed, 166 insertions(+) create mode 100644 src/api_s2c/event/payForDiamond/ApiCanReceive.ts create mode 100644 src/api_s2c/event/payForDiamond/ApiReceive.ts create mode 100644 src/shared/protocols/event/payForDiamond/PtlCanReceive.ts create mode 100644 src/shared/protocols/event/payForDiamond/PtlReceive.ts diff --git a/src/api_s2c/event/payForDiamond/ApiCanReceive.ts b/src/api_s2c/event/payForDiamond/ApiCanReceive.ts new file mode 100644 index 0000000..b77fe24 --- /dev/null +++ b/src/api_s2c/event/payForDiamond/ApiCanReceive.ts @@ -0,0 +1,45 @@ +import { ApiCall } from "tsrpc"; +import { HuoDongFun } from "../../../public/huodongfun"; +import { ReqCanReceive, ResCanReceive } from '../../../shared/protocols/event/payForDiamond/PtlCanReceive'; +import { PublicShared } from "../../../shared/public/public"; + +export async function playerCanReceive(call: ApiCall) { + const activityInfo = await HuoDongFun.getHdidInfo(call, call.req.activityId); + if (!activityInfo) { + return call.error('No such activity'); + } + const remaining = activityInfo.data['remaining']; + const zeroTime = PublicShared.getToDayZeroTime(); + const dayPayInfo = await G.mongodb.collection('dayPay').findOne({ uid: call.uid, time: zeroTime }); + if (!dayPayInfo || !dayPayInfo.payNum) { + return { + payNum: 0, remaining, result: false, activityInfo + }; + } + const payNum = dayPayInfo.payNum; + // 玩家充值未达标或者奖池余额耗尽则不能领取 + if (payNum < activityInfo.data['price'] || remaining <= 0) { + return { + payNum, remaining, result: false, activityInfo + } + } + // 检查玩家今日是否已经领取 + const playerActivityInfo = G.mongodb.cEvent('payForDiamond').findOne({ uid: call.uid }); + if (playerActivityInfo) { + if (playerActivityInfo[zeroTime]?.length) { + return { + payNum, remaining, result: false, activityInfo + }; + } + } + return { + payNum, remaining, result: true, activityInfo + }; +} + +export default async function (call: ApiCall) { + const canReceiveResult = await playerCanReceive(call); + if (canReceiveResult) { + call.succ(canReceiveResult); + } +} \ No newline at end of file diff --git a/src/api_s2c/event/payForDiamond/ApiReceive.ts b/src/api_s2c/event/payForDiamond/ApiReceive.ts new file mode 100644 index 0000000..46748ab --- /dev/null +++ b/src/api_s2c/event/payForDiamond/ApiReceive.ts @@ -0,0 +1,104 @@ +import { ApiCall } from "tsrpc"; +import { HuoDongFun } from "../../../public/huodongfun"; +import { ReqReceive, ResReceive } from '../../../shared/protocols/event/payForDiamond/PtlReceive'; +import { playerCanReceive } from './ApiCanReceive'; +import { PublicShared } from "../../../shared/public/public"; + +type diamondWeightGroup = { + weight: number; + numrange: [ min: number, max: number]; +}; + +/** + * @param groups 各分组及其权重 + */ +function randomWithWeight(groups: diamondWeightGroup[]) { + let minAmount: number; + let totalWeights = 0; + for (const group of groups) { + totalWeights += group.weight; + if (!minAmount) { + minAmount = group.numrange[0]; + } else { + minAmount = Math.min(minAmount, group.numrange[0]); + } + } + const randomValue = Math.random() * totalWeights; // 随机值落在[0, totalWeights) 之间 + let currSum = 0; + for (const group of groups) { + if (currSum <= randomValue && randomValue < currSum + group.weight) { + return { group, minAmount }; + } else { + currSum += group.weight; + } + } + const length = groups.length; + return { group: groups[length - 1], minAmount }; +} + +/** + * 计算玩家分得的钻石数量 + * @param remaining + * @param group + * @param minAmount + */ +function calcDiamondGot(remaining: number, group: diamondWeightGroup, minAmount: number) { + const [min, max] = group.numrange; + const randomAmount = Math.floor(Math.random() * (max - min)) + min + 1; // max 值应能够取到, 故 +1 + // 剩余数额小于组内随机得到的值, 全给吧 + if (randomAmount > remaining) { + return remaining; + } + // 玩家分过后的余额不足给到下一个玩家分配的最小额度, 也把当前剩的全给 + if (remaining - randomAmount < minAmount) { + return remaining; + } + return randomAmount; +} + +export default async function (call: ApiCall) { + const canReceiveResult = await playerCanReceive(call); + if (canReceiveResult) { + if (!canReceiveResult.result) { + return call.succ({ + amount: 0, + timesRemaining: 0 + }); + } + const activityData = canReceiveResult.activityInfo.data; + const remaining = activityData['remaining']? activityData['remaining'] : activityData['totalmoney']; + const { group, minAmount } = randomWithWeight(activityData['groupConf']['arr']); + const gotAmount = calcDiamondGot(remaining, group, minAmount); + // 减去余额 + const filter = { + hdid: call.req.activityId, + $or: [ + {'data.remaining': { $exists: false }}, + {$expr: {$gte: [ `$data.remaining - ${gotAmount}`, 0 ]}}, + ], + }; + const updateDoc = { + $set: { 'data.remaining': `$data.remaining - ${gotAmount}` } + } + const updateResult = await G.mongodb.collection('hdinfo').updateOne(filter, updateDoc); + // 更新成功 + if (updateResult.modifiedCount) { + // 请求返回 + call.succ({ + amount: gotAmount, + timesRemaining: 0 + }); + // 添加玩家领取记录 + const zeroTime = PublicShared.getToDayZeroTime(); + const setObj = {}; + setObj[zeroTime] = gotAmount; + G.mongodb.cEvent('payForDiamond').updateOne({ uid: call.uid }, { + $set: setObj + }); + } + // 发送炫耀 + if (gotAmount >= activityData['groupConf']['base']['loglimit']) { + + } + } +} \ No newline at end of file diff --git a/src/shared/protocols/event/payForDiamond/PtlCanReceive.ts b/src/shared/protocols/event/payForDiamond/PtlCanReceive.ts new file mode 100644 index 0000000..8d905ec --- /dev/null +++ b/src/shared/protocols/event/payForDiamond/PtlCanReceive.ts @@ -0,0 +1,9 @@ +export type ReqCanReceive = { + activityId: number; +}; + +export type ResCanReceive = { + payNum: number; + remaining?: number; + result: boolean; +}; \ No newline at end of file diff --git a/src/shared/protocols/event/payForDiamond/PtlReceive.ts b/src/shared/protocols/event/payForDiamond/PtlReceive.ts new file mode 100644 index 0000000..beb4bf8 --- /dev/null +++ b/src/shared/protocols/event/payForDiamond/PtlReceive.ts @@ -0,0 +1,8 @@ +export type ReqReceive = { + activityId: number; +}; + +export type ResReceive = { + amount: number, + timesRemaining: number; +}; From 2ae2a1362d48b98c2b48df1de1cdb40379a64346 Mon Sep 17 00:00:00 2001 From: chenkai Date: Thu, 21 Dec 2023 20:16:29 +0800 Subject: [PATCH 02/19] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E7=82=AB?= =?UTF-8?q?=E8=80=80=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api_s2c/event/payForDiamond/ApiReceive.ts | 13 +++++++++++-- src/json/pmd.json5 | 4 +++- src/module/collection_event.ts | 5 ++++- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/api_s2c/event/payForDiamond/ApiReceive.ts b/src/api_s2c/event/payForDiamond/ApiReceive.ts index 46748ab..ff9748a 100644 --- a/src/api_s2c/event/payForDiamond/ApiReceive.ts +++ b/src/api_s2c/event/payForDiamond/ApiReceive.ts @@ -1,8 +1,8 @@ import { ApiCall } from "tsrpc"; -import { HuoDongFun } from "../../../public/huodongfun"; import { ReqReceive, ResReceive } from '../../../shared/protocols/event/payForDiamond/PtlReceive'; import { playerCanReceive } from './ApiCanReceive'; import { PublicShared } from "../../../shared/public/public"; +import { ChatFun } from "../../../public/chat"; type diamondWeightGroup = { weight: number; @@ -98,7 +98,16 @@ export default async function (call: ApiCall) { } // 发送炫耀 if (gotAmount >= activityData['groupConf']['base']['loglimit']) { - + ChatFun.newMsg({ + type: 'local', + msg: G.gc.pmd.get_hero_star5_pmd, + time: G.time, + sender: 'system', + otherData: { + pmd: true, + args: [gotAmount] + } + }); } } } \ No newline at end of file diff --git a/src/json/pmd.json5 b/src/json/pmd.json5 index 2e0db1c..bd2ec62 100644 --- a/src/json/pmd.json5 +++ b/src/json/pmd.json5 @@ -14,5 +14,7 @@ //黑帮争霸争霸赛第二名 hbzb_pmd2: 'intr_pmd_hbzb2', //黑帮争霸争霸赛第三名 - hbzb_pmd3: 'intr_pmd_hbzb3' + hbzb_pmd3: 'intr_pmd_hbzb3', + // 充值抢钻石 - 抢到大量钻石 + pay_for_diamond: 'intr_pmd_pfd' } \ No newline at end of file diff --git a/src/module/collection_event.ts b/src/module/collection_event.ts index 6681c58..901d3f9 100644 --- a/src/module/collection_event.ts +++ b/src/module/collection_event.ts @@ -50,7 +50,10 @@ export type eventType = { qirichongzhi: Omit; jierihuodong: Omit & { refreshTime: number; }; kaifujingsai: ResOpenKaifujingsai; - zhoumolibao: ResOpenZhoumolibao & { refreshTime: number; } + zhoumolibao: ResOpenZhoumolibao & { refreshTime: number; }; + payForDiamond: { + [time: number]: number[] + } } & { [k: `${number}jijin`]: ResOpenYuedujijin; [k: `yangchengmubiao${number}`]: yangchengmubiao; From 6808b53dd4be10bf64188c46db317ce34b35ffe6 Mon Sep 17 00:00:00 2001 From: chenkai Date: Thu, 21 Dec 2023 20:33:47 +0800 Subject: [PATCH 03/19] =?UTF-8?q?fix:=20=E5=85=81=E8=AE=B8=E7=8E=A9?= =?UTF-8?q?=E5=AE=B6=E9=A2=86=E5=8F=96=E5=88=B0=E7=9A=84=E9=92=BB=E7=9F=B3?= =?UTF-8?q?=E6=95=B0=E5=B0=8F=E4=BA=8E=E9=85=8D=E7=BD=AE=E7=9A=84=E6=9C=80?= =?UTF-8?q?=E4=BD=8E=E6=A1=A3=E4=BD=8D=E9=A2=9D=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api_s2c/event/payForDiamond/ApiReceive.ts | 21 +- src/shared/protocols/serviceProto.ts | 670 ++++++++++-------- 2 files changed, 385 insertions(+), 306 deletions(-) diff --git a/src/api_s2c/event/payForDiamond/ApiReceive.ts b/src/api_s2c/event/payForDiamond/ApiReceive.ts index ff9748a..8aaf8e6 100644 --- a/src/api_s2c/event/payForDiamond/ApiReceive.ts +++ b/src/api_s2c/event/payForDiamond/ApiReceive.ts @@ -13,46 +13,35 @@ type diamondWeightGroup = { * @param groups 各分组及其权重 */ function randomWithWeight(groups: diamondWeightGroup[]) { - let minAmount: number; let totalWeights = 0; for (const group of groups) { totalWeights += group.weight; - if (!minAmount) { - minAmount = group.numrange[0]; - } else { - minAmount = Math.min(minAmount, group.numrange[0]); - } } const randomValue = Math.random() * totalWeights; // 随机值落在[0, totalWeights) 之间 let currSum = 0; for (const group of groups) { if (currSum <= randomValue && randomValue < currSum + group.weight) { - return { group, minAmount }; + return group; } else { currSum += group.weight; } } const length = groups.length; - return { group: groups[length - 1], minAmount }; + return groups[length - 1]; } /** * 计算玩家分得的钻石数量 * @param remaining * @param group - * @param minAmount */ -function calcDiamondGot(remaining: number, group: diamondWeightGroup, minAmount: number) { +function calcDiamondGot(remaining: number, group: diamondWeightGroup) { const [min, max] = group.numrange; const randomAmount = Math.floor(Math.random() * (max - min)) + min + 1; // max 值应能够取到, 故 +1 // 剩余数额小于组内随机得到的值, 全给吧 if (randomAmount > remaining) { return remaining; } - // 玩家分过后的余额不足给到下一个玩家分配的最小额度, 也把当前剩的全给 - if (remaining - randomAmount < minAmount) { - return remaining; - } return randomAmount; } @@ -67,8 +56,8 @@ export default async function (call: ApiCall) { } const activityData = canReceiveResult.activityInfo.data; const remaining = activityData['remaining']? activityData['remaining'] : activityData['totalmoney']; - const { group, minAmount } = randomWithWeight(activityData['groupConf']['arr']); - const gotAmount = calcDiamondGot(remaining, group, minAmount); + const group = randomWithWeight(activityData['groupConf']['arr']); + const gotAmount = calcDiamondGot(remaining, group); // 减去余额 const filter = { hdid: call.req.activityId, diff --git a/src/shared/protocols/serviceProto.ts b/src/shared/protocols/serviceProto.ts index c60ab37..5bef3a2 100644 --- a/src/shared/protocols/serviceProto.ts +++ b/src/shared/protocols/serviceProto.ts @@ -68,13 +68,15 @@ import { ReqOpen as ReqOpen_14, ResOpen as ResOpen_14 } from './event/leijichong import { ReqRec as ReqRec_5, ResRec as ResRec_5 } from './event/leijichongzhi/PtlRec'; import { ReqLottery, ResLottery } from './event/niudanji/PtlLottery'; import { ReqOpen as ReqOpen_15, ResOpen as ResOpen_15 } from './event/niudanji/PtlOpen'; +import { ReqCanReceive, ResCanReceive } from './event/payForDiamond/PtlCanReceive'; +import { ReqReceive as ReqReceive_2, ResReceive as ResReceive_2 } from './event/payForDiamond/PtlReceive'; import { ReqOpen as ReqOpen_16, ResOpen as ResOpen_16 } from './event/qirichongzhi/PtlOpen'; import { ReqRec as ReqRec_6, ResRec as ResRec_6 } from './event/qirichongzhi/PtlRec'; import { ReqOpen as ReqOpen_17, ResOpen as ResOpen_17 } from './event/qiridenglu/PtlOpen'; import { ReqRecPrize as ReqRecPrize_1, ResRecPrize as ResRecPrize_1 } from './event/qiridenglu/PtlRecPrize'; import { ReqOpen as ReqOpen_18, ResOpen as ResOpen_18 } from './event/shiwuleichong/PtlOpen'; import { ReqOpen as ReqOpen_19, ResOpen as ResOpen_19 } from './event/shouchong/PtlOpen'; -import { ReqReceive as ReqReceive_2, ResReceive as ResReceive_2 } from './event/shouchong/PtlReceive'; +import { ReqReceive as ReqReceive_3, ResReceive as ResReceive_3 } from './event/shouchong/PtlReceive'; import { ReqBuy as ReqBuy_1, ResBuy as ResBuy_1 } from './event/xianshizhaomu/PtlBuy'; import { ReqDuihuan, ResDuihuan } from './event/xianshizhaomu/PtlDuihuan'; import { ReqLottery as ReqLottery_1, ResLottery as ResLottery_1 } from './event/xianshizhaomu/PtlLottery'; @@ -95,7 +97,7 @@ import { ReqRecPrize as ReqRecPrize_2, ResRecPrize as ResRecPrize_2 } from './ev import { ReqRecTask, ResRecTask } from './event/zhanling/PtlRecTask'; import { ReqOpen as ReqOpen_26, ResOpen as ResOpen_26 } from './event/zhoulibao/PtlOpen'; import { ReqOpen as ReqOpen_27, ResOpen as ResOpen_27 } from './event/zhoumolibao/PtlOpen'; -import { ReqReceive as ReqReceive_3, ResReceive as ResReceive_3 } from './event/zhoumolibao/PtlReceive'; +import { ReqReceive as ReqReceive_4, ResReceive as ResReceive_4 } from './event/zhoumolibao/PtlReceive'; import { ReqBuy as ReqBuy_3, ResBuy as ResBuy_3 } from './event/zixuanlibao/PtlBuy'; import { ReqOpen as ReqOpen_28, ResOpen as ResOpen_28 } from './event/zixuanlibao/PtlOpen'; import { ReqhdGetList, ReshdGetList } from './eventlist/PtlhdGetList'; @@ -185,10 +187,10 @@ import { ReqBuyFightNum, ResBuyFightNum } from './jjc/PtlBuyFightNum'; import { ReqFight as ReqFight_5, ResFight as ResFight_5 } from './jjc/PtlFight'; import { ReqFightLog, ResFightLog } from './jjc/PtlFightLog'; import { ReqOpen as ReqOpen_40, ResOpen as ResOpen_40 } from './jjc/PtlOpen'; -import { ReqReceive as ReqReceive_4, ResReceive as ResReceive_4 } from './jjc/PtlReceive'; +import { ReqReceive as ReqReceive_5, ResReceive as ResReceive_5 } from './jjc/PtlReceive'; import { ReqRefresh as ReqRefresh_4, ResRefresh as ResRefresh_4 } from './jjc/PtlRefresh'; import { ReqOpen as ReqOpen_41, ResOpen as ResOpen_41 } from './kaifujingsai/PtlOpen'; -import { ReqReceive as ReqReceive_5, ResReceive as ResReceive_5 } from './kaifujingsai/PtlReceive'; +import { ReqReceive as ReqReceive_6, ResReceive as ResReceive_6 } from './kaifujingsai/PtlReceive'; import { ReqApply as ReqApply_2, ResApply as ResApply_2 } from './kbzz/PtlApply'; import { ReqAutoApply, ResAutoApply } from './kbzz/PtlAutoApply'; import { ReqBuyNum as ReqBuyNum_3, ResBuyNum as ResBuyNum_3 } from './kbzz/PtlBuyNum'; @@ -296,7 +298,7 @@ import { ReqFastGuaJi, ResFastGuaJi } from './tanxian/PtlFastGuaJi'; import { ReqFight as ReqFight_11, ResFight as ResFight_11 } from './tanxian/PtlFight'; import { ReqGuaJi, ResGuaJi } from './tanxian/PtlGuaJi'; import { ReqOpen as ReqOpen_54, ResOpen as ResOpen_54 } from './tanxian/PtlOpen'; -import { ReqReceive as ReqReceive_6, ResReceive as ResReceive_6 } from './tanxian/PtlReceive'; +import { ReqReceive as ReqReceive_7, ResReceive as ResReceive_7 } from './tanxian/PtlReceive'; import { ReqAllFinsh, ResAllFinsh } from './task/PtlAllFinsh'; import { ReqFinsh, ResFinsh } from './task/PtlFinsh'; import { ReqOpen as ReqOpen_55, ResOpen as ResOpen_55 } from './task/PtlOpen'; @@ -335,7 +337,7 @@ import { ReqGet as ReqGet_3, ResGet as ResGet_3 } from './xstask/PtlGet'; import { ReqLvUp as ReqLvUp_4, ResLvUp as ResLvUp_4 } from './xstask/PtlLvUp'; import { ReqOnekeyReceive, ResOnekeyReceive } from './xstask/PtlOnekeyReceive'; import { ReqOpen as ReqOpen_58, ResOpen as ResOpen_58 } from './xstask/PtlOpen'; -import { ReqReceive as ReqReceive_7, ResReceive as ResReceive_7 } from './xstask/PtlReceive'; +import { ReqReceive as ReqReceive_8, ResReceive as ResReceive_8 } from './xstask/PtlReceive'; import { ReqRefresh as ReqRefresh_8, ResRefresh as ResRefresh_8 } from './xstask/PtlRefresh'; import { ReqHandle, ResHandle } from './yongbingzhuzhan/PtlHandle'; import { ReqChangePos as ReqChangePos_1, ResChangePos as ResChangePos_1 } from './zhanqianbushu/PtlChangePos'; @@ -620,6 +622,14 @@ export interface ServiceType { req: ReqOpen_15, res: ResOpen_15 }, + "event/payForDiamond/CanReceive": { + req: ReqCanReceive, + res: ResCanReceive + }, + "event/payForDiamond/Receive": { + req: ReqReceive_2, + res: ResReceive_2 + }, "event/qirichongzhi/Open": { req: ReqOpen_16, res: ResOpen_16 @@ -645,8 +655,8 @@ export interface ServiceType { res: ResOpen_19 }, "event/shouchong/Receive": { - req: ReqReceive_2, - res: ResReceive_2 + req: ReqReceive_3, + res: ResReceive_3 }, "event/xianshizhaomu/Buy": { req: ReqBuy_1, @@ -729,8 +739,8 @@ export interface ServiceType { res: ResOpen_27 }, "event/zhoumolibao/Receive": { - req: ReqReceive_3, - res: ResReceive_3 + req: ReqReceive_4, + res: ResReceive_4 }, "event/zixuanlibao/Buy": { req: ReqBuy_3, @@ -1089,8 +1099,8 @@ export interface ServiceType { res: ResOpen_40 }, "jjc/Receive": { - req: ReqReceive_4, - res: ResReceive_4 + req: ReqReceive_5, + res: ResReceive_5 }, "jjc/Refresh": { req: ReqRefresh_4, @@ -1101,8 +1111,8 @@ export interface ServiceType { res: ResOpen_41 }, "kaifujingsai/Receive": { - req: ReqReceive_5, - res: ResReceive_5 + req: ReqReceive_6, + res: ResReceive_6 }, "kbzz/Apply": { req: ReqApply_2, @@ -1421,8 +1431,8 @@ export interface ServiceType { res: ResOpen_54 }, "tanxian/Receive": { - req: ReqReceive_6, - res: ResReceive_6 + req: ReqReceive_7, + res: ResReceive_7 }, "task/AllFinsh": { req: ReqAllFinsh, @@ -1577,8 +1587,8 @@ export interface ServiceType { res: ResOpen_58 }, "xstask/Receive": { - req: ReqReceive_7, - res: ResReceive_7 + req: ReqReceive_8, + res: ResReceive_8 }, "xstask/Refresh": { req: ReqRefresh_8, @@ -1982,101 +1992,111 @@ export const serviceProto: ServiceProto = { }, { "id": 69, - "name": "event/qirichongzhi/Open", + "name": "event/payForDiamond/CanReceive", "type": "api" }, { "id": 70, - "name": "event/qirichongzhi/Rec", + "name": "event/payForDiamond/Receive", "type": "api" }, { "id": 71, - "name": "event/qiridenglu/Open", + "name": "event/qirichongzhi/Open", "type": "api" }, { "id": 72, - "name": "event/qiridenglu/RecPrize", + "name": "event/qirichongzhi/Rec", "type": "api" }, { "id": 73, - "name": "event/shiwuleichong/Open", + "name": "event/qiridenglu/Open", "type": "api" }, { "id": 74, - "name": "event/shouchong/Open", + "name": "event/qiridenglu/RecPrize", "type": "api" }, { "id": 75, - "name": "event/shouchong/Receive", + "name": "event/shiwuleichong/Open", "type": "api" }, { "id": 76, - "name": "event/xianshizhaomu/Buy", + "name": "event/shouchong/Open", "type": "api" }, { "id": 77, - "name": "event/xianshizhaomu/Duihuan", + "name": "event/shouchong/Receive", "type": "api" }, { "id": 78, - "name": "event/xianshizhaomu/Lottery", + "name": "event/xianshizhaomu/Buy", "type": "api" }, { "id": 79, - "name": "event/xianshizhaomu/Open", + "name": "event/xianshizhaomu/Duihuan", "type": "api" }, { "id": 80, - "name": "event/xianshizhaomu/Rec", + "name": "event/xianshizhaomu/Lottery", "type": "api" }, { "id": 81, - "name": "event/xinshoulibao/Open", + "name": "event/xianshizhaomu/Open", "type": "api" }, { "id": 82, - "name": "event/yangchengmubiao/Buy", + "name": "event/xianshizhaomu/Rec", "type": "api" }, { "id": 83, - "name": "event/yangchengmubiao/Open", + "name": "event/xinshoulibao/Open", "type": "api" }, { "id": 84, - "name": "event/yangchengmubiao/Rec", + "name": "event/yangchengmubiao/Buy", "type": "api" }, { "id": 85, - "name": "event/yibaichou/Open", + "name": "event/yangchengmubiao/Open", "type": "api" }, { "id": 86, - "name": "event/yibaichou/Rec", + "name": "event/yangchengmubiao/Rec", "type": "api" }, { "id": 87, - "name": "event/yibaichou/RecAll", + "name": "event/yibaichou/Open", "type": "api" }, { "id": 88, + "name": "event/yibaichou/Rec", + "type": "api" + }, + { + "id": 89, + "name": "event/yibaichou/RecAll", + "type": "api" + }, + { + "id": 90, "name": "event/yuedujijin/Open", "type": "api", "conf": { @@ -2084,157 +2104,157 @@ export const serviceProto: ServiceProto = { } }, { - "id": 89, + "id": 91, "name": "event/yuedujijin/Rec", "type": "api" }, { - "id": 90, + "id": 92, "name": "event/zhanling/BuyLv", "type": "api" }, { - "id": 91, + "id": 93, "name": "event/zhanling/Open", "type": "api" }, { - "id": 92, + "id": 94, "name": "event/zhanling/RecPrize", "type": "api" }, { - "id": 93, + "id": 95, "name": "event/zhanling/RecTask", "type": "api" }, { - "id": 94, + "id": 96, "name": "event/zhoulibao/Open", "type": "api" }, { - "id": 95, + "id": 97, "name": "event/zhoumolibao/Open", "type": "api" }, { - "id": 96, + "id": 98, "name": "event/zhoumolibao/Receive", "type": "api" }, { - "id": 97, + "id": 99, "name": "event/zixuanlibao/Buy", "type": "api" }, { - "id": 98, + "id": 100, "name": "event/zixuanlibao/Open", "type": "api" }, { - "id": 99, + "id": 101, "name": "eventlist/hdGetList", "type": "api" }, { - "id": 100, + "id": 102, "name": "friend/Apply", "type": "api" }, { - "id": 101, + "id": 103, "name": "friend/Del", "type": "api" }, { - "id": 102, + "id": 104, "name": "friend/Gift", "type": "api" }, { - "id": 103, + "id": 105, "name": "friend/List", "type": "api" }, { - "id": 104, + "id": 106, "name": "friend/Open", "type": "api" }, { - "id": 105, + "id": 107, "name": "friend/Respond", "type": "api" }, { - "id": 106, + "id": 108, "name": "friend/RmBlackList", "type": "api" }, { - "id": 107, + "id": 109, "name": "friend/Search", "type": "api" }, { - "id": 108, + "id": 110, "name": "ganbutexun/Challenge", "type": "api" }, { - "id": 109, + "id": 111, "name": "ganbutexun/Open", "type": "api" }, { - "id": 110, + "id": 112, "name": "ganhai/Fast", "type": "api" }, { - "id": 111, + "id": 113, "name": "ganhai/Fight", "type": "api" }, { - "id": 112, + "id": 114, "name": "ganhai/Log", "type": "api" }, { - "id": 113, + "id": 115, "name": "ganhai/Open", "type": "api" }, { - "id": 114, + "id": 116, "name": "ganhai/Refresh", "type": "api" }, { - "id": 115, + "id": 117, "name": "ganhai/RefreshShip", "type": "api" }, { - "id": 116, + "id": 118, "name": "ganhai/Select", "type": "api" }, { - "id": 117, + "id": 119, "name": "gmapi/Gift", "type": "api" }, { - "id": 118, + "id": 120, "name": "gmapi/Post", "type": "api" }, { - "id": 119, + "id": 121, "name": "gonghui/Apply", "type": "api", "conf": { @@ -2244,7 +2264,7 @@ export const serviceProto: ServiceProto = { } }, { - "id": 120, + "id": 122, "name": "gonghui/ApplyAll", "type": "api", "conf": { @@ -2254,7 +2274,7 @@ export const serviceProto: ServiceProto = { } }, { - "id": 121, + "id": 123, "name": "gonghui/ApplyList", "type": "api", "conf": { @@ -2264,7 +2284,7 @@ export const serviceProto: ServiceProto = { } }, { - "id": 122, + "id": 124, "name": "gonghui/Change", "type": "api", "conf": { @@ -2274,12 +2294,12 @@ export const serviceProto: ServiceProto = { } }, { - "id": 123, + "id": 125, "name": "gonghui/Create", "type": "api" }, { - "id": 124, + "id": 126, "name": "gonghui/Dissolve", "type": "api", "conf": { @@ -2289,7 +2309,7 @@ export const serviceProto: ServiceProto = { } }, { - "id": 125, + "id": 127, "name": "gonghui/Exit", "type": "api", "conf": { @@ -2299,12 +2319,12 @@ export const serviceProto: ServiceProto = { } }, { - "id": 126, + "id": 128, "name": "gonghui/FbBuyNum", "type": "api" }, { - "id": 127, + "id": 129, "name": "gonghui/FbFight", "type": "api", "conf": { @@ -2314,7 +2334,7 @@ export const serviceProto: ServiceProto = { } }, { - "id": 128, + "id": 130, "name": "gonghui/FbOpen", "type": "api", "conf": { @@ -2324,17 +2344,17 @@ export const serviceProto: ServiceProto = { } }, { - "id": 129, + "id": 131, "name": "gonghui/GetList", "type": "api" }, { - "id": 130, + "id": 132, "name": "gonghui/Join", "type": "api" }, { - "id": 131, + "id": 133, "name": "gonghui/Jx", "type": "api", "conf": { @@ -2344,7 +2364,7 @@ export const serviceProto: ServiceProto = { } }, { - "id": 132, + "id": 134, "name": "gonghui/JxOpen", "type": "api", "conf": { @@ -2354,7 +2374,7 @@ export const serviceProto: ServiceProto = { } }, { - "id": 133, + "id": 135, "name": "gonghui/List", "type": "api", "conf": { @@ -2364,7 +2384,7 @@ export const serviceProto: ServiceProto = { } }, { - "id": 134, + "id": 136, "name": "gonghui/Manage", "type": "api", "conf": { @@ -2374,7 +2394,7 @@ export const serviceProto: ServiceProto = { } }, { - "id": 135, + "id": 137, "name": "gonghui/Open", "type": "api", "conf": { @@ -2384,7 +2404,7 @@ export const serviceProto: ServiceProto = { } }, { - "id": 136, + "id": 138, "name": "gonghui/TanHe", "type": "api", "conf": { @@ -2394,7 +2414,7 @@ export const serviceProto: ServiceProto = { } }, { - "id": 137, + "id": 139, "name": "gonghui/TaskOpen", "type": "api", "conf": { @@ -2404,7 +2424,7 @@ export const serviceProto: ServiceProto = { } }, { - "id": 138, + "id": 140, "name": "gonghui/TaskReceive", "type": "api", "conf": { @@ -2414,7 +2434,7 @@ export const serviceProto: ServiceProto = { } }, { - "id": 139, + "id": 141, "name": "gonghui/UpWz", "type": "api", "conf": { @@ -2424,137 +2444,137 @@ export const serviceProto: ServiceProto = { } }, { - "id": 140, + "id": 142, "name": "gonghuibaozang/Lottery", "type": "api" }, { - "id": 141, + "id": 143, "name": "gonghuibaozang/Open", "type": "api" }, { - "id": 142, + "id": 144, "name": "gonglukuangbiao/Buy", "type": "api" }, { - "id": 143, + "id": 145, "name": "gonglukuangbiao/Fight", "type": "api" }, { - "id": 144, + "id": 146, "name": "gonglukuangbiao/Open", "type": "api" }, { - "id": 145, + "id": 147, "name": "gonglukuangbiao/Refresh", "type": "api" }, { - "id": 146, + "id": 148, "name": "gongyu/mingdao/Active", "type": "api" }, { - "id": 147, + "id": 149, "name": "gongyu/mingdao/Open", "type": "api" }, { - "id": 148, + "id": 150, "name": "gongyu/mingdao/RecPrize", "type": "api" }, { - "id": 149, + "id": 151, "name": "gongyu/mingdao/Repair", "type": "api" }, { - "id": 150, + "id": 152, "name": "gongyu/xunlianjihua/Reset", "type": "api" }, { - "id": 151, + "id": 153, "name": "gongyu/xunlianjihua/UpSkill", "type": "api" }, { - "id": 152, + "id": 154, "name": "gongyu/zuozhanjihua/SetSkill", "type": "api" }, { - "id": 153, + "id": 155, "name": "hbzb/jfs/BuyNum", "type": "api" }, { - "id": 154, + "id": 156, "name": "hbzb/jfs/Fight", "type": "api" }, { - "id": 155, + "id": 157, "name": "hbzb/jfs/GetLog", "type": "api" }, { - "id": 156, + "id": 158, "name": "hbzb/jfs/Open", "type": "api" }, { - "id": 157, + "id": 159, "name": "hbzb/jfs/Rec", "type": "api" }, { - "id": 158, + "id": 160, "name": "hbzb/jfs/Refresh", "type": "api" }, { - "id": 159, + "id": 161, "name": "hbzb/GetStatus", "type": "api" }, { - "id": 160, + "id": 162, "name": "hbzb/zbs/BuyNum", "type": "api" }, { - "id": 161, + "id": 163, "name": "hbzb/zbs/Fight", "type": "api" }, { - "id": 162, + "id": 164, "name": "hbzb/zbs/GetLog", "type": "api" }, { - "id": 163, + "id": 165, "name": "hbzb/zbs/Open", "type": "api" }, { - "id": 164, + "id": 166, "name": "hbzb/zbs/Refresh", "type": "api" }, { - "id": 165, + "id": 167, "name": "hero/Awake", "type": "api" }, { - "id": 166, + "id": 168, "name": "hero/ChangePos", "type": "api", "conf": { @@ -2562,17 +2582,17 @@ export const serviceProto: ServiceProto = { } }, { - "id": 167, + "id": 169, "name": "hero/GetList", "type": "api" }, { - "id": 168, + "id": 170, "name": "hero/JinJie", "type": "api" }, { - "id": 169, + "id": 171, "name": "hero/LvUp", "type": "api", "conf": { @@ -2580,32 +2600,32 @@ export const serviceProto: ServiceProto = { } }, { - "id": 170, + "id": 172, "name": "hero/Potency", "type": "api" }, { - "id": 171, + "id": 173, "name": "hero/Rec", "type": "api" }, { - "id": 172, + "id": 174, "name": "hero/Reset", "type": "api" }, { - "id": 173, + "id": 175, "name": "hero/Talent", "type": "api" }, { - "id": 174, + "id": 176, "name": "hero/WeaponUp", "type": "api" }, { - "id": 175, + "id": 177, "name": "hongdian/Get", "type": "api", "conf": { @@ -2613,117 +2633,117 @@ export const serviceProto: ServiceProto = { } }, { - "id": 176, + "id": 178, "name": "item/GetList", "type": "api" }, { - "id": 177, + "id": 179, "name": "item/Use", "type": "api" }, { - "id": 178, + "id": 180, "name": "jiaotang/Lottery", "type": "api" }, { - "id": 179, + "id": 181, "name": "jiaotang/Open", "type": "api" }, { - "id": 180, + "id": 182, "name": "jiuba/Lottery", "type": "api" }, { - "id": 181, + "id": 183, "name": "jiuba/Open", "type": "api" }, { - "id": 182, + "id": 184, "name": "jjc/BuyFightNum", "type": "api" }, { - "id": 183, + "id": 185, "name": "jjc/Fight", "type": "api" }, { - "id": 184, + "id": 186, "name": "jjc/FightLog", "type": "api" }, { - "id": 185, + "id": 187, "name": "jjc/Open", "type": "api" }, { - "id": 186, + "id": 188, "name": "jjc/Receive", "type": "api" }, { - "id": 187, + "id": 189, "name": "jjc/Refresh", "type": "api" }, { - "id": 188, + "id": 190, "name": "kaifujingsai/Open", "type": "api" }, { - "id": 189, + "id": 191, "name": "kaifujingsai/Receive", "type": "api" }, { - "id": 190, + "id": 192, "name": "kbzz/Apply", "type": "api" }, { - "id": 191, + "id": 193, "name": "kbzz/AutoApply", "type": "api" }, { - "id": 192, + "id": 194, "name": "kbzz/BuyNum", "type": "api" }, { - "id": 193, + "id": 195, "name": "kbzz/Fight", "type": "api" }, { - "id": 194, + "id": 196, "name": "kbzz/FightLog", "type": "api" }, { - "id": 195, + "id": 197, "name": "kbzz/GroupState", "type": "api" }, { - "id": 196, + "id": 198, "name": "kbzz/Open", "type": "api" }, { - "id": 197, + "id": 199, "name": "kbzz/RecPrize", "type": "api" }, { - "id": 198, + "id": 200, "name": "kbzz/Refresh", "type": "api", "conf": { @@ -2731,282 +2751,282 @@ export const serviceProto: ServiceProto = { } }, { - "id": 199, + "id": 201, "name": "kuangdong/AddPkNum", "type": "api" }, { - "id": 200, + "id": 202, "name": "kuangdong/GetPrize", "type": "api" }, { - "id": 201, + "id": 203, "name": "kuangdong/KdInfo", "type": "api" }, { - "id": 202, + "id": 204, "name": "kuangdong/Log", "type": "api" }, { - "id": 203, + "id": 205, "name": "kuangdong/Open", "type": "api" }, { - "id": 204, + "id": 206, "name": "kuangdong/YanShi", "type": "api" }, { - "id": 205, + "id": 207, "name": "kuangdong/ZhanLing", "type": "api" }, { - "id": 206, + "id": 208, "name": "lingzhulaixi/Open", "type": "api" }, { - "id": 207, + "id": 209, "name": "lingzhulaixi/PkBoss", "type": "api" }, { - "id": 208, + "id": 210, "name": "lingzhulaixi/PkRank", "type": "api" }, { - "id": 209, + "id": 211, "name": "lingzhulaixi/SaoDang", "type": "api" }, { - "id": 210, + "id": 212, "name": "meirishilian/Buy", "type": "api" }, { - "id": 211, + "id": 213, "name": "meirishilian/Fight", "type": "api" }, { - "id": 212, + "id": 214, "name": "meirishilian/Open", "type": "api" }, { - "id": 213, + "id": 215, "name": "msg_c2s/BindUid", "type": "msg" }, { - "id": 214, + "id": 216, "name": "msg_c2s/Pay", "type": "msg" }, { - "id": 215, + "id": 217, "name": "msg_c2s/Sync", "type": "msg" }, { - "id": 216, + "id": 218, "name": "msg_s2c/Chat", "type": "msg" }, { - "id": 217, + "id": 219, "name": "msg_s2c/ChatHelp", "type": "msg" }, { - "id": 218, + "id": 220, "name": "msg_s2c/Collection", "type": "msg" }, { - "id": 219, + "id": 221, "name": "msg_s2c/Email", "type": "msg" }, { - "id": 220, + "id": 222, "name": "msg_s2c/EmailDel", "type": "msg" }, { - "id": 221, + "id": 223, "name": "msg_s2c/EquipChange", "type": "msg" }, { - "id": 222, + "id": 224, "name": "msg_s2c/Friend", "type": "msg" }, { - "id": 223, + "id": 225, "name": "msg_s2c/GhChange", "type": "msg" }, { - "id": 224, + "id": 226, "name": "msg_s2c/GongHuiBaoZang", "type": "msg" }, { - "id": 225, + "id": 227, "name": "msg_s2c/HeroChange", "type": "msg" }, { - "id": 226, + "id": 228, "name": "msg_s2c/HongDianChange", "type": "msg" }, { - "id": 227, + "id": 229, "name": "msg_s2c/ItemChange", "type": "msg" }, { - "id": 228, + "id": 230, "name": "msg_s2c/LoginQueue", "type": "msg" }, { - "id": 229, + "id": 231, "name": "msg_s2c/LshdChange", "type": "msg" }, { - "id": 230, + "id": 232, "name": "msg_s2c/NewDay", "type": "msg" }, { - "id": 231, + "id": 233, "name": "msg_s2c/OtherLogin", "type": "msg" }, { - "id": 232, + "id": 234, "name": "msg_s2c/PayChange", "type": "msg" }, { - "id": 233, + "id": 235, "name": "msg_s2c/PayResult", "type": "msg" }, { - "id": 234, + "id": 236, "name": "msg_s2c/PeijianChange", "type": "msg" }, { - "id": 235, + "id": 237, "name": "msg_s2c/PlayerChange", "type": "msg" }, { - "id": 236, + "id": 238, "name": "msg_s2c/Private", "type": "msg" }, { - "id": 237, + "id": 239, "name": "msg_s2c/SendGift", "type": "msg" }, { - "id": 238, + "id": 240, "name": "msg_s2c/ShiwuChange", "type": "msg" }, { - "id": 239, + "id": 241, "name": "msg_s2c/TaskChange", "type": "msg" }, { - "id": 240, + "id": 242, "name": "msg_s2c/Xianshilibao", "type": "msg" }, { - "id": 241, + "id": 243, "name": "pata/Fight", "type": "api" }, { - "id": 242, + "id": 244, "name": "pata/GetPrize", "type": "api" }, { - "id": 243, + "id": 245, "name": "pata/Open", "type": "api" }, { - "id": 244, + "id": 246, "name": "pata/SaoDang", "type": "api" }, { - "id": 245, + "id": 247, "name": "pay/GetList", "type": "api" }, { - "id": 246, + "id": 248, "name": "peijian/GetList", "type": "api" }, { - "id": 247, + "id": 249, "name": "peijian/JingLian", "type": "api" }, { - "id": 248, + "id": 250, "name": "peijian/JinJie", "type": "api" }, { - "id": 249, + "id": 251, "name": "peijian/LvUp", "type": "api" }, { - "id": 250, + "id": 252, "name": "peijian/OneKeyLvUp", "type": "api" }, { - "id": 251, + "id": 253, "name": "peijian/OneKeyWear", "type": "api" }, { - "id": 252, + "id": 254, "name": "peijian/Reset", "type": "api" }, { - "id": 253, + "id": 255, "name": "peijian/Rm", "type": "api" }, { - "id": 254, + "id": 256, "name": "peijian/TakeOff", "type": "api", "conf": { @@ -3014,32 +3034,32 @@ export const serviceProto: ServiceProto = { } }, { - "id": 255, + "id": 257, "name": "peijian/UnLock", "type": "api" }, { - "id": 256, + "id": 258, "name": "peijian/Wear", "type": "api" }, { - "id": 257, + "id": 259, "name": "peijiancangku/Deal", "type": "api" }, { - "id": 258, + "id": 260, "name": "peijiancangku/Jump", "type": "api" }, { - "id": 259, + "id": 261, "name": "peijiancangku/Open", "type": "api" }, { - "id": 260, + "id": 262, "name": "Bingo", "type": "api", "conf": { @@ -3047,137 +3067,137 @@ export const serviceProto: ServiceProto = { } }, { - "id": 261, + "id": 263, "name": "FightTest", "type": "api" }, { - "id": 262, + "id": 264, "name": "SyncBtn", "type": "api" }, { - "id": 263, + "id": 265, "name": "Test", "type": "api" }, { - "id": 264, + "id": 266, "name": "qjzzd/Fight", "type": "api" }, { - "id": 265, + "id": 267, "name": "qjzzd/Open", "type": "api" }, { - "id": 266, + "id": 268, "name": "rank/Open", "type": "api" }, { - "id": 267, + "id": 269, "name": "shiwu/Concise", "type": "api" }, { - "id": 268, + "id": 270, "name": "shiwu/Extract", "type": "api" }, { - "id": 269, + "id": 271, "name": "shiwu/GetList", "type": "api" }, { - "id": 270, + "id": 272, "name": "shiwu/LvUp", "type": "api" }, { - "id": 271, + "id": 273, "name": "shiwu/Recast", "type": "api" }, { - "id": 272, + "id": 274, "name": "shiwu/TakeOff", "type": "api" }, { - "id": 273, + "id": 275, "name": "shiwu/Wear", "type": "api" }, { - "id": 274, + "id": 276, "name": "shootGame/Open", "type": "api" }, { - "id": 275, + "id": 277, "name": "shootGame/Rec", "type": "api" }, { - "id": 276, + "id": 278, "name": "shop/Buy", "type": "api" }, { - "id": 277, + "id": 279, "name": "shop/Open", "type": "api" }, { - "id": 278, + "id": 280, "name": "shop/Refresh", "type": "api" }, { - "id": 279, + "id": 281, "name": "sign/GetBoxPrize", "type": "api" }, { - "id": 280, + "id": 282, "name": "sign/GetPrize", "type": "api" }, { - "id": 281, + "id": 283, "name": "sign/Open", "type": "api" }, { - "id": 282, + "id": 284, "name": "slzd/Aim", "type": "api" }, { - "id": 283, + "id": 285, "name": "slzd/BuyNum", "type": "api" }, { - "id": 284, + "id": 286, "name": "slzd/Fight", "type": "api" }, { - "id": 285, + "id": 287, "name": "slzd/FightLog", "type": "api" }, { - "id": 286, + "id": 288, "name": "slzd/MyRank", "type": "api" }, { - "id": 287, + "id": 289, "name": "slzd/Open", "type": "api", "conf": { @@ -3187,77 +3207,77 @@ export const serviceProto: ServiceProto = { } }, { - "id": 288, + "id": 290, "name": "slzd/OpenFort", "type": "api" }, { - "id": 289, + "id": 291, "name": "slzd/Rec", "type": "api" }, { - "id": 290, + "id": 292, "name": "slzd/Refresh", "type": "api" }, { - "id": 291, + "id": 293, "name": "slzd/Slot", "type": "api" }, { - "id": 292, + "id": 294, "name": "tanxian/Event", "type": "api" }, { - "id": 293, + "id": 295, "name": "tanxian/FastGuaJi", "type": "api" }, { - "id": 294, + "id": 296, "name": "tanxian/Fight", "type": "api" }, { - "id": 295, + "id": 297, "name": "tanxian/GuaJi", "type": "api" }, { - "id": 296, + "id": 298, "name": "tanxian/Open", "type": "api" }, { - "id": 297, + "id": 299, "name": "tanxian/Receive", "type": "api" }, { - "id": 298, + "id": 300, "name": "task/AllFinsh", "type": "api" }, { - "id": 299, + "id": 301, "name": "task/Finsh", "type": "api" }, { - "id": 300, + "id": 302, "name": "task/Open", "type": "api" }, { - "id": 301, + "id": 303, "name": "user/CDKEY", "type": "api" }, { - "id": 302, + "id": 304, "name": "user/ChangeInfo", "type": "api", "conf": { @@ -3265,197 +3285,197 @@ export const serviceProto: ServiceProto = { } }, { - "id": 303, + "id": 305, "name": "user/ChangeName", "type": "api" }, { - "id": 304, + "id": 306, "name": "user/Fight", "type": "api" }, { - "id": 305, + "id": 307, "name": "user/GetInfo", "type": "api" }, { - "id": 306, + "id": 308, "name": "user/InfoOpen", "type": "api" }, { - "id": 307, + "id": 309, "name": "user/Login", "type": "api" }, { - "id": 308, + "id": 310, "name": "user/Ping", "type": "api" }, { - "id": 309, + "id": 311, "name": "user/Renown", "type": "api" }, { - "id": 310, + "id": 312, "name": "user/RenownBuy", "type": "api" }, { - "id": 311, + "id": 313, "name": "user/RenownGetPrize", "type": "api" }, { - "id": 312, + "id": 314, "name": "user/RenownOpen", "type": "api" }, { - "id": 313, + "id": 315, "name": "user/Tujian", "type": "api" }, { - "id": 314, + "id": 316, "name": "weixiuchang/Decompose", "type": "api" }, { - "id": 315, + "id": 317, "name": "weixiuchang/Exchange", "type": "api" }, { - "id": 316, + "id": 318, "name": "weixiuchang/Open", "type": "api" }, { - "id": 317, + "id": 319, "name": "weixiuchang/UpLv", "type": "api" }, { - "id": 318, + "id": 320, "name": "weixiuchang/UpStar", "type": "api" }, { - "id": 319, + "id": 321, "name": "wzry/AutoBaoMing", "type": "api" }, { - "id": 320, + "id": 322, "name": "wzry/BaoMing", "type": "api" }, { - "id": 321, + "id": 323, "name": "wzry/catFightLog", "type": "api" }, { - "id": 322, + "id": 324, "name": "wzry/CatGroup", "type": "api" }, { - "id": 323, + "id": 325, "name": "wzry/DldFight", "type": "api" }, { - "id": 324, + "id": 326, "name": "wzry/DldRefre", "type": "api" }, { - "id": 325, + "id": 327, "name": "wzry/JingCai", "type": "api" }, { - "id": 326, + "id": 328, "name": "wzry/JingCaiOpen", "type": "api" }, { - "id": 327, + "id": 329, "name": "wzry/Open", "type": "api" }, { - "id": 328, + "id": 330, "name": "wzry/UpdateFight", "type": "api" }, { - "id": 329, + "id": 331, "name": "wzry/Wzzd", "type": "api" }, { - "id": 330, + "id": 332, "name": "wzry/ZuanShiOpen", "type": "api" }, { - "id": 331, + "id": 333, "name": "xstask/AllGet", "type": "api" }, { - "id": 332, + "id": 334, "name": "xstask/Get", "type": "api" }, { - "id": 333, + "id": 335, "name": "xstask/LvUp", "type": "api" }, { - "id": 334, + "id": 336, "name": "xstask/OnekeyReceive", "type": "api" }, { - "id": 335, + "id": 337, "name": "xstask/Open", "type": "api" }, { - "id": 336, + "id": 338, "name": "xstask/Receive", "type": "api" }, { - "id": 337, + "id": 339, "name": "xstask/Refresh", "type": "api" }, { - "id": 338, + "id": 340, "name": "yongbingzhuzhan/Handle", "type": "api" }, { - "id": 339, + "id": 341, "name": "zhanqianbushu/ChangePos", "type": "api" }, { - "id": 340, + "id": 342, "name": "zhanqianbushu/Select", "type": "api" }, { - "id": 341, + "id": 343, "name": "zhanqianbushu/Up", "type": "api" } @@ -10085,6 +10105,76 @@ export const serviceProto: ServiceProto = { } ] }, + "event/payForDiamond/PtlCanReceive/ReqCanReceive": { + "type": "Interface", + "properties": [ + { + "id": 0, + "name": "activityId", + "type": { + "type": "Number" + } + } + ] + }, + "event/payForDiamond/PtlCanReceive/ResCanReceive": { + "type": "Interface", + "properties": [ + { + "id": 0, + "name": "payNum", + "type": { + "type": "Number" + } + }, + { + "id": 1, + "name": "remaining", + "type": { + "type": "Number" + }, + "optional": true + }, + { + "id": 2, + "name": "result", + "type": { + "type": "Boolean" + } + } + ] + }, + "event/payForDiamond/PtlReceive/ReqReceive": { + "type": "Interface", + "properties": [ + { + "id": 0, + "name": "activityId", + "type": { + "type": "Number" + } + } + ] + }, + "event/payForDiamond/PtlReceive/ResReceive": { + "type": "Interface", + "properties": [ + { + "id": 0, + "name": "amount", + "type": { + "type": "Number" + } + }, + { + "id": 1, + "name": "timesRemaining", + "type": { + "type": "Number" + } + } + ] + }, "event/qirichongzhi/PtlOpen/ReqOpen": { "type": "Interface" }, From ba8653dca98515047b940363e9c9e8487c9f999c Mon Sep 17 00:00:00 2001 From: chenkai Date: Thu, 21 Dec 2023 21:08:22 +0800 Subject: [PATCH 04/19] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=E9=A2=86?= =?UTF-8?q?=E5=8F=96=E6=95=B0=E9=A2=9D=E7=9A=84=E6=9C=80=E5=A4=A7=E5=80=BC?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api_s2c/event/payForDiamond/ApiReceive.ts | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/api_s2c/event/payForDiamond/ApiReceive.ts b/src/api_s2c/event/payForDiamond/ApiReceive.ts index 8aaf8e6..aaf8a56 100644 --- a/src/api_s2c/event/payForDiamond/ApiReceive.ts +++ b/src/api_s2c/event/payForDiamond/ApiReceive.ts @@ -13,35 +13,46 @@ type diamondWeightGroup = { * @param groups 各分组及其权重 */ function randomWithWeight(groups: diamondWeightGroup[]) { + let maxAmount: number; let totalWeights = 0; for (const group of groups) { totalWeights += group.weight; + if (!maxAmount) { + maxAmount = group.numrange[1]; + } else { + maxAmount = Math.min(maxAmount, group.numrange[1]); + } } const randomValue = Math.random() * totalWeights; // 随机值落在[0, totalWeights) 之间 let currSum = 0; for (const group of groups) { if (currSum <= randomValue && randomValue < currSum + group.weight) { - return group; + return { group, maxAmount }; } else { currSum += group.weight; } } const length = groups.length; - return groups[length - 1]; + return { group: groups[length - 1], maxAmount }; } /** * 计算玩家分得的钻石数量 * @param remaining * @param group + * @param maxAmount */ -function calcDiamondGot(remaining: number, group: diamondWeightGroup) { +function calcDiamondGot(remaining: number, group: diamondWeightGroup, maxAmount: number) { const [min, max] = group.numrange; const randomAmount = Math.floor(Math.random() * (max - min)) + min + 1; // max 值应能够取到, 故 +1 // 剩余数额小于组内随机得到的值, 全给吧 if (randomAmount > remaining) { return remaining; } + // 随机值大于最大值, 取最大值 + if (randomAmount > maxAmount) { + return maxAmount; + } return randomAmount; } @@ -56,8 +67,8 @@ export default async function (call: ApiCall) { } const activityData = canReceiveResult.activityInfo.data; const remaining = activityData['remaining']? activityData['remaining'] : activityData['totalmoney']; - const group = randomWithWeight(activityData['groupConf']['arr']); - const gotAmount = calcDiamondGot(remaining, group); + const { group, maxAmount } = randomWithWeight(activityData['groupConf']['arr']); + const gotAmount = calcDiamondGot(remaining, group, maxAmount); // 减去余额 const filter = { hdid: call.req.activityId, From 4b190272b172f277053b66aeff566afb7db4c714 Mon Sep 17 00:00:00 2001 From: chenkai Date: Fri, 22 Dec 2023 10:11:24 +0800 Subject: [PATCH 05/19] =?UTF-8?q?fix:=20=E8=B0=83=E6=95=B4=20remaining=20?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api_s2c/event/payForDiamond/ApiCanReceive.ts | 2 +- src/api_s2c/event/payForDiamond/ApiReceive.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api_s2c/event/payForDiamond/ApiCanReceive.ts b/src/api_s2c/event/payForDiamond/ApiCanReceive.ts index b77fe24..a39596f 100644 --- a/src/api_s2c/event/payForDiamond/ApiCanReceive.ts +++ b/src/api_s2c/event/payForDiamond/ApiCanReceive.ts @@ -8,7 +8,7 @@ export async function playerCanReceive(call: ApiCall) { if (!activityInfo) { return call.error('No such activity'); } - const remaining = activityInfo.data['remaining']; + const remaining = typeof activityInfo.data['remaining'] === 'number'? activityInfo.data['remaining'] : activityInfo.data['totalmoney']; const zeroTime = PublicShared.getToDayZeroTime(); const dayPayInfo = await G.mongodb.collection('dayPay').findOne({ uid: call.uid, time: zeroTime }); if (!dayPayInfo || !dayPayInfo.payNum) { diff --git a/src/api_s2c/event/payForDiamond/ApiReceive.ts b/src/api_s2c/event/payForDiamond/ApiReceive.ts index aaf8a56..bb1d00d 100644 --- a/src/api_s2c/event/payForDiamond/ApiReceive.ts +++ b/src/api_s2c/event/payForDiamond/ApiReceive.ts @@ -66,7 +66,7 @@ export default async function (call: ApiCall) { }); } const activityData = canReceiveResult.activityInfo.data; - const remaining = activityData['remaining']? activityData['remaining'] : activityData['totalmoney']; + const remaining = typeof activityData['remaining'] === 'number'? activityData['remaining'] : activityData['totalmoney']; const { group, maxAmount } = randomWithWeight(activityData['groupConf']['arr']); const gotAmount = calcDiamondGot(remaining, group, maxAmount); // 减去余额 From 76a04a34d5b6ca9e3eaaf4d66dd304786c1fd205 Mon Sep 17 00:00:00 2001 From: chenkai Date: Fri, 22 Dec 2023 11:30:54 +0800 Subject: [PATCH 06/19] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20groups=20?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=8F=96=E5=80=BC=E9=94=99=E8=AF=AF=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 bb1d00d..cb45b06 100644 --- a/src/api_s2c/event/payForDiamond/ApiReceive.ts +++ b/src/api_s2c/event/payForDiamond/ApiReceive.ts @@ -67,7 +67,7 @@ export default async function (call: ApiCall) { } const activityData = canReceiveResult.activityInfo.data; const remaining = typeof activityData['remaining'] === 'number'? activityData['remaining'] : activityData['totalmoney']; - const { group, maxAmount } = randomWithWeight(activityData['groupConf']['arr']); + const { group, maxAmount } = randomWithWeight(activityData['groupConf']['base']['arr']); const gotAmount = calcDiamondGot(remaining, group, maxAmount); // 减去余额 const filter = { From e0a624adba9ecd108fed3d123688101d0de812ca Mon Sep 17 00:00:00 2001 From: chenkai Date: Fri, 22 Dec 2023 12:11:20 +0800 Subject: [PATCH 07/19] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=E9=A2=86?= =?UTF-8?q?=E5=8F=96=E6=97=A5=E5=BF=97=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../event/payForDiamond/ApiCanReceive.ts | 14 ++++---- src/api_s2c/event/payForDiamond/ApiReceive.ts | 34 +++++++------------ .../event/payForDiamond/PtlCanReceive.ts | 1 + .../event/payForDiamond/PtlReceive.ts | 1 + src/shared/protocols/serviceProto.ts | 17 ++++++++++ 5 files changed, 40 insertions(+), 27 deletions(-) diff --git a/src/api_s2c/event/payForDiamond/ApiCanReceive.ts b/src/api_s2c/event/payForDiamond/ApiCanReceive.ts index a39596f..addccf7 100644 --- a/src/api_s2c/event/payForDiamond/ApiCanReceive.ts +++ b/src/api_s2c/event/payForDiamond/ApiCanReceive.ts @@ -8,19 +8,20 @@ export async function playerCanReceive(call: ApiCall) { if (!activityInfo) { return call.error('No such activity'); } - const remaining = typeof activityInfo.data['remaining'] === 'number'? activityInfo.data['remaining'] : activityInfo.data['totalmoney']; + const remaining = activityInfo.data['totalmoney']; + const showOffList = activityInfo.data['showOffList'] || []; const zeroTime = PublicShared.getToDayZeroTime(); const dayPayInfo = await G.mongodb.collection('dayPay').findOne({ uid: call.uid, time: zeroTime }); if (!dayPayInfo || !dayPayInfo.payNum) { return { - payNum: 0, remaining, result: false, activityInfo + payNum: 0, remaining, result: false, activityInfo, showOffList }; } const payNum = dayPayInfo.payNum; // 玩家充值未达标或者奖池余额耗尽则不能领取 if (payNum < activityInfo.data['price'] || remaining <= 0) { return { - payNum, remaining, result: false, activityInfo + payNum, remaining, result: false, activityInfo, showOffList } } // 检查玩家今日是否已经领取 @@ -28,18 +29,19 @@ export async function playerCanReceive(call: ApiCall) { if (playerActivityInfo) { if (playerActivityInfo[zeroTime]?.length) { return { - payNum, remaining, result: false, activityInfo + payNum, remaining, result: false, activityInfo, showOffList }; } } return { - payNum, remaining, result: true, activityInfo + payNum, remaining, result: true, activityInfo, showOffList }; } export default async function (call: ApiCall) { const canReceiveResult = await playerCanReceive(call); if (canReceiveResult) { - call.succ(canReceiveResult); + const { payNum, remaining, result, showOffList } = canReceiveResult; + call.succ({ payNum, remaining, result, showOffList }); } } \ No newline at end of file diff --git a/src/api_s2c/event/payForDiamond/ApiReceive.ts b/src/api_s2c/event/payForDiamond/ApiReceive.ts index cb45b06..768fed2 100644 --- a/src/api_s2c/event/payForDiamond/ApiReceive.ts +++ b/src/api_s2c/event/payForDiamond/ApiReceive.ts @@ -62,31 +62,31 @@ export default async function (call: ApiCall) { if (!canReceiveResult.result) { return call.succ({ amount: 0, - timesRemaining: 0 + timesRemaining: 0, + showOff: false }); } const activityData = canReceiveResult.activityInfo.data; - const remaining = typeof activityData['remaining'] === 'number'? activityData['remaining'] : activityData['totalmoney']; + const remaining = activityData['totalmoney']; const { group, maxAmount } = randomWithWeight(activityData['groupConf']['base']['arr']); const gotAmount = calcDiamondGot(remaining, group, maxAmount); // 减去余额 const filter = { hdid: call.req.activityId, - $or: [ - {'data.remaining': { $exists: false }}, - {$expr: {$gte: [ `$data.remaining - ${gotAmount}`, 0 ]}}, - ], + $expr: {$gte: [ `$data.totalmoney - ${gotAmount}`, 0 ]}, }; const updateDoc = { - $set: { 'data.remaining': `$data.remaining - ${gotAmount}` } + $inc: { 'data.totalmoney': -1 * Math.abs(gotAmount) } } const updateResult = await G.mongodb.collection('hdinfo').updateOne(filter, updateDoc); // 更新成功 if (updateResult.modifiedCount) { + const showOff = gotAmount >= activityData['groupConf']['base']['loglimit']; // 请求返回 call.succ({ amount: gotAmount, - timesRemaining: 0 + timesRemaining: 0, + showOff, }); // 添加玩家领取记录 const zeroTime = PublicShared.getToDayZeroTime(); @@ -95,19 +95,11 @@ export default async function (call: ApiCall) { G.mongodb.cEvent('payForDiamond').updateOne({ uid: call.uid }, { $set: setObj }); + // 记录玩家日志. 仅保留最近 10 条 + if (showOff) { + G.mongodb.collection('hdinfo').updateOne({ hdid: call.req.activityId, }, { $push: { 'data.showOffList': { $each: [{ name: call.conn.gud.name, gotAmount }], $slice: -10 }}}); + } } - // 发送炫耀 - if (gotAmount >= activityData['groupConf']['base']['loglimit']) { - ChatFun.newMsg({ - type: 'local', - msg: G.gc.pmd.get_hero_star5_pmd, - time: G.time, - sender: 'system', - otherData: { - pmd: true, - args: [gotAmount] - } - }); - } + } } \ No newline at end of file diff --git a/src/shared/protocols/event/payForDiamond/PtlCanReceive.ts b/src/shared/protocols/event/payForDiamond/PtlCanReceive.ts index 8d905ec..e7c8b13 100644 --- a/src/shared/protocols/event/payForDiamond/PtlCanReceive.ts +++ b/src/shared/protocols/event/payForDiamond/PtlCanReceive.ts @@ -6,4 +6,5 @@ export type ResCanReceive = { payNum: number; remaining?: number; result: boolean; + showOffList: any[]; }; \ No newline at end of file diff --git a/src/shared/protocols/event/payForDiamond/PtlReceive.ts b/src/shared/protocols/event/payForDiamond/PtlReceive.ts index beb4bf8..6fe6681 100644 --- a/src/shared/protocols/event/payForDiamond/PtlReceive.ts +++ b/src/shared/protocols/event/payForDiamond/PtlReceive.ts @@ -5,4 +5,5 @@ export type ReqReceive = { export type ResReceive = { amount: number, timesRemaining: number; + showOff: boolean; }; diff --git a/src/shared/protocols/serviceProto.ts b/src/shared/protocols/serviceProto.ts index 5bef3a2..db94cdb 100644 --- a/src/shared/protocols/serviceProto.ts +++ b/src/shared/protocols/serviceProto.ts @@ -10141,6 +10141,16 @@ export const serviceProto: ServiceProto = { "type": { "type": "Boolean" } + }, + { + "id": 3, + "name": "showOffList", + "type": { + "type": "Array", + "elementType": { + "type": "Any" + } + } } ] }, @@ -10172,6 +10182,13 @@ export const serviceProto: ServiceProto = { "type": { "type": "Number" } + }, + { + "id": 2, + "name": "showOff", + "type": { + "type": "Boolean" + } } ] }, From 06062716efa7b25ec3b98c93b94434da60ff8091 Mon Sep 17 00:00:00 2001 From: chenkai Date: Fri, 22 Dec 2023 13:40:13 +0800 Subject: [PATCH 08/19] =?UTF-8?q?fix:=20=E8=B0=83=E6=95=B4=E9=A2=86?= =?UTF-8?q?=E5=8F=96=E6=97=B6=E6=9F=A5=E8=AF=A2=E7=9A=84=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E8=A1=A8=E8=BE=BE=E5=BC=8F?= 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 768fed2..3ceedf5 100644 --- a/src/api_s2c/event/payForDiamond/ApiReceive.ts +++ b/src/api_s2c/event/payForDiamond/ApiReceive.ts @@ -73,7 +73,7 @@ export default async function (call: ApiCall) { // 减去余额 const filter = { hdid: call.req.activityId, - $expr: {$gte: [ `$data.totalmoney - ${gotAmount}`, 0 ]}, + $expr: { $gte: ['$data.totalmoney', gotAmount ]}, }; const updateDoc = { $inc: { 'data.totalmoney': -1 * Math.abs(gotAmount) } From c5817b4acff09ecc2fda7f2ba7ab95cadbc6becb Mon Sep 17 00:00:00 2001 From: chenkai Date: Fri, 22 Dec 2023 13:57:02 +0800 Subject: [PATCH 09/19] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=E7=8E=A9?= =?UTF-8?q?=E5=AE=B6=E9=A2=86=E5=8F=96=E8=AE=B0=E5=BD=95=E7=9A=84=20upsert?= =?UTF-8?q?=20=E9=80=89=E9=A1=B9?= 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 3ceedf5..74d0170 100644 --- a/src/api_s2c/event/payForDiamond/ApiReceive.ts +++ b/src/api_s2c/event/payForDiamond/ApiReceive.ts @@ -94,7 +94,7 @@ export default async function (call: ApiCall) { setObj[zeroTime] = gotAmount; G.mongodb.cEvent('payForDiamond').updateOne({ uid: call.uid }, { $set: setObj - }); + }, {upsert: true}); // 记录玩家日志. 仅保留最近 10 条 if (showOff) { G.mongodb.collection('hdinfo').updateOne({ hdid: call.req.activityId, }, { $push: { 'data.showOffList': { $each: [{ name: call.conn.gud.name, gotAmount }], $slice: -10 }}}); From 86910e7ad7534b262772265a2ef61ec1fe5251e8 Mon Sep 17 00:00:00 2001 From: chenkai Date: Fri, 22 Dec 2023 14:05:15 +0800 Subject: [PATCH 10/19] =?UTF-8?q?debug:=20=E6=B7=BB=E5=8A=A0=E7=8E=A9?= =?UTF-8?q?=E5=AE=B6=E9=A2=86=E5=8F=96=E8=AE=B0=E5=BD=95=E7=9A=84=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api_s2c/event/payForDiamond/ApiReceive.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/api_s2c/event/payForDiamond/ApiReceive.ts b/src/api_s2c/event/payForDiamond/ApiReceive.ts index 74d0170..0bcaab3 100644 --- a/src/api_s2c/event/payForDiamond/ApiReceive.ts +++ b/src/api_s2c/event/payForDiamond/ApiReceive.ts @@ -92,12 +92,13 @@ export default async function (call: ApiCall) { const zeroTime = PublicShared.getToDayZeroTime(); const setObj = {}; setObj[zeroTime] = gotAmount; - G.mongodb.cEvent('payForDiamond').updateOne({ uid: call.uid }, { + const updatecEventResult = await G.mongodb.cEvent('payForDiamond').updateOne({ uid: call.uid }, { $set: setObj }, {upsert: true}); + console.log('updatecEventResult', JSON.stringify(updatecEventResult)); // 记录玩家日志. 仅保留最近 10 条 if (showOff) { - G.mongodb.collection('hdinfo').updateOne({ hdid: call.req.activityId, }, { $push: { 'data.showOffList': { $each: [{ name: call.conn.gud.name, gotAmount }], $slice: -10 }}}); + await G.mongodb.collection('hdinfo').updateOne({ hdid: call.req.activityId, }, { $push: { 'data.showOffList': { $each: [{ name: call.conn.gud.name, gotAmount }], $slice: -10 }}}); } } From 2a492a891936048ca3ae5fb9f41d42bfddeed386 Mon Sep 17 00:00:00 2001 From: chenkai Date: Fri, 22 Dec 2023 14:59:33 +0800 Subject: [PATCH 11/19] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=8E=A9?= =?UTF-8?q?=E5=AE=B6=E5=8F=AF=E4=BB=A5=E9=87=8D=E5=A4=8D=E9=A2=86=E5=8F=96?= =?UTF-8?q?=E7=9A=84=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api_s2c/event/payForDiamond/ApiCanReceive.ts | 11 ++++++----- src/api_s2c/event/payForDiamond/ApiReceive.ts | 3 +-- src/json/pmd.json5 | 4 +--- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/api_s2c/event/payForDiamond/ApiCanReceive.ts b/src/api_s2c/event/payForDiamond/ApiCanReceive.ts index addccf7..77f79fc 100644 --- a/src/api_s2c/event/payForDiamond/ApiCanReceive.ts +++ b/src/api_s2c/event/payForDiamond/ApiCanReceive.ts @@ -2,6 +2,7 @@ import { ApiCall } from "tsrpc"; import { HuoDongFun } from "../../../public/huodongfun"; import { ReqCanReceive, ResCanReceive } from '../../../shared/protocols/event/payForDiamond/PtlCanReceive'; import { PublicShared } from "../../../shared/public/public"; +import { ActionLog } from "../../../public/actionLog/actionLog"; export async function playerCanReceive(call: ApiCall) { const activityInfo = await HuoDongFun.getHdidInfo(call, call.req.activityId); @@ -11,13 +12,13 @@ export async function playerCanReceive(call: ApiCall) { const remaining = activityInfo.data['totalmoney']; const showOffList = activityInfo.data['showOffList'] || []; const zeroTime = PublicShared.getToDayZeroTime(); - const dayPayInfo = await G.mongodb.collection('dayPay').findOne({ uid: call.uid, time: zeroTime }); - if (!dayPayInfo || !dayPayInfo.payNum) { + const vipScore = await ActionLog.getDayLog(call.uid, 'pay'); + if (!vipScore) { return { payNum: 0, remaining, result: false, activityInfo, showOffList }; } - const payNum = dayPayInfo.payNum; + const payNum = vipScore; // 玩家充值未达标或者奖池余额耗尽则不能领取 if (payNum < activityInfo.data['price'] || remaining <= 0) { return { @@ -25,9 +26,9 @@ export async function playerCanReceive(call: ApiCall) { } } // 检查玩家今日是否已经领取 - const playerActivityInfo = G.mongodb.cEvent('payForDiamond').findOne({ uid: call.uid }); + const playerActivityInfo = await G.mongodb.cEvent('payForDiamond').findOne({ uid: call.uid, type: 'payForDiamond' }); if (playerActivityInfo) { - if (playerActivityInfo[zeroTime]?.length) { + if (playerActivityInfo[zeroTime]) { return { payNum, remaining, result: false, activityInfo, showOffList }; diff --git a/src/api_s2c/event/payForDiamond/ApiReceive.ts b/src/api_s2c/event/payForDiamond/ApiReceive.ts index 0bcaab3..315e517 100644 --- a/src/api_s2c/event/payForDiamond/ApiReceive.ts +++ b/src/api_s2c/event/payForDiamond/ApiReceive.ts @@ -92,10 +92,9 @@ export default async function (call: ApiCall) { const zeroTime = PublicShared.getToDayZeroTime(); const setObj = {}; setObj[zeroTime] = gotAmount; - const updatecEventResult = await G.mongodb.cEvent('payForDiamond').updateOne({ uid: call.uid }, { + await G.mongodb.cEvent('payForDiamond').updateOne({ uid: call.uid, type: 'payForDiamond' }, { $set: setObj }, {upsert: true}); - console.log('updatecEventResult', JSON.stringify(updatecEventResult)); // 记录玩家日志. 仅保留最近 10 条 if (showOff) { await G.mongodb.collection('hdinfo').updateOne({ hdid: call.req.activityId, }, { $push: { 'data.showOffList': { $each: [{ name: call.conn.gud.name, gotAmount }], $slice: -10 }}}); diff --git a/src/json/pmd.json5 b/src/json/pmd.json5 index bd2ec62..2e0db1c 100644 --- a/src/json/pmd.json5 +++ b/src/json/pmd.json5 @@ -14,7 +14,5 @@ //黑帮争霸争霸赛第二名 hbzb_pmd2: 'intr_pmd_hbzb2', //黑帮争霸争霸赛第三名 - hbzb_pmd3: 'intr_pmd_hbzb3', - // 充值抢钻石 - 抢到大量钻石 - pay_for_diamond: 'intr_pmd_pfd' + hbzb_pmd3: 'intr_pmd_hbzb3' } \ No newline at end of file From 36b15af077c1482a5d8b7cd56f7ff24f95103c74 Mon Sep 17 00:00:00 2001 From: chenkai Date: Fri, 22 Dec 2023 16:34:54 +0800 Subject: [PATCH 12/19] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=20price=20?= =?UTF-8?q?=E5=9B=9E=E5=8F=82=E8=A1=A8=E7=A4=BA=E9=A2=86=E5=8F=96=E9=97=A8?= =?UTF-8?q?=E6=A7=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api_s2c/event/payForDiamond/ApiCanReceive.ts | 15 ++++++++------- .../event/payForDiamond/PtlCanReceive.ts | 1 + src/shared/protocols/serviceProto.ts | 7 +++++++ 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/api_s2c/event/payForDiamond/ApiCanReceive.ts b/src/api_s2c/event/payForDiamond/ApiCanReceive.ts index 77f79fc..feb4f1a 100644 --- a/src/api_s2c/event/payForDiamond/ApiCanReceive.ts +++ b/src/api_s2c/event/payForDiamond/ApiCanReceive.ts @@ -13,16 +13,17 @@ export async function playerCanReceive(call: ApiCall) { const showOffList = activityInfo.data['showOffList'] || []; const zeroTime = PublicShared.getToDayZeroTime(); const vipScore = await ActionLog.getDayLog(call.uid, 'pay'); + const price = activityInfo.data['price']; if (!vipScore) { return { - payNum: 0, remaining, result: false, activityInfo, showOffList + payNum: 0, remaining, result: false, activityInfo, showOffList, price }; } const payNum = vipScore; // 玩家充值未达标或者奖池余额耗尽则不能领取 - if (payNum < activityInfo.data['price'] || remaining <= 0) { + if (payNum < price || remaining <= 0) { return { - payNum, remaining, result: false, activityInfo, showOffList + payNum, remaining, result: false, activityInfo, showOffList, price } } // 检查玩家今日是否已经领取 @@ -30,19 +31,19 @@ export async function playerCanReceive(call: ApiCall) { if (playerActivityInfo) { if (playerActivityInfo[zeroTime]) { return { - payNum, remaining, result: false, activityInfo, showOffList + payNum, remaining, result: false, activityInfo, showOffList, price }; } } return { - payNum, remaining, result: true, activityInfo, showOffList + payNum, remaining, result: true, activityInfo, showOffList, price }; } export default async function (call: ApiCall) { const canReceiveResult = await playerCanReceive(call); if (canReceiveResult) { - const { payNum, remaining, result, showOffList } = canReceiveResult; - call.succ({ payNum, remaining, result, showOffList }); + const { payNum, remaining, result, showOffList, price } = canReceiveResult; + call.succ({ payNum, remaining, result, showOffList, price }); } } \ No newline at end of file diff --git a/src/shared/protocols/event/payForDiamond/PtlCanReceive.ts b/src/shared/protocols/event/payForDiamond/PtlCanReceive.ts index e7c8b13..1683937 100644 --- a/src/shared/protocols/event/payForDiamond/PtlCanReceive.ts +++ b/src/shared/protocols/event/payForDiamond/PtlCanReceive.ts @@ -6,5 +6,6 @@ export type ResCanReceive = { payNum: number; remaining?: number; result: boolean; + price: number; showOffList: any[]; }; \ No newline at end of file diff --git a/src/shared/protocols/serviceProto.ts b/src/shared/protocols/serviceProto.ts index db94cdb..5c1f8cc 100644 --- a/src/shared/protocols/serviceProto.ts +++ b/src/shared/protocols/serviceProto.ts @@ -10144,6 +10144,13 @@ export const serviceProto: ServiceProto = { }, { "id": 3, + "name": "price", + "type": { + "type": "Number" + } + }, + { + "id": 4, "name": "showOffList", "type": { "type": "Array", From eed6dd1b8f6fce61727bb80651b0f707deb40f25 Mon Sep 17 00:00:00 2001 From: chenkai Date: Fri, 22 Dec 2023 17:06:19 +0800 Subject: [PATCH 13/19] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=E7=BA=A2?= =?UTF-8?q?=E7=82=B9=E5=8F=8A=E7=8E=A9=E5=AE=B6=E5=8F=91=E5=A5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api_s2c/event/payForDiamond/ApiReceive.ts | 2 ++ src/api_s2c/hongdian/ApiGet.ts | 7 ++++++- src/shared/protocols/hongdian/PtlGet.ts | 3 ++- src/shared/protocols/serviceProto.ts | 7 +++++++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/api_s2c/event/payForDiamond/ApiReceive.ts b/src/api_s2c/event/payForDiamond/ApiReceive.ts index 315e517..62c51fd 100644 --- a/src/api_s2c/event/payForDiamond/ApiReceive.ts +++ b/src/api_s2c/event/payForDiamond/ApiReceive.ts @@ -3,6 +3,7 @@ import { ReqReceive, ResReceive } from '../../../shared/protocols/event/payForDi import { playerCanReceive } from './ApiCanReceive'; import { PublicShared } from "../../../shared/public/public"; import { ChatFun } from "../../../public/chat"; +import { PlayerFun } from "../../../public/player"; type diamondWeightGroup = { weight: number; @@ -82,6 +83,7 @@ export default async function (call: ApiCall) { // 更新成功 if (updateResult.modifiedCount) { const showOff = gotAmount >= activityData['groupConf']['base']['loglimit']; + await PlayerFun.sendPrize(call, [{ 'a': 'attr', 't': 'rmbmoney', 'n': gotAmount }]); // 请求返回 call.succ({ amount: gotAmount, diff --git a/src/api_s2c/hongdian/ApiGet.ts b/src/api_s2c/hongdian/ApiGet.ts index ce0c8d4..8572c81 100644 --- a/src/api_s2c/hongdian/ApiGet.ts +++ b/src/api_s2c/hongdian/ApiGet.ts @@ -15,11 +15,12 @@ import {md_redPoint} from '../gongyu/mingdao/ApiOpen'; import {HongDianFun, HuoDongHongDianFun} from "./fun"; import {FunWeiXiuChang} from "../../public/weixiuchang"; import {getShouChongRedPoint} from "../event/shouchong/ApiReceive"; +import { playerCanReceive } from '../event/payForDiamond/ApiCanReceive'; const defaultKeys: hongdianKey[] = ['jiuba', 'jiaotang', 'shouchong', 'clslhd', 'dixiaqianzhuanghd', 'gonghuihd', 'hbzbhd', 'jjchd', 'taskhd', 'xstaskhd', 'lingzhulaixihd', 'dxlthd', 'wzcjhd', 'slzdhd', 'qjzzdhd', 'kuangdonghd', 'qiandaohd', 'kaifukuanghuanhd', 'jijinhd', 'zhuishalinghd', 'yibaichouhd', 'huobanzhaomuhd', 'qirileichonghd', 'jierihd', 'kbzzhd', 'wzryhd', 'yuedujijin', 'mingdao', 'patahd', - 'heishihd', 'huodonghd', 'renown', 'weixiuchang', 'kaifujingsai', 'zhoumolibao']; + 'heishihd', 'huodonghd', 'renown', 'weixiuchang', 'kaifujingsai', 'zhoumolibao', 'payForDiamond']; export default async function (call: ApiCall) { @@ -163,6 +164,10 @@ export default async function (call: ApiCall) { case 'zhoumolibao': res[key] = await HongDianFun.zhoumolibao(call); break; + case 'payForDiamond': + const receiveResult = await playerCanReceive(call); + res[key] = { show: receiveResult && receiveResult.result }; + break; } } } diff --git a/src/shared/protocols/hongdian/PtlGet.ts b/src/shared/protocols/hongdian/PtlGet.ts index e09f771..7189cf6 100644 --- a/src/shared/protocols/hongdian/PtlGet.ts +++ b/src/shared/protocols/hongdian/PtlGet.ts @@ -51,7 +51,8 @@ export type hongdianKey = | 'heishiMrjx' | 'weixiuchang' | 'kaifujingsai' - | 'zhoumolibao'; + | 'zhoumolibao' + | 'payForDiamond'; export type hongdianVal = { diff --git a/src/shared/protocols/serviceProto.ts b/src/shared/protocols/serviceProto.ts index 5c1f8cc..fa32088 100644 --- a/src/shared/protocols/serviceProto.ts +++ b/src/shared/protocols/serviceProto.ts @@ -14969,6 +14969,13 @@ export const serviceProto: ServiceProto = { "type": "Literal", "literal": "zhoumolibao" } + }, + { + "id": 37, + "type": { + "type": "Literal", + "literal": "payForDiamond" + } } ] }, From 40774138d2694b9eabe89cf938cc03f9310bf7c0 Mon Sep 17 00:00:00 2001 From: chenkai Date: Fri, 22 Dec 2023 18:27:46 +0800 Subject: [PATCH 14/19] =?UTF-8?q?fix:=20=E5=B0=86=E6=B4=BB=E5=8A=A8?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E8=B7=A8=E6=9C=8D=E6=B4=BB=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../event/payForDiamond/ApiCanReceive.ts | 14 +++- src/api_s2c/event/payForDiamond/ApiReceive.ts | 84 +++++++++++-------- src/global.ts | 2 + src/ioredis.ts | 5 +- .../event/payForDiamond/PtlReceive.ts | 4 +- src/shared/protocols/serviceProto.ts | 6 +- 6 files changed, 72 insertions(+), 43 deletions(-) diff --git a/src/api_s2c/event/payForDiamond/ApiCanReceive.ts b/src/api_s2c/event/payForDiamond/ApiCanReceive.ts index feb4f1a..e356c2f 100644 --- a/src/api_s2c/event/payForDiamond/ApiCanReceive.ts +++ b/src/api_s2c/event/payForDiamond/ApiCanReceive.ts @@ -4,13 +4,21 @@ import { ReqCanReceive, ResCanReceive } from '../../../shared/protocols/event/pa import { PublicShared } from "../../../shared/public/public"; import { ActionLog } from "../../../public/actionLog/actionLog"; +const hasGotKeyPrefix = 'payForDiamond:hasGot:'; // 已领取额度 +const showOffListKeyPrefix = 'payForDiamond:ShowOff:'; // 需要炫耀的玩家列表。 其中需要包含信息:玩家区服, 玩家玩家名称, 领到的数量 + export async function playerCanReceive(call: ApiCall) { - const activityInfo = await HuoDongFun.getHdidInfo(call, call.req.activityId); + const activityId = call.req.activityId; + const activityInfo = await HuoDongFun.getHdidInfo(call, activityId); if (!activityInfo) { return call.error('No such activity'); } - const remaining = activityInfo.data['totalmoney']; - const showOffList = activityInfo.data['showOffList'] || []; + const hasReceivedKey = hasGotKeyPrefix + activityId; + const hasReceivedStr = await G.iorediscross.get(hasReceivedKey); + const hasReceived = hasReceivedStr? parseInt(hasReceivedStr) : 0; + const remaining = activityInfo.data['totalmoney'] - hasReceived; + const showOffResult = await G.iorediscross.lrange(showOffListKeyPrefix + activityId, 0, -1); + const showOffList = showOffResult.map(result => JSON.parse(result)); const zeroTime = PublicShared.getToDayZeroTime(); const vipScore = await ActionLog.getDayLog(call.uid, 'pay'); const price = activityInfo.data['price']; diff --git a/src/api_s2c/event/payForDiamond/ApiReceive.ts b/src/api_s2c/event/payForDiamond/ApiReceive.ts index 62c51fd..3343409 100644 --- a/src/api_s2c/event/payForDiamond/ApiReceive.ts +++ b/src/api_s2c/event/payForDiamond/ApiReceive.ts @@ -2,7 +2,6 @@ import { ApiCall } from "tsrpc"; import { ReqReceive, ResReceive } from '../../../shared/protocols/event/payForDiamond/PtlReceive'; import { playerCanReceive } from './ApiCanReceive'; import { PublicShared } from "../../../shared/public/public"; -import { ChatFun } from "../../../public/chat"; import { PlayerFun } from "../../../public/player"; type diamondWeightGroup = { @@ -10,6 +9,9 @@ type diamondWeightGroup = { numrange: [ min: number, max: number]; }; +const hasGotKeyPrefix = 'payForDiamond:hasGot:'; // 已领取额度 +const hasGotLockKey = "payForDiamond:lock"; // 更新锁, TTL 1s +const showOffListKeyPrefix = 'payForDiamond:ShowOff:'; // 需要炫耀的玩家列表。 其中需要包含信息:玩家区服, 玩家玩家名称, 领到的数量 /** * @param groups 各分组及其权重 */ @@ -59,7 +61,7 @@ function calcDiamondGot(remaining: number, group: diamondWeightGroup, maxAmount: export default async function (call: ApiCall) { const canReceiveResult = await playerCanReceive(call); - if (canReceiveResult) { + if (canReceiveResult) { // 该值不存在的情况已被函数直接返回 error, 无需再处理 if (!canReceiveResult.result) { return call.succ({ amount: 0, @@ -68,40 +70,52 @@ export default async function (call: ApiCall) { }); } const activityData = canReceiveResult.activityInfo.data; - const remaining = activityData['totalmoney']; - const { group, maxAmount } = randomWithWeight(activityData['groupConf']['base']['arr']); - const gotAmount = calcDiamondGot(remaining, group, maxAmount); - // 减去余额 - const filter = { - hdid: call.req.activityId, - $expr: { $gte: ['$data.totalmoney', gotAmount ]}, - }; - const updateDoc = { - $inc: { 'data.totalmoney': -1 * Math.abs(gotAmount) } - } - const updateResult = await G.mongodb.collection('hdinfo').updateOne(filter, updateDoc); - // 更新成功 - if (updateResult.modifiedCount) { - const showOff = gotAmount >= activityData['groupConf']['base']['loglimit']; - await PlayerFun.sendPrize(call, [{ 'a': 'attr', 't': 'rmbmoney', 'n': gotAmount }]); - // 请求返回 - call.succ({ - amount: gotAmount, - timesRemaining: 0, - showOff, - }); - // 添加玩家领取记录 - const zeroTime = PublicShared.getToDayZeroTime(); - const setObj = {}; - setObj[zeroTime] = gotAmount; - await G.mongodb.cEvent('payForDiamond').updateOne({ uid: call.uid, type: 'payForDiamond' }, { - $set: setObj - }, {upsert: true}); - // 记录玩家日志. 仅保留最近 10 条 - if (showOff) { - await G.mongodb.collection('hdinfo').updateOne({ hdid: call.req.activityId, }, { $push: { 'data.showOffList': { $each: [{ name: call.conn.gud.name, gotAmount }], $slice: -10 }}}); + // 更新 redis 领取记录之前先加锁, 防止多领 + const lockResult = await G.iorediscross.setnx(hasGotLockKey, 1); + if (lockResult) { + await G.iorediscross.expire(hasGotLockKey, 1); // 设置 ttl 避免死锁 + const activityId = call.req.activityId; + const hasReceivedKey = hasGotKeyPrefix + activityId; + const hasReceivedStr = await G.iorediscross.get(hasReceivedKey); + const hasReceived = hasReceivedStr? parseInt(hasReceivedStr) : 0; + const remaining = activityData['totalmoney'] - hasReceived; + if (remaining <= 0) { + return call.succ({ + amount: 0 + }); + } else { + const { group, maxAmount } = randomWithWeight(activityData['groupConf']['base']['arr']); + const gotAmount = calcDiamondGot(remaining, group, maxAmount); + await G.iorediscross.incrby(hasReceivedKey, -1 * Math.abs(gotAmount)); // 添加已领取的额度 + await G.iorediscross.del(); // 移除锁 + await PlayerFun.sendPrize(call, [{ 'a': 'attr', 't': 'rmbmoney', 'n': gotAmount }]); + const showOff = gotAmount >= activityData['groupConf']['base']['loglimit']; + call.succ({ // 领取核心逻辑完成, 请求可以返回了 + amount: gotAmount, + timesRemaining: 0, + showOff, + }); + // 添加玩家领取记录 + const zeroTime = PublicShared.getToDayZeroTime(); + const setObj = {}; + setObj[zeroTime] = gotAmount; + await G.mongodb.cEvent('payForDiamond').updateOne({ uid: call.uid, type: 'payForDiamond' }, { + $set: setObj + }, {upsert: true}); + // 炫耀 + if (showOff) { + const msg = JSON.stringify({ + name: call.conn.gud.name, gotAmount, serverID: call.conn.gud.sid + }); + const showOffListKey = showOffListKeyPrefix + activityId; + await G.iorediscross.lpush(showOffListKey, msg); + await G.ioredis.ltrim(showOffListKey, 0, 49); // 限制列表保存 50 条消息, 避免无限增长 + } } + } else { + return call.succ({ + amount: 0 + }); } - } } \ No newline at end of file diff --git a/src/global.ts b/src/global.ts index 30fa869..e8e35a5 100644 --- a/src/global.ts +++ b/src/global.ts @@ -92,6 +92,8 @@ class _G { redis: redisJsonFun; /**ioredis连接对象 */ ioredis: Redis; + /** 跨服 ioredis 连接对象 */ + iorediscross: Redis; /**mongodb连接对象 */ mongodb: _mongodb; /**crossmongodb连接对象 */ diff --git a/src/ioredis.ts b/src/ioredis.ts index a304d58..00d7f52 100644 --- a/src/ioredis.ts +++ b/src/ioredis.ts @@ -16,4 +16,7 @@ export async function initIORedis() { G.ioredis = new Redis(G.argv.serverType == 'cross' ? G.config.crossRedisUrl : G.config.redisUrl,{ keyPrefix: preKey, }); -} \ No newline at end of file + G.iorediscross = new Redis(G.config.crossRedisUrl,{ + keyPrefix: "cross_", + }); +} diff --git a/src/shared/protocols/event/payForDiamond/PtlReceive.ts b/src/shared/protocols/event/payForDiamond/PtlReceive.ts index 6fe6681..cbcda79 100644 --- a/src/shared/protocols/event/payForDiamond/PtlReceive.ts +++ b/src/shared/protocols/event/payForDiamond/PtlReceive.ts @@ -4,6 +4,6 @@ export type ReqReceive = { export type ResReceive = { amount: number, - timesRemaining: number; - showOff: boolean; + timesRemaining?: number; + showOff?: boolean; }; diff --git a/src/shared/protocols/serviceProto.ts b/src/shared/protocols/serviceProto.ts index fa32088..2a66905 100644 --- a/src/shared/protocols/serviceProto.ts +++ b/src/shared/protocols/serviceProto.ts @@ -10188,14 +10188,16 @@ export const serviceProto: ServiceProto = { "name": "timesRemaining", "type": { "type": "Number" - } + }, + "optional": true }, { "id": 2, "name": "showOff", "type": { "type": "Boolean" - } + }, + "optional": true } ] }, From 02dccd18a782288bfb81eed92fadc63df38d92ca Mon Sep 17 00:00:00 2001 From: chenkai Date: Fri, 22 Dec 2023 19:00:11 +0800 Subject: [PATCH 15/19] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=BB=86?= =?UTF-8?q?=E8=8A=82=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../event/payForDiamond/ApiCanReceive.ts | 22 ++++++++++++++----- src/api_s2c/event/payForDiamond/ApiReceive.ts | 4 ++-- src/api_s2c/hongdian/ApiGet.ts | 2 +- .../event/payForDiamond/PtlCanReceive.ts | 2 +- src/shared/protocols/serviceProto.ts | 3 ++- 5 files changed, 23 insertions(+), 10 deletions(-) diff --git a/src/api_s2c/event/payForDiamond/ApiCanReceive.ts b/src/api_s2c/event/payForDiamond/ApiCanReceive.ts index e356c2f..8a4a0a5 100644 --- a/src/api_s2c/event/payForDiamond/ApiCanReceive.ts +++ b/src/api_s2c/event/payForDiamond/ApiCanReceive.ts @@ -3,16 +3,28 @@ import { HuoDongFun } from "../../../public/huodongfun"; import { ReqCanReceive, ResCanReceive } from '../../../shared/protocols/event/payForDiamond/PtlCanReceive'; import { PublicShared } from "../../../shared/public/public"; import { ActionLog } from "../../../public/actionLog/actionLog"; +import { WithId, OptionalId } from "mongodb"; +import { ReqAddHuoDong } from "../../../monopoly/protocols/PtlAddHuoDong"; const hasGotKeyPrefix = 'payForDiamond:hasGot:'; // 已领取额度 const showOffListKeyPrefix = 'payForDiamond:ShowOff:'; // 需要炫耀的玩家列表。 其中需要包含信息:玩家区服, 玩家玩家名称, 领到的数量 -export async function playerCanReceive(call: ApiCall) { - const activityId = call.req.activityId; - const activityInfo = await HuoDongFun.getHdidInfo(call, activityId); - if (!activityInfo) { - return call.error('No such activity'); +export async function playerCanReceive(call: ApiCall, callError : boolean = true) { + let activityId = call.req.activityId; + let activityInfo: WithId>; + if (!activityId) { + activityInfo = (await HuoDongFun.gethdList(call, 13))[0]; + } else { + activityInfo = await HuoDongFun.getHdidInfo(call, activityId); } + if (!activityInfo && callError) { + if (callError) { + return call.error('', { code: -1, message: lng.huodong_open_1 }); + } else { + return { result: false }; + } + } + activityId = activityInfo.hdid; const hasReceivedKey = hasGotKeyPrefix + activityId; const hasReceivedStr = await G.iorediscross.get(hasReceivedKey); const hasReceived = hasReceivedStr? parseInt(hasReceivedStr) : 0; diff --git a/src/api_s2c/event/payForDiamond/ApiReceive.ts b/src/api_s2c/event/payForDiamond/ApiReceive.ts index 3343409..6165737 100644 --- a/src/api_s2c/event/payForDiamond/ApiReceive.ts +++ b/src/api_s2c/event/payForDiamond/ApiReceive.ts @@ -86,8 +86,8 @@ export default async function (call: ApiCall) { } else { const { group, maxAmount } = randomWithWeight(activityData['groupConf']['base']['arr']); const gotAmount = calcDiamondGot(remaining, group, maxAmount); - await G.iorediscross.incrby(hasReceivedKey, -1 * Math.abs(gotAmount)); // 添加已领取的额度 - await G.iorediscross.del(); // 移除锁 + await G.iorediscross.incrby(hasReceivedKey, Math.abs(gotAmount)); // 添加已领取的额度 + await G.iorediscross.del(hasGotLockKey); // 移除锁 await PlayerFun.sendPrize(call, [{ 'a': 'attr', 't': 'rmbmoney', 'n': gotAmount }]); const showOff = gotAmount >= activityData['groupConf']['base']['loglimit']; call.succ({ // 领取核心逻辑完成, 请求可以返回了 diff --git a/src/api_s2c/hongdian/ApiGet.ts b/src/api_s2c/hongdian/ApiGet.ts index 8572c81..4d36f30 100644 --- a/src/api_s2c/hongdian/ApiGet.ts +++ b/src/api_s2c/hongdian/ApiGet.ts @@ -165,7 +165,7 @@ export default async function (call: ApiCall) { res[key] = await HongDianFun.zhoumolibao(call); break; case 'payForDiamond': - const receiveResult = await playerCanReceive(call); + const receiveResult = await playerCanReceive(call, false); res[key] = { show: receiveResult && receiveResult.result }; break; } diff --git a/src/shared/protocols/event/payForDiamond/PtlCanReceive.ts b/src/shared/protocols/event/payForDiamond/PtlCanReceive.ts index 1683937..cd0b089 100644 --- a/src/shared/protocols/event/payForDiamond/PtlCanReceive.ts +++ b/src/shared/protocols/event/payForDiamond/PtlCanReceive.ts @@ -1,5 +1,5 @@ export type ReqCanReceive = { - activityId: number; + activityId?: number; }; export type ResCanReceive = { diff --git a/src/shared/protocols/serviceProto.ts b/src/shared/protocols/serviceProto.ts index 2a66905..8b3c4a8 100644 --- a/src/shared/protocols/serviceProto.ts +++ b/src/shared/protocols/serviceProto.ts @@ -10113,7 +10113,8 @@ export const serviceProto: ServiceProto = { "name": "activityId", "type": { "type": "Number" - } + }, + "optional": true } ] }, From 7eb34f872db3e5eaceec9ebeae25f3c523b93703 Mon Sep 17 00:00:00 2001 From: chenkai Date: Fri, 22 Dec 2023 19:26:18 +0800 Subject: [PATCH 16/19] =?UTF-8?q?fix:=20=E8=B0=83=E6=95=B4=E5=8F=AF?= =?UTF-8?q?=E9=A2=86=E5=8F=96=E7=BA=A2=E5=8C=85=E7=9A=84=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api_s2c/event/payForDiamond/ApiCanReceive.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api_s2c/event/payForDiamond/ApiCanReceive.ts b/src/api_s2c/event/payForDiamond/ApiCanReceive.ts index 8a4a0a5..9ef1d5c 100644 --- a/src/api_s2c/event/payForDiamond/ApiCanReceive.ts +++ b/src/api_s2c/event/payForDiamond/ApiCanReceive.ts @@ -17,7 +17,7 @@ export async function playerCanReceive(call: ApiCall, callError : boolean = true } else { activityInfo = await HuoDongFun.getHdidInfo(call, activityId); } - if (!activityInfo && callError) { + if (!activityInfo) { if (callError) { return call.error('', { code: -1, message: lng.huodong_open_1 }); } else { From bcca0ebbab8f43799f5d2d1bcaa329a6216a3658 Mon Sep 17 00:00:00 2001 From: chenkai Date: Fri, 22 Dec 2023 20:13:18 +0800 Subject: [PATCH 17/19] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=9C=80?= =?UTF-8?q?=E5=A4=A7=E6=80=BB=E9=A2=9D=E8=AE=A1=E7=AE=97=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E7=9A=84=20bug?= 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 6165737..32cc9cb 100644 --- a/src/api_s2c/event/payForDiamond/ApiReceive.ts +++ b/src/api_s2c/event/payForDiamond/ApiReceive.ts @@ -23,7 +23,7 @@ function randomWithWeight(groups: diamondWeightGroup[]) { if (!maxAmount) { maxAmount = group.numrange[1]; } else { - maxAmount = Math.min(maxAmount, group.numrange[1]); + maxAmount = Math.max(maxAmount, group.numrange[1]); } } const randomValue = Math.random() * totalWeights; // 随机值落在[0, totalWeights) 之间 From 4a6a40403d33639e1ae161e731e03063f3dc2516 Mon Sep 17 00:00:00 2001 From: chenkai Date: Fri, 22 Dec 2023 20:47:52 +0800 Subject: [PATCH 18/19] =?UTF-8?q?fix:=20canReceive=20=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=8E=A9=E5=AE=B6=E9=A2=86=E5=8F=96=E5=88=B0?= =?UTF-8?q?=E7=9A=84=E6=95=B0=E9=A2=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api_s2c/event/payForDiamond/ApiCanReceive.ts | 6 +++--- src/module/collection_event.ts | 2 +- src/shared/protocols/event/payForDiamond/PtlCanReceive.ts | 1 + src/shared/protocols/serviceProto.ts | 8 ++++++++ 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/api_s2c/event/payForDiamond/ApiCanReceive.ts b/src/api_s2c/event/payForDiamond/ApiCanReceive.ts index 9ef1d5c..5d16d02 100644 --- a/src/api_s2c/event/payForDiamond/ApiCanReceive.ts +++ b/src/api_s2c/event/payForDiamond/ApiCanReceive.ts @@ -51,7 +51,7 @@ export async function playerCanReceive(call: ApiCall, callError : boolean = true if (playerActivityInfo) { if (playerActivityInfo[zeroTime]) { return { - payNum, remaining, result: false, activityInfo, showOffList, price + payNum, remaining, result: false, activityInfo, showOffList, price, gotAmount: playerActivityInfo[zeroTime] }; } } @@ -63,7 +63,7 @@ export async function playerCanReceive(call: ApiCall, callError : boolean = true export default async function (call: ApiCall) { const canReceiveResult = await playerCanReceive(call); if (canReceiveResult) { - const { payNum, remaining, result, showOffList, price } = canReceiveResult; - call.succ({ payNum, remaining, result, showOffList, price }); + const { payNum, remaining, result, showOffList, price, gotAmount } = canReceiveResult; + call.succ({ payNum, remaining, result, showOffList, price, gotAmount }); } } \ No newline at end of file diff --git a/src/module/collection_event.ts b/src/module/collection_event.ts index 901d3f9..97bec9d 100644 --- a/src/module/collection_event.ts +++ b/src/module/collection_event.ts @@ -52,7 +52,7 @@ export type eventType = { kaifujingsai: ResOpenKaifujingsai; zhoumolibao: ResOpenZhoumolibao & { refreshTime: number; }; payForDiamond: { - [time: number]: number[] + [time: number]: number } } & { [k: `${number}jijin`]: ResOpenYuedujijin; diff --git a/src/shared/protocols/event/payForDiamond/PtlCanReceive.ts b/src/shared/protocols/event/payForDiamond/PtlCanReceive.ts index cd0b089..2560773 100644 --- a/src/shared/protocols/event/payForDiamond/PtlCanReceive.ts +++ b/src/shared/protocols/event/payForDiamond/PtlCanReceive.ts @@ -8,4 +8,5 @@ export type ResCanReceive = { result: boolean; price: number; showOffList: any[]; + gotAmount?: number; }; \ No newline at end of file diff --git a/src/shared/protocols/serviceProto.ts b/src/shared/protocols/serviceProto.ts index 8b3c4a8..c99c096 100644 --- a/src/shared/protocols/serviceProto.ts +++ b/src/shared/protocols/serviceProto.ts @@ -10159,6 +10159,14 @@ export const serviceProto: ServiceProto = { "type": "Any" } } + }, + { + "id": 5, + "name": "gotAmount", + "type": { + "type": "Number" + }, + "optional": true } ] }, From c304a6d8cc9535748c688fa7397386a708a6c97e Mon Sep 17 00:00:00 2001 From: chenkai Date: Fri, 22 Dec 2023 21:23:13 +0800 Subject: [PATCH 19/19] =?UTF-8?q?fix:=20=E5=B7=B2=E9=A2=86=E5=8F=96?= =?UTF-8?q?=E7=9A=84=E7=8E=A9=E5=AE=B6=E6=B7=BB=E5=8A=A0gotAmount=20?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api_s2c/event/payForDiamond/ApiCanReceive.ts | 6 +++--- src/shared/protocols/event/payForDiamond/PtlCanReceive.ts | 2 +- src/shared/protocols/serviceProto.ts | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/api_s2c/event/payForDiamond/ApiCanReceive.ts b/src/api_s2c/event/payForDiamond/ApiCanReceive.ts index 5d16d02..77e0fa9 100644 --- a/src/api_s2c/event/payForDiamond/ApiCanReceive.ts +++ b/src/api_s2c/event/payForDiamond/ApiCanReceive.ts @@ -36,14 +36,14 @@ export async function playerCanReceive(call: ApiCall, callError : boolean = true const price = activityInfo.data['price']; if (!vipScore) { return { - payNum: 0, remaining, result: false, activityInfo, showOffList, price + payNum: 0, remaining, result: false, activityInfo, showOffList, price, gotAmount: 0 }; } const payNum = vipScore; // 玩家充值未达标或者奖池余额耗尽则不能领取 if (payNum < price || remaining <= 0) { return { - payNum, remaining, result: false, activityInfo, showOffList, price + payNum, remaining, result: false, activityInfo, showOffList, price, gotAmount: 0 } } // 检查玩家今日是否已经领取 @@ -56,7 +56,7 @@ export async function playerCanReceive(call: ApiCall, callError : boolean = true } } return { - payNum, remaining, result: true, activityInfo, showOffList, price + payNum, remaining, result: true, activityInfo, showOffList, price, gotAmount: 0 }; } diff --git a/src/shared/protocols/event/payForDiamond/PtlCanReceive.ts b/src/shared/protocols/event/payForDiamond/PtlCanReceive.ts index 2560773..99ec132 100644 --- a/src/shared/protocols/event/payForDiamond/PtlCanReceive.ts +++ b/src/shared/protocols/event/payForDiamond/PtlCanReceive.ts @@ -8,5 +8,5 @@ export type ResCanReceive = { result: boolean; price: number; showOffList: any[]; - gotAmount?: number; + gotAmount: number; }; \ No newline at end of file diff --git a/src/shared/protocols/serviceProto.ts b/src/shared/protocols/serviceProto.ts index c99c096..945d070 100644 --- a/src/shared/protocols/serviceProto.ts +++ b/src/shared/protocols/serviceProto.ts @@ -10165,8 +10165,7 @@ export const serviceProto: ServiceProto = { "name": "gotAmount", "type": { "type": "Number" - }, - "optional": true + } } ] },