diff --git a/src/api_s2c/event/leichonglibao/ApiOpen.ts b/src/api_s2c/event/leichonglibao/ApiOpen.ts index 78d89e5..b820d52 100644 --- a/src/api_s2c/event/leichonglibao/ApiOpen.ts +++ b/src/api_s2c/event/leichonglibao/ApiOpen.ts @@ -12,7 +12,7 @@ export default async function (call: ApiCall) { // 每天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 } diff --git a/src/api_s2c/event/leichonglibao/ApiReceive.ts b/src/api_s2c/event/leichonglibao/ApiReceive.ts index aa58d3f..2ce441f 100644 --- a/src/api_s2c/event/leichonglibao/ApiReceive.ts +++ b/src/api_s2c/event/leichonglibao/ApiReceive.ts @@ -42,6 +42,11 @@ export default async function (call: ApiCall) { _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 ) } diff --git a/src/globalListener.ts b/src/globalListener.ts index 9d1ce5b..6a5bec8 100644 --- a/src/globalListener.ts +++ b/src/globalListener.ts @@ -202,9 +202,8 @@ export function addListener() { { $inc: { payNum: conf.money } }, { upsert: true } ); - await PushGiftFun.buy(player.uid, payId) // 推送礼包 - await LeiChongLiBaoBuyGift(call, payId) // 累充礼包 + await LeiChongLiBaoBuyGift(call, payId) // 累充礼包 }); G.on("FIRST_LOGIN_EVERY_DAY", (gud, lastTime, curTime) => { diff --git a/src/shared/protocols/serviceProto.ts b/src/shared/protocols/serviceProto.ts index fa0d54f..0130516 100644 --- a/src/shared/protocols/serviceProto.ts +++ b/src/shared/protocols/serviceProto.ts @@ -271,6 +271,7 @@ import { ReqBingo, ResBingo } from './PtlBingo'; import { ReqFightTest, ResFightTest } from './PtlFightTest'; import { ReqSyncBtn, ResSyncBtn } from './PtlSyncBtn'; import { ReqTest, ResTest } from './PtlTest'; +import { ReqItemNoEnough, ResItemNoEnough } from './pushgift/PtlItemNoEnough'; import { ReqOpen as ReqOpen_51, ResOpen as ResOpen_51 } from './pushgift/PtlOpen'; import { ReqFight as ReqFight_9, ResFight as ResFight_9 } from './qjzzd/PtlFight'; import { ReqOpen as ReqOpen_52, ResOpen as ResOpen_52 } from './qjzzd/PtlOpen'; @@ -312,6 +313,7 @@ import { ReqOpen as ReqOpen_59, ResOpen as ResOpen_59 } from './task/PtlOpen'; import { ReqCDKEY, ResCDKEY } from './user/PtlCDKEY'; import { ReqChangeInfo, ResChangeInfo } from './user/PtlChangeInfo'; import { ReqChangeName, ResChangeName } from './user/PtlChangeName'; +import { ReqDot, ResDot } from './user/PtlDot'; import { ReqFight as ReqFight_12, ResFight as ResFight_12 } from './user/PtlFight'; import { ReqGetInfo, ResGetInfo } from './user/PtlGetInfo'; import { ReqInfoOpen, ResInfoOpen } from './user/PtlInfoOpen'; @@ -1325,6 +1327,10 @@ export interface ServiceType { req: ReqTest, res: ResTest }, + "pushgift/ItemNoEnough": { + req: ReqItemNoEnough, + res: ResItemNoEnough + }, "pushgift/Open": { req: ReqOpen_51, res: ResOpen_51 @@ -1489,6 +1495,10 @@ export interface ServiceType { req: ReqChangeName, res: ResChangeName }, + "user/Dot": { + req: ReqDot, + res: ResDot + }, "user/Fight": { req: ReqFight_12, res: ResFight_12 @@ -3145,126 +3155,131 @@ export const serviceProto: ServiceProto = { }, { "id": 272, - "name": "pushgift/Open", + "name": "pushgift/ItemNoEnough", "type": "api" }, { "id": 273, - "name": "qjzzd/Fight", + "name": "pushgift/Open", "type": "api" }, { "id": 274, - "name": "qjzzd/Open", + "name": "qjzzd/Fight", "type": "api" }, { "id": 275, - "name": "rank/Open", + "name": "qjzzd/Open", "type": "api" }, { "id": 276, - "name": "shiwu/Concise", + "name": "rank/Open", "type": "api" }, { "id": 277, - "name": "shiwu/Extract", + "name": "shiwu/Concise", "type": "api" }, { "id": 278, - "name": "shiwu/GetList", + "name": "shiwu/Extract", "type": "api" }, { "id": 279, - "name": "shiwu/LvUp", + "name": "shiwu/GetList", "type": "api" }, { "id": 280, - "name": "shiwu/Recast", + "name": "shiwu/LvUp", "type": "api" }, { "id": 281, - "name": "shiwu/TakeOff", + "name": "shiwu/Recast", "type": "api" }, { "id": 282, - "name": "shiwu/Wear", + "name": "shiwu/TakeOff", "type": "api" }, { "id": 283, - "name": "shootGame/Open", + "name": "shiwu/Wear", "type": "api" }, { "id": 284, - "name": "shootGame/Rec", + "name": "shootGame/Open", "type": "api" }, { "id": 285, - "name": "shop/Buy", + "name": "shootGame/Rec", "type": "api" }, { "id": 286, - "name": "shop/Open", + "name": "shop/Buy", "type": "api" }, { "id": 287, - "name": "shop/Refresh", + "name": "shop/Open", "type": "api" }, { "id": 288, - "name": "sign/GetBoxPrize", + "name": "shop/Refresh", "type": "api" }, { "id": 289, - "name": "sign/GetPrize", + "name": "sign/GetBoxPrize", "type": "api" }, { "id": 290, - "name": "sign/Open", + "name": "sign/GetPrize", "type": "api" }, { "id": 291, - "name": "slzd/Aim", + "name": "sign/Open", "type": "api" }, { "id": 292, - "name": "slzd/BuyNum", + "name": "slzd/Aim", "type": "api" }, { "id": 293, - "name": "slzd/Fight", + "name": "slzd/BuyNum", "type": "api" }, { "id": 294, - "name": "slzd/FightLog", + "name": "slzd/Fight", "type": "api" }, { "id": 295, - "name": "slzd/MyRank", + "name": "slzd/FightLog", "type": "api" }, { "id": 296, + "name": "slzd/MyRank", + "type": "api" + }, + { + "id": 297, "name": "slzd/Open", "type": "api", "conf": { @@ -3274,77 +3289,77 @@ export const serviceProto: ServiceProto = { } }, { - "id": 297, + "id": 298, "name": "slzd/OpenFort", "type": "api" }, { - "id": 298, + "id": 299, "name": "slzd/Rec", "type": "api" }, { - "id": 299, + "id": 300, "name": "slzd/Refresh", "type": "api" }, { - "id": 300, + "id": 301, "name": "slzd/Slot", "type": "api" }, { - "id": 301, + "id": 302, "name": "tanxian/Event", "type": "api" }, { - "id": 302, + "id": 303, "name": "tanxian/FastGuaJi", "type": "api" }, { - "id": 303, + "id": 304, "name": "tanxian/Fight", "type": "api" }, { - "id": 304, + "id": 305, "name": "tanxian/GuaJi", "type": "api" }, { - "id": 305, + "id": 306, "name": "tanxian/Open", "type": "api" }, { - "id": 306, + "id": 307, "name": "tanxian/Receive", "type": "api" }, { - "id": 307, + "id": 308, "name": "task/AllFinsh", "type": "api" }, { - "id": 308, + "id": 309, "name": "task/Finsh", "type": "api" }, { - "id": 309, + "id": 310, "name": "task/Open", "type": "api" }, { - "id": 310, + "id": 311, "name": "user/CDKEY", "type": "api" }, { - "id": 311, + "id": 312, "name": "user/ChangeInfo", "type": "api", "conf": { @@ -3352,197 +3367,202 @@ export const serviceProto: ServiceProto = { } }, { - "id": 312, + "id": 313, "name": "user/ChangeName", "type": "api" }, - { - "id": 313, - "name": "user/Fight", - "type": "api" - }, { "id": 314, - "name": "user/GetInfo", + "name": "user/Dot", "type": "api" }, { "id": 315, - "name": "user/InfoOpen", + "name": "user/Fight", "type": "api" }, { "id": 316, - "name": "user/Login", + "name": "user/GetInfo", "type": "api" }, { "id": 317, - "name": "user/Ping", + "name": "user/InfoOpen", "type": "api" }, { "id": 318, - "name": "user/Renown", + "name": "user/Login", "type": "api" }, { "id": 319, - "name": "user/RenownBuy", + "name": "user/Ping", "type": "api" }, { "id": 320, - "name": "user/RenownGetPrize", + "name": "user/Renown", "type": "api" }, { "id": 321, - "name": "user/RenownOpen", + "name": "user/RenownBuy", "type": "api" }, { "id": 322, - "name": "user/Tujian", + "name": "user/RenownGetPrize", "type": "api" }, { "id": 323, - "name": "weixiuchang/Decompose", + "name": "user/RenownOpen", "type": "api" }, { "id": 324, - "name": "weixiuchang/Exchange", + "name": "user/Tujian", "type": "api" }, { "id": 325, - "name": "weixiuchang/Open", + "name": "weixiuchang/Decompose", "type": "api" }, { "id": 326, - "name": "weixiuchang/UpLv", + "name": "weixiuchang/Exchange", "type": "api" }, { "id": 327, - "name": "weixiuchang/UpStar", + "name": "weixiuchang/Open", "type": "api" }, { "id": 328, - "name": "wzry/AutoBaoMing", + "name": "weixiuchang/UpLv", "type": "api" }, { "id": 329, - "name": "wzry/BaoMing", + "name": "weixiuchang/UpStar", "type": "api" }, { "id": 330, - "name": "wzry/catFightLog", + "name": "wzry/AutoBaoMing", "type": "api" }, { "id": 331, - "name": "wzry/CatGroup", + "name": "wzry/BaoMing", "type": "api" }, { "id": 332, - "name": "wzry/DldFight", + "name": "wzry/catFightLog", "type": "api" }, { "id": 333, - "name": "wzry/DldRefre", + "name": "wzry/CatGroup", "type": "api" }, { "id": 334, - "name": "wzry/JingCai", + "name": "wzry/DldFight", "type": "api" }, { "id": 335, - "name": "wzry/JingCaiOpen", + "name": "wzry/DldRefre", "type": "api" }, { "id": 336, - "name": "wzry/Open", + "name": "wzry/JingCai", "type": "api" }, { "id": 337, - "name": "wzry/UpdateFight", + "name": "wzry/JingCaiOpen", "type": "api" }, { "id": 338, - "name": "wzry/Wzzd", + "name": "wzry/Open", "type": "api" }, { "id": 339, - "name": "wzry/ZuanShiOpen", + "name": "wzry/UpdateFight", "type": "api" }, { "id": 340, - "name": "xstask/AllGet", + "name": "wzry/Wzzd", "type": "api" }, { "id": 341, - "name": "xstask/Get", + "name": "wzry/ZuanShiOpen", "type": "api" }, { "id": 342, - "name": "xstask/LvUp", + "name": "xstask/AllGet", "type": "api" }, { "id": 343, - "name": "xstask/OnekeyReceive", + "name": "xstask/Get", "type": "api" }, { "id": 344, - "name": "xstask/Open", + "name": "xstask/LvUp", "type": "api" }, { "id": 345, - "name": "xstask/Receive", + "name": "xstask/OnekeyReceive", "type": "api" }, { "id": 346, - "name": "xstask/Refresh", + "name": "xstask/Open", "type": "api" }, { "id": 347, - "name": "yongbingzhuzhan/Handle", + "name": "xstask/Receive", "type": "api" }, { "id": 348, - "name": "zhanqianbushu/ChangePos", + "name": "xstask/Refresh", "type": "api" }, { "id": 349, - "name": "zhanqianbushu/Select", + "name": "yongbingzhuzhan/Handle", "type": "api" }, { "id": 350, + "name": "zhanqianbushu/ChangePos", + "type": "api" + }, + { + "id": 351, + "name": "zhanqianbushu/Select", + "type": "api" + }, + { + "id": 352, "name": "zhanqianbushu/Up", "type": "api" } @@ -10298,7 +10318,8 @@ export const serviceProto: ServiceProto = { "name": "activityId", "type": { "type": "Number" - } + }, + "optional": true } ] }, @@ -10326,6 +10347,23 @@ export const serviceProto: ServiceProto = { "type": { "type": "Boolean" } + }, + { + "id": 3, + "name": "price", + "type": { + "type": "Number" + } + }, + { + "id": 4, + "name": "showOffList", + "type": { + "type": "Array", + "elementType": { + "type": "Any" + } + } } ] }, @@ -10356,7 +10394,16 @@ export const serviceProto: ServiceProto = { "name": "timesRemaining", "type": { "type": "Number" - } + }, + "optional": true + }, + { + "id": 2, + "name": "showOff", + "type": { + "type": "Boolean" + }, + "optional": true } ] }, @@ -10876,30 +10923,8 @@ export const serviceProto: ServiceProto = { "type": { "type": "Array", "elementType": { - "type": "Interface", - "properties": [ - { - "id": 0, - "name": "_id", - "type": { - "type": "String" - } - }, - { - "id": 1, - "name": "total", - "type": { - "type": "Number" - } - }, - { - "id": 2, - "name": "player", - "type": { - "type": "Any" - } - } - ] + "type": "Reference", + "target": "event/xiaofeijingsai/PtlOpen/data" } } }, @@ -10907,30 +10932,41 @@ export const serviceProto: ServiceProto = { "id": 1, "name": "myData", "type": { - "type": "Interface", - "properties": [ - { - "id": 0, - "name": "_id", - "type": { - "type": "String" - } - }, - { - "id": 1, - "name": "total", - "type": { - "type": "Number" - } - }, - { - "id": 2, - "name": "player", - "type": { - "type": "Any" - } - } - ] + "type": "Reference", + "target": "event/xiaofeijingsai/PtlOpen/data" + } + } + ] + }, + "event/xiaofeijingsai/PtlOpen/data": { + "type": "Interface", + "properties": [ + { + "id": 0, + "name": "_id", + "type": { + "type": "String" + } + }, + { + "id": 1, + "name": "total", + "type": { + "type": "Number" + } + }, + { + "id": 2, + "name": "rank", + "type": { + "type": "Number" + } + }, + { + "id": 3, + "name": "player", + "type": { + "type": "Any" } } ] @@ -15281,6 +15317,13 @@ export const serviceProto: ServiceProto = { "type": "Literal", "literal": "leichonglibao" } + }, + { + "id": 39, + "type": { + "type": "Literal", + "literal": "payForDiamond" + } } ] }, @@ -19399,6 +19442,37 @@ export const serviceProto: ServiceProto = { "PtlTest/ResTest": { "type": "Any" }, + "pushgift/PtlItemNoEnough/ReqItemNoEnough": { + "type": "Interface", + "properties": [ + { + "id": 0, + "name": "need", + "type": { + "type": "Interface", + "properties": [ + { + "id": 0, + "name": "a", + "type": { + "type": "String" + } + }, + { + "id": 1, + "name": "t", + "type": { + "type": "String" + } + } + ] + } + } + ] + }, + "pushgift/PtlItemNoEnough/ResItemNoEnough": { + "type": "Interface" + }, "pushgift/PtlOpen/ReqOpen": { "type": "Interface" }, @@ -21363,6 +21437,29 @@ export const serviceProto: ServiceProto = { "user/PtlChangeName/ResChangeName": { "type": "Interface" }, + "user/PtlDot/ReqDot": { + "type": "Interface", + "properties": [ + { + "id": 0, + "name": "type", + "type": { + "type": "String" + } + }, + { + "id": 1, + "name": "data", + "type": { + "type": "Any" + }, + "optional": true + } + ] + }, + "user/PtlDot/ResDot": { + "type": "Interface" + }, "user/PtlFight/ReqFight": { "type": "Interface", "properties": [