Merge branch 'bugfix' of http://git.legu.cc/qixin/HJ_Server into bugfix

This commit is contained in:
xcy 2023-12-30 17:04:25 +08:00
commit f99d556736
2 changed files with 12 additions and 8 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}
}
/**元旦活动红点 */