From f1dacd19b6c65705d114ab7084b1031a9b0c9bf4 Mon Sep 17 00:00:00 2001 From: dy Date: Thu, 4 Jan 2024 16:05:52 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A0=B4=E5=86=B0=E7=A4=BC=E5=8C=85=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E8=BD=AE=E6=AC=A1=EF=BC=8C=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api_s2c/event/pobinglibao/ApiOpen.ts | 5 +++-- src/api_s2c/event/pobinglibao/ApiReceive.ts | 11 ++++------- src/api_s2c/hongdian/fun.ts | 2 +- src/module/collection_event.ts | 2 +- .../protocols/event/pobinglibao/PtlReceive.ts | 8 +++++--- src/shared/protocols/serviceProto.ts | 15 ++++++++++++++- 6 files changed, 28 insertions(+), 15 deletions(-) diff --git a/src/api_s2c/event/pobinglibao/ApiOpen.ts b/src/api_s2c/event/pobinglibao/ApiOpen.ts index 5677a06..c780f1a 100644 --- a/src/api_s2c/event/pobinglibao/ApiOpen.ts +++ b/src/api_s2c/event/pobinglibao/ApiOpen.ts @@ -6,7 +6,6 @@ import {PublicShared} from "../../../shared/public/public"; export default async function (call: ApiCall) { - let data = await G.mongodb.cEvent('pobinglibao').findOne({uid: call.uid, type: 'pobinglibao'}) let _hd = (await HuoDongFun.gethdList(call, 10))[0] if (!_hd) return call.errorCode(-1) @@ -16,9 +15,11 @@ export default async function (call: ApiCall) { let payLog: any = await PayFun.getPayLogs(call.uid, payIds) for (let key in payLog) { - payLog[key]?.filter(i => i.time > _hd.stime && i.time < _hd.etime) + payLog[key] = payLog[key]?.filter(i => i.time > _hd.stime && i.time < _hd.etime) } + let data = await G.mongodb.cEvent(`pobinglibao${_hd.hdid}`).findOne({uid: call.uid, type: `pobinglibao${_hd.hdid}`}) + call.succ({ record: data?.record || {}, buyLog: payLog diff --git a/src/api_s2c/event/pobinglibao/ApiReceive.ts b/src/api_s2c/event/pobinglibao/ApiReceive.ts index 848c49b..735337a 100644 --- a/src/api_s2c/event/pobinglibao/ApiReceive.ts +++ b/src/api_s2c/event/pobinglibao/ApiReceive.ts @@ -7,30 +7,27 @@ import {PayFun} from "../../../public/pay"; export default async function (call: ApiCall) { - if (!call.req.id) return call.errorCode(-1) - // 查询活动是否有当前领奖的免费选项 let _hd = (await HuoDongFun.gethdList(call, 10))[0] let gift = _hd?.data?.gift?.find(i => i.id == call.req.id) - if (!gift) return call.errorCode(-1) + if (!gift || !call.req.recId) return call.errorCode(-1) let payLog = await PayFun.getPayLog(call.uid, gift.payId) payLog = payLog?.filter(i => i.time >= _hd.stime && i.time <= _hd.etime) || [] if (!payLog || !payLog.length) return call.errorCode(-2) - // 取奖励列表,判断是否有可领取奖励 - let data = await G.mongodb.cEvent('pobinglibao').findOne({uid: call.uid, type: 'pobinglibao'}) + let data = await G.mongodb.cEvent(`pobinglibao${_hd.hdid}`).findOne({uid: call.uid, type: `pobinglibao${_hd.hdid}`}) let rec = data?.record?.[call.req.id]?.length if (rec && (rec >= 3 || data?.record?.[gift.id] == call.req.recId)) return call.errorCode(-3) await PlayerFun.sendPrize(call, gift[call.req.recId]); - await G.mongodb.cEvent('pobinglibao').updateOne({uid: call.uid, type: 'pobinglibao'}, { + await G.mongodb.cEvent(`pobinglibao${_hd.hdid}`).updateOne({uid: call.uid, type: `pobinglibao${_hd.hdid}`}, { $push: {[`record.${gift.id}`]: call.req.recId}, }, {upsert: true}) - call.succ({}) + call.succ({prize: gift[call.req.recId]}) HongDianChange.sendChangeKey(call.uid, ['huodonghd']); } diff --git a/src/api_s2c/hongdian/fun.ts b/src/api_s2c/hongdian/fun.ts index ec2094a..4d66e88 100644 --- a/src/api_s2c/hongdian/fun.ts +++ b/src/api_s2c/hongdian/fun.ts @@ -373,7 +373,7 @@ export class HuoDongHongDianFun { let payLogs = await PayFun.getPayLogs(call.uid, payIds) // 取奖励列表,判断是否有可领取奖励 - let data = await G.mongodb.cEvent('pobinglibao').findOne({uid: call.uid, type: 'pobinglibao'}) + let data = await G.mongodb.cEvent(`pobinglibao${_hd.hdid}`).findOne({uid: call.uid, type: `pobinglibao${_hd.hdid}`}) for (let item of _hd?.data?.gift){ let rec = data?.record?.[item.id]?.length diff --git a/src/module/collection_event.ts b/src/module/collection_event.ts index d09d6eb..9679fcc 100644 --- a/src/module/collection_event.ts +++ b/src/module/collection_event.ts @@ -54,7 +54,6 @@ export type eventType = { jierihuodong: Omit & { refreshTime: number; }; kaifujingsai: ResOpenKaifujingsai; zhoumolibao: ResOpenZhoumolibao & { refreshTime: number; }; - pobinglibao: ResOpenPobinglibao payForDiamond: { [time: number]: number } @@ -74,6 +73,7 @@ export type eventType = { [k: `qiridenglu${number}`]: Pick; [k: `leichonglibao${number}`]: ResOpenLeiChongLiBao & { opentime: number }; [k: `yuandan${number}`]: ResOpenYuandan; + [k: `pobinglibao${number}`]: ResOpenPobinglibao; }; export type CollectionEvent = { diff --git a/src/shared/protocols/event/pobinglibao/PtlReceive.ts b/src/shared/protocols/event/pobinglibao/PtlReceive.ts index bb057a3..b9869a1 100644 --- a/src/shared/protocols/event/pobinglibao/PtlReceive.ts +++ b/src/shared/protocols/event/pobinglibao/PtlReceive.ts @@ -1,11 +1,13 @@ +import {prizeType} from "../../type"; + /** * 破冰礼包领奖 */ -export interface ReqReceive { +export type ReqReceive = { id: string recId: string } -export interface ResReceive { - +export type ResReceive = { + prize: prizeType[] } diff --git a/src/shared/protocols/serviceProto.ts b/src/shared/protocols/serviceProto.ts index 2dc1df9..f0b3f0c 100644 --- a/src/shared/protocols/serviceProto.ts +++ b/src/shared/protocols/serviceProto.ts @@ -10560,7 +10560,20 @@ export const serviceProto: ServiceProto = { ] }, "event/pobinglibao/PtlReceive/ResReceive": { - "type": "Interface" + "type": "Interface", + "properties": [ + { + "id": 0, + "name": "prize", + "type": { + "type": "Array", + "elementType": { + "type": "Reference", + "target": "type/prizeType" + } + } + } + ] }, "event/qirichongzhi/PtlOpen/ReqOpen": { "type": "Interface"