diff --git a/src/api_s2c/event/yuandan/ApiZLRec.ts b/src/api_s2c/event/yuandan/ApiZLRec.ts index 0a30022..4b1340a 100644 --- a/src/api_s2c/event/yuandan/ApiZLRec.ts +++ b/src/api_s2c/event/yuandan/ApiZLRec.ts @@ -4,6 +4,7 @@ import {HuoDongFun} from "../../../public/huodongfun"; import {PlayerFun} from "../../../public/player"; import {HongDianChange} from "../../hongdian/fun"; import {Yuandanfun} from "./fun"; +import {PublicShared} from "../../../shared/public/public"; export default async function (call: ApiCall) { let _hd = await Yuandanfun.getCon(call) @@ -18,11 +19,15 @@ export default async function (call: ApiCall) { let rec = data?.qiandao?.[call.req.id] if (rec) return call.errorCode(-3) + if (data && data.qiandaoTime && PublicShared.chkSameDate(data.qiandaoTime, G.time)) { + return call.errorCode(-4) + } + // 奖励不符合,严格判断 let dlzList = R.flatten(gift.dlz.map(i => R.values(i))) call.req.dlz.map(i => { let item = dlzList.find(v => i.a == v.a && i.t == v.t && i.n == v.n) - if (!item) call.errorCode(-4) + if (!item) call.errorCode(-5) }) let prize = [...gift.prize, ...call.req.dlz] @@ -30,7 +35,7 @@ export default async function (call: ApiCall) { await PlayerFun.sendPrize(call, prize); await G.mongodb.cEvent(`yuandan${_hd.hdid}`).updateOne({uid: call.uid, type: `yuandan${_hd.hdid}`}, { - $set: {[`qiandao.${call.req.id}`]: prize}, + $set: {[`qiandao.${call.req.id}`]: prize, qiandaoTime: G.time}, }, {upsert: true}) call.succ({[call.req.id]: prize}) diff --git a/src/api_s2c/hongdian/fun.ts b/src/api_s2c/hongdian/fun.ts index 215f1f0..af9a11a 100644 --- a/src/api_s2c/hongdian/fun.ts +++ b/src/api_s2c/hongdian/fun.ts @@ -369,6 +369,10 @@ export class HuoDongHongDianFun { // 检测 htype 10 破冰活动红点 ishd = await this.pobinglibao(call, element) } + if (element.htype == 14) { + // 检测 htype 10 破冰活动红点 + ishd = await this.yuandan(call, element) + } // 此活动有红点 if (ishd.show) { @@ -383,7 +387,7 @@ export class HuoDongHongDianFun { /**破冰礼包红点 */ static async pobinglibao(call: ApiCall, _hd: ReqAddHuoDong): Promise { - let gift = _hd?.data?.gift?.find(i => i.id == call.req.id) + let gift = _hd?.data?.gift?.find(i => i.free == true && !i.payId) if (!gift) return {show: false} let payLog = await PayFun.getPayLog(call.uid, gift.payId) @@ -397,6 +401,25 @@ export class HuoDongHongDianFun { return {show: true} } + /**元旦活动红点 */ + static async yuandan(call: ApiCall, _hd: ReqAddHuoDong): Promise { + + let gift = _hd?.data?.gift?.find(i => i.free && !i.payId) + + // 取奖励列表,判断是否有可领取奖励 + let data = await G.mongodb.cEvent(`yuandan${_hd.hdid}`).findOne({uid: call.uid, type: `yuandan${_hd.hdid}`}) + + if (gift && !data?.gift?.[gift.id]) return {show: true} + + if (data?.gameNum < _hd.data.gamefree) return {show: true} + + if (!PublicShared.chkSameDate(data.qiandaoTime || 0, G.time)) { + return {show: true} + } + + return {show: false} + } + /**开服狂欢红点 */ static async kfkhHongDian(call: ApiCall) { let _res: hongdianVal = { diff --git a/src/shared/protocols/event/yuandan/PtlOpen.ts b/src/shared/protocols/event/yuandan/PtlOpen.ts index 2940c39..15128e9 100644 --- a/src/shared/protocols/event/yuandan/PtlOpen.ts +++ b/src/shared/protocols/event/yuandan/PtlOpen.ts @@ -1,9 +1,16 @@ /** * 元旦 */ -export type ReqOpen = { -} +export type ReqOpen = {} export type ResOpen = { + qiandao: { [k: string]: any }; + gift: { [k: string]: any }; + taskfinish: string[]; + taskval: { [k: string]: any } + exchange: { [k: string]: any } + gameNum: number + refreshTime: number; + qiandaoTime: number; [k: string]: any; } diff --git a/src/shared/protocols/serviceProto.ts b/src/shared/protocols/serviceProto.ts index 9dd6606..2ebe2d3 100644 --- a/src/shared/protocols/serviceProto.ts +++ b/src/shared/protocols/serviceProto.ts @@ -11525,6 +11525,84 @@ export const serviceProto: ServiceProto = { }, "event/yuandan/PtlOpen/ResOpen": { "type": "Interface", + "properties": [ + { + "id": 0, + "name": "qiandao", + "type": { + "type": "Interface", + "indexSignature": { + "keyType": "String", + "type": { + "type": "Any" + } + } + } + }, + { + "id": 1, + "name": "gift", + "type": { + "type": "Interface", + "indexSignature": { + "keyType": "String", + "type": { + "type": "Any" + } + } + } + }, + { + "id": 2, + "name": "taskfinish", + "type": { + "type": "Array", + "elementType": { + "type": "String" + } + } + }, + { + "id": 3, + "name": "taskval", + "type": { + "type": "Interface", + "indexSignature": { + "keyType": "String", + "type": { + "type": "Any" + } + } + } + }, + { + "id": 4, + "name": "exchange", + "type": { + "type": "Interface", + "indexSignature": { + "keyType": "String", + "type": { + "type": "Any" + } + } + } + }, + { + "id": 5, + "name": "gameNum", + "type": { + "type": "Number" + } + }, + { + "id": 6, + "name": "refreshTime", + "type": { + "type": "Number" + } + } + ], "indexSignature": { "keyType": "String", "type": {