HJ_Server/src/api_s2c/eventlist/ApihdGetList.ts
2024-01-03 11:01:12 +08:00

29 lines
1.1 KiB
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: {
lv: myUser.lv,
vip: myUser.vip,
name: myUser.name,
sid: myUser.sid,
nexp: myUser.nexp,
head: myUser.head,
headFrame: myUser.headFrame
}
}, {upsert: true})
}
}