feat:
累充礼包
This commit is contained in:
parent
bafed44a56
commit
6526d386c4
@ -12,7 +12,7 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
|
||||
|
||||
// 每天open红点
|
||||
G.mongodb.cEvent(`leichonglibao${call.req.hdid}`).updateOne(
|
||||
{type: `leichonglibao${call.req.hdid}`, uid: call.uid}, {$set: change}
|
||||
{type: `leichonglibao${call.req.hdid}`, uid: call.uid}, {$set: change}, {upsert: true}
|
||||
)
|
||||
|
||||
let temp = Object.assign((data || {}), change) as ResOpen & { opentime }
|
||||
|
@ -42,6 +42,11 @@ export default async function (call: ApiCall<ReqReceive, ResReceive>) {
|
||||
_prize.push(hddata.dlz[i][call.req.select[i] || "1"])
|
||||
}
|
||||
|
||||
// 修改领取标识
|
||||
await G.mongodb.cEvent(`leichonglibao${call.req.hdid}`).updateOne(
|
||||
{type: `leichonglibao${call.req.hdid}`, uid: call.uid}, {$set: {sc: true}}
|
||||
)
|
||||
|
||||
PlayerFun.sendPrize(call, _prize)
|
||||
call.succ({prize: _prize})
|
||||
}
|
||||
@ -71,14 +76,21 @@ export async function LeiChongLiBaoBuyGift(call: ApiCall, payId: string) {
|
||||
{type: `leichonglibao${hdid}`, uid: call.uid}
|
||||
)
|
||||
|
||||
if (mydata.buy.includes(gift.payId)) {
|
||||
if (mydata && mydata.buy.includes(gift.payId)) {
|
||||
console.log(call.uid, "购买累充礼包 重复购买", payId);
|
||||
return
|
||||
}
|
||||
|
||||
let update;
|
||||
if (mydata) {
|
||||
update = {$push: {buy: payId}}
|
||||
} else {
|
||||
update = {$set: {opentime: G.time, sc: false, buy: [payId]}}
|
||||
}
|
||||
|
||||
PlayerFun.sendPrize(call, gift.prize)
|
||||
G.mongodb.cEvent(`leichonglibao${hdid}`).updateOne(
|
||||
{uid: call.uid, type: `leichonglibao${hdid}`}, {"$push": {buy: payId}}
|
||||
{uid: call.uid, type: `leichonglibao${hdid}`}, update
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@ 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";
|
||||
import {LeiChongLiBaoBuyGift} from "./api_s2c/event/leichonglibao/ApiReceive";
|
||||
|
||||
export type gEventType = {
|
||||
/**玩家断开连接 */
|
||||
@ -201,7 +202,8 @@ export function addListener() {
|
||||
{ $inc: { payNum: conf.money } },
|
||||
{ upsert: true }
|
||||
);
|
||||
PushGiftFun.buy(player.uid, payId) // 推送礼包
|
||||
await PushGiftFun.buy(player.uid, payId) // 推送礼包
|
||||
await LeiChongLiBaoBuyGift(call, payId) // 累充礼包
|
||||
});
|
||||
|
||||
G.on("FIRST_LOGIN_EVERY_DAY", (gud, lastTime, curTime) => {
|
||||
|
Loading…
Reference in New Issue
Block a user