diff --git a/src/api_s2c/event/xiaofeijingsai/ApiOpen.ts b/src/api_s2c/event/xiaofeijingsai/ApiOpen.ts new file mode 100644 index 0000000..79c06bb --- /dev/null +++ b/src/api_s2c/event/xiaofeijingsai/ApiOpen.ts @@ -0,0 +1,29 @@ +import {ApiCall} from "tsrpc"; +import {ReqOpen, ResOpen} from "../../../shared/protocols/event/xiaofeijingsai/PtlOpen"; +import {PayFun} from "../../../public/pay"; +import {HuoDongFun} from "../../../public/huodongfun"; +import {PublicShared} from "../../../shared/public/public"; + + +export default async function (call: ApiCall) { + // let data = await G.mongodb.cEvent('zhoumolibao').findOne({uid: call.uid, type: 'zhoumolibao'}) + // + let _hd = (await HuoDongFun.gethdList(call, 11))[0] + console.log(_hd) + // + // let payIds = _hd?.data?.gift?.filter(i => i.payId)?.map(i => i.payId) + // let a = [] + let rmbuse = await G.mongodb.collection('rmbuse').aggregate([ + {$match: {isAdd: false}}, + {$group: {_id: "$uid", total: {$sum: "$change"}}}, + {$sort: {total: 1}} + ]).toArray() + + let list: any = rmbuse.map(i => ({...i, total: R.negate(i.total)})) + + let users = await G.mongodb.collection('user').find({uid: {$in: list.map(i => i._id)}}).toArray() + + list = list.map(i => ({...i, player: users.find(v => v.uid == i._id)})) + + call.succ({list}) +} \ No newline at end of file diff --git a/src/shared/protocols/event/xiaofeijingsai/PtlOpen.ts b/src/shared/protocols/event/xiaofeijingsai/PtlOpen.ts new file mode 100644 index 0000000..5145ee7 --- /dev/null +++ b/src/shared/protocols/event/xiaofeijingsai/PtlOpen.ts @@ -0,0 +1,8 @@ +/** + * 消费竞赛 + */ +export type ReqOpen = {}; + +export type ResOpen = { + list: any[] +}; \ No newline at end of file