From d84173b67e4d15bad940170f020c8605ac1667f8 Mon Sep 17 00:00:00 2001 From: dy Date: Mon, 18 Dec 2023 16:49:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AF=8F=E6=97=A5=E7=A4=BC=E5=8C=85=E6=94=B9?= =?UTF-8?q?=E7=89=88=EF=BC=8C=E5=A2=9E=E5=8A=A0=E4=B8=80=E9=94=AE=E8=B4=AD?= =?UTF-8?q?=E4=B9=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/public/pay.ts | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/src/public/pay.ts b/src/public/pay.ts index bcda345..fa6b609 100644 --- a/src/public/pay.ts +++ b/src/public/pay.ts @@ -149,6 +149,12 @@ export class PayFun { needVip: 0, front: {} } + } else if (payId == '136GiftAll') { + // 136礼包一键购买,加入所有礼包奖励 + conf = { + ...conf, + prize: R.compose(R.flatten(), R.map(i => i.prize), R.filter(i => i.id.indexOf('136Gift') != -1), R.values())(G.gc.pay) + } } return conf } @@ -225,7 +231,7 @@ export class PayFun { prize.push(...conf.prize) } - let isReplaceConf = await this.checkBuysAfterPay(uid, payId, conf, payArgs) + let isReplaceConf = await this.checkBuysAfterPay(uid, payId, conf, payArgs, player) if (isReplaceConf) { let prizePayId = `zuanshi_${conf.money}` payArgs.toPrizePayId = prizePayId @@ -314,8 +320,9 @@ export class PayFun { * @param payId * @param conf * @param payArgs + * @param player */ - static async checkBuysAfterPay(uid, payId, conf, payArgs) { + static async checkBuysAfterPay(uid, payId, conf, payArgs, player) { if (payId == 'G123SendGift') { let giftInfo = await G.mongodb.collection('giftLog').findOne({popup_id: payArgs.popup_id}); if (giftInfo.purchaseLimitAmount && giftInfo.buyNumber >= giftInfo.purchaseLimitAmount && number(giftInfo.price) > 0) { @@ -327,6 +334,12 @@ export class PayFun { buyLog = buyLog.filter(v => v.time >= PublicShared.getToDayZeroTime(G.time)); } if (conf.buys > 0 && buyLog.length >= conf.buys) return true; + //针对周末礼包的单独处理 + if (payId.indexOf('wkdlibao') != -1) { + let call = this.getCall(player) + let conf = await zmlbGetConf(call, {payId}) + if (buyLog.length && buyLog.length >= conf.buyNum) return true + } } return false } @@ -376,10 +389,20 @@ 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}); } - if (payId.indexOf('136Gift') != -1 && payId != '136Gift1') { - buyLog = await this.getPayLog(player.uid, '136Gift1'); - if (buyLog.slice(-1)[0]?.eTime > G.time) return G.server.sendMsgByUid(player.uid, 'msg_s2c/PayResult', {code: -3}); + //针对每日礼包的单独处理 + let zeroTime = PublicShared.getToDayZeroTime(G.time) + if (payId.indexOf('136Gift') != -1 && payId != '136GiftAll') { + let buyLog136 = await this.getPayLog(player.uid, '136GiftAll'); + buyLog136 = buyLog136.filter(v => v.time >= zeroTime); + if (buyLog136.length) return G.server.sendMsgByUid(player.uid, 'msg_s2c/PayResult', {code: -1}); } + if (payId.indexOf('136Gift') != -1 && payId == '136GiftAll') { + let ids = R.compose(R.map(i => i.id), R.filter(i => i.id.indexOf('136Gift') != -1 && i.id != '136GiftAll'), R.values())(G.gc.pay) + let buyLog136 = await this.getPayLogs(player.uid, ids); + let buyLog136list = R.compose(R.filter(v => v.time >= zeroTime), R.flatten(), R.values())(buyLog136) + if (buyLog136list.length) return G.server.sendMsgByUid(player.uid, 'msg_s2c/PayResult', {code: -1}); + } + //针对周末礼包的单独处理 if (payId.indexOf('wkdlibao') != -1) { let call = this.getCall(player) let conf = await zmlbGetConf(call, {payId})