使用 @param 验证接口

This commit is contained in:
undefined committed 2020-07-10 22:54:26 +08:00
1 parent 4e85b696c0
commit 19cf1a5304
22 files changed
+657 -393

No files matched your search

+5 -3
View File
@@ -511,9 +511,11 @@ export const ContestHandlerMixin = (c) => class extends c {
}
// eslint-disable-next-line class-methods-use-this
async verifyProblems(domainId: string, pids: number[]) {
await problem.getList(domainId, pids, true);
return pids;
async verifyProblems(domainId: string, pids: Array<number | string>) {
const pdict = await problem.getList(domainId, pids, true);
const _pids: Set<number> = new Set();
for (const i in pdict) _pids.add(pdict[i].docId);
return Array.from(_pids);
}
};
+4 -1
View File
@@ -116,7 +116,10 @@ export async function random<T>(domainId: string, query: FilterQuery<T>) {
} return null;
}
export async function getList(domainId: string, pids: number[], getHidden = false, doThrow = true) {
export async function getList(
domainId: string, pids: Array<number | string>,
getHidden = false, doThrow = true,
) {
pids = Array.from(new Set(pids));
const r = {};
const q: any = { $or: [{ docId: { $in: pids } }, { pid: { $in: pids } }] };