diff --git a/src/api_s2c/event/yuandan/ApiDMRec.ts b/src/api_s2c/event/yuandan/ApiDMRec.ts index 6db04dd..db205dc 100644 --- a/src/api_s2c/event/yuandan/ApiDMRec.ts +++ b/src/api_s2c/event/yuandan/ApiDMRec.ts @@ -3,17 +3,13 @@ import {ReqDMRec, ResDMRec} from "../../../shared/protocols/event/yuandan/PtlDMR import {HuoDongFun} from "../../../public/huodongfun"; import {PlayerFun} from "../../../public/player"; import {HongDianChange} from "../../hongdian/fun"; +import {PublicShared} from "../../../shared/public/public"; export default async function (call: ApiCall) { // 查询活动是否存在 let _hd = (await HuoDongFun.gethdList(call, 14))[0] if (!_hd) return call.errorCode(-1) - // 奖励不符合 - let toPrize = call.req.prize - let prize = _hd.data.game.find(i => i.a == toPrize?.a && i.t == toPrize?.t && i.n == toPrize?.n) - if (toPrize && !prize) return call.errorCode(-4) - // 扣除免费次数或相应货币 let data = await G.mongodb.cEvent(`yuandan${_hd.hdid}`).findOne({uid: call.uid, type: `yuandan${_hd.hdid}`}) let rec = data?.gameNum @@ -23,8 +19,9 @@ export default async function (call: ApiCall) { await PlayerFun.cutNeed(call, _hd.data.gameneed); } - if (prize) { - await PlayerFun.sendPrize(call, [prize]); + if (call.req.id) { + let prize = PublicShared.randomDropGroup('1', 1, {'1': _hd.data.game}); + await PlayerFun.sendPrize(call, prize); } await G.mongodb.cEvent(`yuandan${_hd.hdid}`).updateOne({uid: call.uid, type: `yuandan${_hd.hdid}`}, { diff --git a/src/shared/protocols/event/yuandan/PtlDMRec.ts b/src/shared/protocols/event/yuandan/PtlDMRec.ts index cd4111e..8de9bbb 100644 --- a/src/shared/protocols/event/yuandan/PtlDMRec.ts +++ b/src/shared/protocols/event/yuandan/PtlDMRec.ts @@ -2,7 +2,7 @@ * 元旦达摩领奖 */ export type ReqDMRec = { - prize: { a: string, t: string, n: number } | null + id: 1 | 0 } export type ResDMRec = {} diff --git a/src/shared/protocols/serviceProto.ts b/src/shared/protocols/serviceProto.ts index b5ad444..8e2ac50 100644 --- a/src/shared/protocols/serviceProto.ts +++ b/src/shared/protocols/serviceProto.ts @@ -11403,44 +11403,22 @@ export const serviceProto: ServiceProto = { "properties": [ { "id": 0, - "name": "prize", + "name": "id", "type": { "type": "Union", "members": [ { "id": 0, "type": { - "type": "Interface", - "properties": [ - { - "id": 0, - "name": "a", - "type": { - "type": "String" - } - }, - { - "id": 1, - "name": "t", - "type": { - "type": "String" - } - }, - { - "id": 2, - "name": "n", - "type": { - "type": "Number" - } - } - ] + "type": "Literal", + "literal": 1 } }, { "id": 1, "type": { "type": "Literal", - "literal": null + "literal": 0 } } ] diff --git a/src/shared/public/public.ts b/src/shared/public/public.ts index 02c3aa2..5860b9b 100644 --- a/src/shared/public/public.ts +++ b/src/shared/public/public.ts @@ -73,6 +73,7 @@ export class PublicShared { * 随机掉落组 * @param id 掉落组id * @param num 随机次数 + * @param conf */ static randomDropGroup(id: string | number, num = 1, conf = G.gc.diaoluo): prizeType[] { let prize = [];