破冰礼包增加最后一天可领取所有奖励
This commit is contained in:
parent
3e1c45aaf9
commit
38b2f9a99e
@ -4,6 +4,7 @@ import {HuoDongFun} from "../../../public/huodongfun";
|
||||
import {PlayerFun} from "../../../public/player";
|
||||
import {HongDianChange} from "../../hongdian/fun";
|
||||
import {PayFun} from "../../../public/pay";
|
||||
import {PublicShared} from "../../../shared/public/public";
|
||||
|
||||
export default async function (call: ApiCall<ReqReceive, ResReceive>) {
|
||||
|
||||
@ -19,7 +20,9 @@ export default async function (call: ApiCall<ReqReceive, ResReceive>) {
|
||||
// 取奖励列表,判断是否有可领取奖励
|
||||
let data = await G.mongodb.cEvent(`pobinglibao${_hd.hdid}`).findOne({uid: call.uid, type: `pobinglibao${_hd.hdid}`})
|
||||
let rec = data?.record?.[call.req.id]?.length
|
||||
if (rec && (rec >= 3 || data?.record?.[gift.id] == call.req.recId)) return call.errorCode(-3)
|
||||
let _payDiff = PublicShared.getDiff(payLog[0].time)
|
||||
let _endDiff = PublicShared.getDiff(_hd.etime)
|
||||
if ((rec >= _payDiff && _endDiff < 1) || data?.record?.[gift.id] == call.req.recId) return call.errorCode(-3)
|
||||
|
||||
await PlayerFun.sendPrize(call, gift[call.req.recId]);
|
||||
|
||||
|
@ -366,19 +366,33 @@ export class HuoDongHongDianFun {
|
||||
|
||||
/**破冰礼包红点 */
|
||||
static async pobinglibao(call: ApiCall, _hd: ReqAddHuoDong): Promise<hongdianVal> {
|
||||
|
||||
let gift = _hd?.data?.gift?.find(i => i.free == true && !i.payId)
|
||||
if (gift) return {show: true}
|
||||
|
||||
|
||||
let payIds = _hd?.data?.gift?.filter(i => i.payId).map(i => i.payId)
|
||||
let payLogs = await PayFun.getPayLogs(call.uid, payIds)
|
||||
for (let key in payLogs) {
|
||||
payLogs[key] = payLogs[key]?.filter(i => i.time > _hd.stime && i.time < _hd.etime) || []
|
||||
}
|
||||
|
||||
// 取奖励列表,判断是否有可领取奖励
|
||||
let data = await G.mongodb.cEvent(`pobinglibao${_hd.hdid}`).findOne({uid: call.uid, type: `pobinglibao${_hd.hdid}`})
|
||||
|
||||
let data = await G.mongodb.cEvent(`pobinglibao${_hd.hdid}`).findOne({
|
||||
uid: call.uid,
|
||||
type: `pobinglibao${_hd.hdid}`
|
||||
})
|
||||
for (let item of _hd?.data?.gift) {
|
||||
let rec = data?.record?.[item.id]?.length
|
||||
if (item.free == true && !item.payId) return {show: true}
|
||||
if (payLogs[item.payId]?.length && (!rec || rec < PublicShared.getDiff(payLogs[item.payId][0].time))) return {show: true}
|
||||
|
||||
let payLog = payLogs[item.payId]
|
||||
if (!payLog.length) continue
|
||||
|
||||
let rec = data?.record?.[item.id]?.length
|
||||
let _payDiff = PublicShared.getDiff(payLog[0].time)
|
||||
let _endDiff = PublicShared.getDiff(_hd.etime)
|
||||
if ((rec < _payDiff)) return {show: true}
|
||||
if ((rec < 3 && _endDiff > 0)) return {show: true}
|
||||
}
|
||||
|
||||
return {show: false}
|
||||
|
Loading…
Reference in New Issue
Block a user