parent
c282ece109
commit
ce5836be83
@ -17,7 +17,6 @@ import { PublicShared } from './shared/public/public';
|
||||
import { setGud } from './public/gud';
|
||||
import {checkResetBuyLog} from "./api_s2c/event/zhoumolibao/ApiOpen";
|
||||
import {Christmasfun} from "./api_s2c/event/christmas/fun";
|
||||
import {PushGiftFun} from "./public/pushgift";
|
||||
|
||||
export type gEventType = {
|
||||
/**玩家断开连接 */
|
||||
@ -199,7 +198,6 @@ export function addListener() {
|
||||
{ $inc: { payNum: conf.money } },
|
||||
{ upsert: true }
|
||||
);
|
||||
PushGiftFun.buy(player.uid, payId) // 推送礼包
|
||||
});
|
||||
|
||||
G.on("FIRST_LOGIN_EVERY_DAY", (gud, lastTime, curTime) => {
|
||||
|
@ -152,22 +152,4 @@ export class PushGiftFun {
|
||||
// 推送客户端消息
|
||||
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