first commit

This commit is contained in:
cieanyau committed 2026-11-06 00:04:38 +08:00
commit db5762abd4
687 files changed
+171307

No files matched your search

+44
View File
@@ -0,0 +1,44 @@
async function e(e, t = () => !0) {
let n = [],
r = new Set();
for (let i = 1; ; i++) {
if (!t()) return [];
let a = await e(i, 100);
if (!t()) return [];
if (!a || !Array.isArray(a.list)) throw Error(`列表响应无效,请重试`);
let o = a.count === void 0 ? null : Number(a.count);
if (o !== null && (!Number.isSafeInteger(o) || o < 0))
throw Error(`分页信息无效,请重试`);
let s = n.length;
for (let e of a.list) {
if (!e || !Number.isSafeInteger(Number(e.id)) || Number(e.id) <= 0)
throw Error(`列表项目无效,请重试`);
r.has(String(e.id)) || (r.add(String(e.id)), n.push(e));
}
if (o === null ? a.list.length < 100 : n.length >= o) return n;
if (s === n.length) throw Error(`未能加载完整列表,请刷新重试`);
}
}
function t(e, t) {
let n = (
Array.isArray(e) ? e : e && typeof e == `object` && `id` in e ? [e] : []
).filter((e) => !!e && typeof e == `object`),
r = [],
i = [],
a = [];
for (let e of t) {
let t = n.filter((t) => Number(t.id) === e);
t.length === 1 && Number(t[0].status) === 200
? r.push(e)
: (i.push(e),
a.push(
`#${e}:${t.length === 1 ? String(t[0].msg || `关联失败`) : `未取得明确结果,请刷新核对`}`,
));
}
return {
succeeded: r,
failed: i,
details: a,
};
}
export { e as n, t };