HJ_Server/src/api_s2c/eventlist/ApihdGetList.ts
2023-12-31 11:24:38 +08:00

19 lines
834 B
TypeScript

import {ApiCall} from "tsrpc";
import {HuoDongFun} from "../../public/huodongfun";
import {ReqhdGetList, ReshdGetList} from "../../shared/protocols/eventlist/PtlhdGetList";
import {HeroShared} from "../../shared/public/hero";
export default async function (call: ApiCall<ReqhdGetList, ReshdGetList>) {
let _hdList = await HuoDongFun.gethdList(call)
call.succ({hdlist: _hdList});
// 消费竞赛是跨服活动,活动开启时,同步当前用户信息到跨服数据库
G.huodong.xfjs = !!_hdList.find(i => i.htype == 11);
if (G.huodong.xfjs) {
G.huodong.xfjsId = _hdList.find(i => i.htype == 11).hdid
let myUser = await G.mongodb.collection('user').findOne({uid: call.uid})
G.crossmongodb.collection('huodong_user').updateOne({uid: call.uid}, {$set: myUser}, {upsert: true})
}
}