29 lines
1.0 KiB
TypeScript
29 lines
1.0 KiB
TypeScript
import { ApiCall } from "tsrpc";
|
|
import { KuangDongfun } from "../../public/kuangdong";
|
|
import { LingZhuLaiXifun } from "../../public/lingzhulaixi";
|
|
import { ReqPkRank, ResPkRank } from "../../shared/protocols/lingzhulaixi/PtlPkRank";
|
|
|
|
export default async function (call: ApiCall<ReqPkRank, ResPkRank>) {
|
|
let _bossData = await LingZhuLaiXifun.getBossData(call.req.bid)
|
|
let rankList = []
|
|
let userdps = 0
|
|
if (_bossData && Object.keys(_bossData.pkuser).length > 0) {
|
|
userdps = _bossData.pkuser?.[call.uid] || 0
|
|
let fmtrankList = await LingZhuLaiXifun.getRankList(_bossData.pkuser)
|
|
// 取前三条
|
|
for (let index = 0; index < fmtrankList.length; index++) {
|
|
const element = fmtrankList[index];
|
|
if (rankList.length >= 3) {
|
|
break
|
|
}
|
|
element.userinfo = await KuangDongfun.getUserInfo(element.uid)
|
|
rankList.push(element)
|
|
}
|
|
}
|
|
|
|
call.succ({
|
|
bossdata: _bossData,
|
|
ranklist: rankList,
|
|
userdps: userdps
|
|
})
|
|
} |