破冰礼包

This commit is contained in:
dy 2023-12-30 16:07:54 +08:00
parent 45cec85960
commit 6fae6cd61e
3 changed files with 14 additions and 9 deletions

View File

@ -29,5 +29,5 @@ export default async function (call: ApiCall<ReqReceive, ResReceive>) {
call.succ({})
HongDianChange.sendChangeKey(call.uid, ['pobinglibao']);
HongDianChange.sendChangeKey(call.uid, ['huodonghd']);
}

View File

@ -367,17 +367,21 @@ 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: false}
if (gift) return {show: true}
let payLog = await PayFun.getPayLog(call.uid, gift.payId)
payLog = payLog?.filter(i => i.time >= _hd.stime && i.time <= _hd.etime) || []
if (!payLog || !payLog.length) return {show: false}
let payIds = _hd?.data?.gift?.filter(i=>i.payId).map(i=>i.payId)
let payLogs = await PayFun.getPayLogs(call.uid, payIds)
// 取奖励列表,判断是否有可领取奖励
let data = await G.mongodb.cEvent('pobinglibao').findOne({uid: call.uid, type: 'pobinglibao'})
let rec = data?.record?.[call.req.id].length
if (rec && (rec >= 3 || data?.record?.[gift.id] == call.req.recId)) return {show: false}
return {show: true}
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}
}
return {show:false}
}
/**元旦活动红点 */

View File

@ -18,7 +18,7 @@ class Path {
let uid = today_login_users[i].uid;
let init: boolean = false;
let { _id, ...hdata } = await G.mongodb.cEvent(`yuandan${hdid}`).findOne({
let hdata:any = await G.mongodb.cEvent(`yuandan${hdid}`).findOne({
uid: uid, type: `yuandan${hdid}`
});
if (!hdata) {
@ -122,6 +122,7 @@ class Path {
hdata.taskval = taskval;
await G.mongodb.cEvent(`yuandan${hdid}`).updateOne({ uid: uid, type: `yuandan${hdid}` }, { $set: hdata }, { upsert: true })
}
console.log('玩家执行完成',uid)
}