From 1d6143794c5d2483d1f38ef26ff0b2fa6bd45723 Mon Sep 17 00:00:00 2001 From: dy Date: Mon, 25 Dec 2023 17:13:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=83=E6=97=A6=E6=B4=BB=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../event/yuandan/{ApiDMOpen.ts => ApiOpen.ts} | 9 +++------ src/api_s2c/event/yuandan/fun.ts | 11 +++-------- src/shared/protocols/event/yuandan/PtlDMOpen.ts | 2 +- src/shared/protocols/serviceProto.ts | 2 +- 4 files changed, 8 insertions(+), 16 deletions(-) rename src/api_s2c/event/yuandan/{ApiDMOpen.ts => ApiOpen.ts} (54%) diff --git a/src/api_s2c/event/yuandan/ApiDMOpen.ts b/src/api_s2c/event/yuandan/ApiOpen.ts similarity index 54% rename from src/api_s2c/event/yuandan/ApiDMOpen.ts rename to src/api_s2c/event/yuandan/ApiOpen.ts index c0c659a..a22e2cc 100644 --- a/src/api_s2c/event/yuandan/ApiDMOpen.ts +++ b/src/api_s2c/event/yuandan/ApiOpen.ts @@ -2,15 +2,12 @@ import {ApiCall} from "tsrpc"; import {ReqDMOpen, ResDMOpen} from "../../../shared/protocols/event/yuandan/PtlDMOpen"; import {HuoDongFun} from "../../../public/huodongfun"; import {PayFun} from "../../../public/pay"; +import {Yuandanfun} from "./fun"; export default async function (call: ApiCall) { - let data = await G.mongodb.cEvent('yuandandamo').findOne({uid: call.uid, type: 'yuandandamo'}) - - let _hd = (await HuoDongFun.gethdList(call, 14))[0] - - let payIds = _hd?.data?.gift?.filter(i => i.payId)?.map(i => i.payId) + let _hd = await Yuandanfun.getCon(call) call.succ({ - record: data?.record || {} + data: (await G.mongodb.cEvent(`yuandan${_hd.hdid}`).findOne({uid: call.uid, type: 'yuandandamo'})) || {} }) } \ No newline at end of file diff --git a/src/api_s2c/event/yuandan/fun.ts b/src/api_s2c/event/yuandan/fun.ts index 7ac4168..7612211 100644 --- a/src/api_s2c/event/yuandan/fun.ts +++ b/src/api_s2c/event/yuandan/fun.ts @@ -8,14 +8,9 @@ import {PlayerFun} from "../../../public/player"; export class Yuandanfun { /**配置 */ static async getCon(call: ApiCall) { - let _con: { [id: string]: ReqAddHuoDong } = {} - let _hd = await HuoDongFun.gethdList(call, 8) - for (let index = 0; index < _hd.length; index++) { - const element = _hd[index]; - if (element && element._id) delete element._id - _con[element.hdid] = element - } - return _con + let _hd = (await HuoDongFun.gethdList(call, 14))[0] + if (!_hd) return call.errorCode(-1) + return _hd } /**获取所有符合时间的活动 */ diff --git a/src/shared/protocols/event/yuandan/PtlDMOpen.ts b/src/shared/protocols/event/yuandan/PtlDMOpen.ts index 0724ba5..d4f06ef 100644 --- a/src/shared/protocols/event/yuandan/PtlDMOpen.ts +++ b/src/shared/protocols/event/yuandan/PtlDMOpen.ts @@ -7,7 +7,7 @@ export type ReqDMOpen = { }; export type ResDMOpen = { - record:{ + data:{ [k: string]: any; } }; \ No newline at end of file diff --git a/src/shared/protocols/serviceProto.ts b/src/shared/protocols/serviceProto.ts index 9d4a22e..e6a6bff 100644 --- a/src/shared/protocols/serviceProto.ts +++ b/src/shared/protocols/serviceProto.ts @@ -11426,7 +11426,7 @@ export const serviceProto: ServiceProto = { "properties": [ { "id": 0, - "name": "record", + "name": "myData", "type": { "type": "Interface", "indexSignature": {