MCPcopy Create free account
hub / github.com/Xu22Web/tech-study-js / findExamPaper

Function findExamPaper

tech-study.js:3518–3548  ·  view source on GitHub ↗

* @description 查询专项练习列表

()

Source from the content-addressed store, hash-verified

3516 * @description 查询专项练习列表
3517 */
3518async function findExamPaper() {
3519 // 获取总页数
3520 const total = await initExam();
3521 // 当前页数
3522 let current = 1;
3523 log(`正在寻找的专项练习...`);
3524 // 创建提示
3525 createTip(`正在寻找的专项练习...`);
3526 while (current <= total && current) {
3527 // 请求数据
3528 const data = await getExamPaper(current);
3529 if (data) {
3530 // 获取专项练习的列表
3531 const examPapers = data.list;
3532 for (const i in examPapers) {
3533 // 遍历查询有没有没做过的
3534 if (examPapers[i].status !== 2) {
3535 // status: 1 开始答题, 2 已满分/重新答题, 3 继续答题
3536 return examPapers[i].id;
3537 }
3538 }
3539 // 增加页码
3540 current += 1;
3541 // 等待
3542 await sleep(3000);
3543 }
3544 else {
3545 break;
3546 }
3547 }
3548}
3549/**
3550 * @description 初始化主页面
3551 */

Callers 1

doExamPaperFunction · 0.70

Calls 5

initExamFunction · 0.70
logFunction · 0.70
createTipFunction · 0.70
getExamPaperFunction · 0.70
sleepFunction · 0.70

Tested by

no test coverage detected