parent
4c9ad23bc1
commit
df641aa69f
@ -17,6 +17,7 @@ import { PublicShared } from './shared/public/public';
|
|||||||
import { setGud } from './public/gud';
|
import { setGud } from './public/gud';
|
||||||
import {checkResetBuyLog} from "./api_s2c/event/zhoumolibao/ApiOpen";
|
import {checkResetBuyLog} from "./api_s2c/event/zhoumolibao/ApiOpen";
|
||||||
import {Christmasfun} from "./api_s2c/event/christmas/fun";
|
import {Christmasfun} from "./api_s2c/event/christmas/fun";
|
||||||
|
import {PushGiftFun} from "./public/pushgift";
|
||||||
|
|
||||||
export type gEventType = {
|
export type gEventType = {
|
||||||
/**玩家断开连接 */
|
/**玩家断开连接 */
|
||||||
@ -194,6 +195,7 @@ export function addListener() {
|
|||||||
{ $inc: { payNum: conf.money } },
|
{ $inc: { payNum: conf.money } },
|
||||||
{ upsert: true }
|
{ upsert: true }
|
||||||
);
|
);
|
||||||
|
PushGiftFun.buy(player.uid, payId) // 推送礼包
|
||||||
});
|
});
|
||||||
|
|
||||||
G.on("FIRST_LOGIN_EVERY_DAY", (gud, lastTime, curTime) => {
|
G.on("FIRST_LOGIN_EVERY_DAY", (gud, lastTime, curTime) => {
|
||||||
|
@ -152,4 +152,22 @@ export class PushGiftFun {
|
|||||||
// 推送客户端消息
|
// 推送客户端消息
|
||||||
G.server.sendMsgByUid(uid, "msg_s2c/PushGiftChange", 1);
|
G.server.sendMsgByUid(uid, "msg_s2c/PushGiftChange", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static async buy(uid: string, payId: string) {
|
||||||
|
// 购买礼包
|
||||||
|
let gift;
|
||||||
|
for (let gift_id in G.gc.tuisonglibao) {
|
||||||
|
gift = G.gc.tuisonglibao[gift_id];
|
||||||
|
if (gift.payId.includes(payId)) break;
|
||||||
|
}
|
||||||
|
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({
|
||||||
|
uid: uid, id: gift.id.toString()
|
||||||
|
}, {$inc: {[`buy.${index}`]: 1}})
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user