From 65d306227bccd4de0642aabc75934e80656f80fe Mon Sep 17 00:00:00 2001 From: dy Date: Thu, 4 Jan 2024 16:56:33 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=86=E5=A5=96=EF=BC=8C=E7=BA=A2=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api_s2c/event/pobinglibao/ApiReceive.ts | 10 ++++++-- src/api_s2c/hongdian/fun.ts | 1 + .../protocols/event/pobinglibao/PtlReceive.ts | 2 +- src/shared/protocols/serviceProto.ts | 25 ++++++++++++++++++- 4 files changed, 34 insertions(+), 4 deletions(-) diff --git a/src/api_s2c/event/pobinglibao/ApiReceive.ts b/src/api_s2c/event/pobinglibao/ApiReceive.ts index 8cd63ed..c97f0da 100644 --- a/src/api_s2c/event/pobinglibao/ApiReceive.ts +++ b/src/api_s2c/event/pobinglibao/ApiReceive.ts @@ -8,19 +8,25 @@ import {PublicShared} from "../../../shared/public/public"; export default async function (call: ApiCall) { - // 查询活动是否有当前领奖的免费选项 + // 查询活动是否是可领取状态 let _hd = (await HuoDongFun.gethdList(call, 10))[0] let gift = _hd?.data?.gift?.find(i => i.id == call.req.id) 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${_hd.hdid}`).findOne({uid: call.uid, type: `pobinglibao${_hd.hdid}`}) let rec = data?.record?.[call.req.id]?.length let _payDiff = PublicShared.getDiff(payLog[0].time) + _payDiff = _payDiff > 3 ? 3 : _payDiff let _endDiff = PublicShared.getDiff(_hd.etime) if ((rec >= _payDiff && _endDiff < 1) || data?.record?.[gift.id] == call.req.recId) return call.errorCode(-3) diff --git a/src/api_s2c/hongdian/fun.ts b/src/api_s2c/hongdian/fun.ts index 4400a21..fe16850 100644 --- a/src/api_s2c/hongdian/fun.ts +++ b/src/api_s2c/hongdian/fun.ts @@ -390,6 +390,7 @@ export class HuoDongHongDianFun { let rec = data?.record?.[item.id]?.length let _payDiff = PublicShared.getDiff(payLog[0].time) + _payDiff = _payDiff > 3 ? 3 : _payDiff let _endDiff = PublicShared.getDiff(_hd.etime) if ((rec < _payDiff)) return {show: true} if ((rec < 3 && _endDiff > 0)) return {show: true} diff --git a/src/shared/protocols/event/pobinglibao/PtlReceive.ts b/src/shared/protocols/event/pobinglibao/PtlReceive.ts index b9869a1..be8ddf7 100644 --- a/src/shared/protocols/event/pobinglibao/PtlReceive.ts +++ b/src/shared/protocols/event/pobinglibao/PtlReceive.ts @@ -5,7 +5,7 @@ import {prizeType} from "../../type"; */ export type ReqReceive = { id: string - recId: string + recId: 'prize' | 'recPrize1' | 'recPrize2' } export type ResReceive = { diff --git a/src/shared/protocols/serviceProto.ts b/src/shared/protocols/serviceProto.ts index f0b3f0c..b651d1e 100644 --- a/src/shared/protocols/serviceProto.ts +++ b/src/shared/protocols/serviceProto.ts @@ -10554,7 +10554,30 @@ export const serviceProto: ServiceProto = { "id": 1, "name": "recId", "type": { - "type": "String" + "type": "Union", + "members": [ + { + "id": 0, + "type": { + "type": "Literal", + "literal": "prize" + } + }, + { + "id": 1, + "type": { + "type": "Literal", + "literal": "recPrize1" + } + }, + { + "id": 2, + "type": { + "type": "Literal", + "literal": "recPrize2" + } + } + ] } } ]