Revert "Revert "feat:""

This reverts commit c282ece109.
This commit is contained in:
dy 2023-12-20 13:56:45 +08:00
parent 146f5a1daa
commit a113f4c461
2 changed files with 11 additions and 5 deletions

View File

@ -118,7 +118,7 @@ export class FightFun {
// 主线 爬塔 战败触发推送礼包
if (result.winSide != 0 && ["tanxian", "pata"].includes(type)) {
PushGiftFun.chkLoseGift(data[0].player.uid)
PushGiftFun.chkLoseGift(call.uid)
}
return result
}

View File

@ -54,7 +54,7 @@ export class PushGiftFun {
let gift_ids = [];
for (let id in G.gc.tuisonglibao) {
let conf = G.gc.tuisonglibao[id];
if (conf.type == PushGiftType.LevelGift && conf.num[0] == lv) {
if (conf.type == PushGiftType.LvGift && conf.num[0] == lv) {
gift_ids.push(id);
}
}
@ -157,17 +157,23 @@ export class PushGiftFun {
// 购买礼包
let gift;
for (let gift_id in G.gc.tuisonglibao) {
gift = G.gc.tuisonglibao[gift_id];
if (gift.payId.includes(payId)) break;
let temp = G.gc.tuisonglibao[gift_id];
if (temp.payId.includes(payId)) {
gift = temp;
break
}
}
if (!gift) return;
let index = gift.payId.indexOf(payId);
let info = await G.mongodb.collection("pushgift").findOne({
uid: uid, id: gift.id.toString()
})
if (info.passTime >= G.time) {
G.mongodb.collection("pushgift").updateOne({
await G.mongodb.collection("pushgift").updateOne({
uid: uid, id: gift.id.toString()
}, {$inc: {[`buy.${index}`]: 1}})
// 推送客户端消息
G.server.sendMsgByUid(uid, "msg_s2c/PushGiftChange", 1);
}
}
}