parent
146f5a1daa
commit
a113f4c461
@ -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
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user