HJ_Server/src/api_s2c/wzry/ApiCatGroup.ts
DESKTOP-15R5JU0\legu 97e070ea81 init
2023-11-17 12:02:12 +08:00

31 lines
1.1 KiB
TypeScript

import { ApiCall } from "tsrpc";
import { WangZheRongYaofun } from "../../public/wzry";
import { ReqCatGroup, ResCatGroup } from "../../shared/protocols/wzry/PtlCatGroup";
export default async function (call: ApiCall<ReqCatGroup, ResCatGroup>) {
// let status = await WangZheRongYaofun.getWangZheStatus()
// if (status.status < 5) {
// // 未到报名时间
// return call.error('', { code: -1, message: globalThis.lng.wzry_5 })
// }
let _where = {};
let _num = {
"256": 4,
"64": 32
};
if (call.req.deep == 256 || call.req.deep == 64) { // 4个人
_where['groupinfo.order'] = { $gt: (call.req.group - 1) * _num[call.req.deep], $lte: (call.req.group) * _num[call.req.deep] };
if (call.req.deep == 64) _where["deep"] = { $gte: 3 };
} else {
_where["deep"] = { $gte: 6 };
}
let groupList = await WangZheRongYaofun.getFightGroup(call, _where);
if (!groupList) {
// 未到时间
return call.error('', { code: -3/* , message: globalThis.lng.wzry_11 */ });
}
call.succ({ grouplist: groupList });
}