parent
cddda8288e
commit
c282ece109
@ -118,7 +118,7 @@ export class FightFun {
|
|||||||
|
|
||||||
// 主线 爬塔 战败触发推送礼包
|
// 主线 爬塔 战败触发推送礼包
|
||||||
if (result.winSide != 0 && ["tanxian", "pata"].includes(type)) {
|
if (result.winSide != 0 && ["tanxian", "pata"].includes(type)) {
|
||||||
PushGiftFun.chkLoseGift(call.uid)
|
PushGiftFun.chkLoseGift(data[0].player.uid)
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ export class PushGiftFun {
|
|||||||
let gift_ids = [];
|
let gift_ids = [];
|
||||||
for (let id in G.gc.tuisonglibao) {
|
for (let id in G.gc.tuisonglibao) {
|
||||||
let conf = G.gc.tuisonglibao[id];
|
let conf = G.gc.tuisonglibao[id];
|
||||||
if (conf.type == PushGiftType.LvGift && conf.num[0] == lv) {
|
if (conf.type == PushGiftType.LevelGift && conf.num[0] == lv) {
|
||||||
gift_ids.push(id);
|
gift_ids.push(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -157,23 +157,17 @@ export class PushGiftFun {
|
|||||||
// 购买礼包
|
// 购买礼包
|
||||||
let gift;
|
let gift;
|
||||||
for (let gift_id in G.gc.tuisonglibao) {
|
for (let gift_id in G.gc.tuisonglibao) {
|
||||||
let temp = G.gc.tuisonglibao[gift_id];
|
gift = G.gc.tuisonglibao[gift_id];
|
||||||
if (temp.payId.includes(payId)) {
|
if (gift.payId.includes(payId)) break;
|
||||||
gift = temp;
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (!gift) return;
|
|
||||||
let index = gift.payId.indexOf(payId);
|
let index = gift.payId.indexOf(payId);
|
||||||
let info = await G.mongodb.collection("pushgift").findOne({
|
let info = await G.mongodb.collection("pushgift").findOne({
|
||||||
uid: uid, id: gift.id.toString()
|
uid: uid, id: gift.id.toString()
|
||||||
})
|
})
|
||||||
if (info.passTime >= G.time) {
|
if (info.passTime >= G.time) {
|
||||||
await G.mongodb.collection("pushgift").updateOne({
|
G.mongodb.collection("pushgift").updateOne({
|
||||||
uid: uid, id: gift.id.toString()
|
uid: uid, id: gift.id.toString()
|
||||||
}, {$inc: {[`buy.${index}`]: 1}})
|
}, {$inc: {[`buy.${index}`]: 1}})
|
||||||
// 推送客户端消息
|
|
||||||
G.server.sendMsgByUid(uid, "msg_s2c/PushGiftChange", 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user