Compare commits

...

2 Commits

Author SHA1 Message Date
dy
540291696a Merge branch 'dev-meirilibao' into dev 2023-12-18 16:51:38 +08:00
dy
d84173b67e 每日礼包改版,增加一键购买 2023-12-18 16:49:54 +08:00

View File

@ -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})