Эх сурвалжийг харах

Merge pull request #112 from XingHeYuZhuan/pending

improve: 增强重庆人文科技学院的教务识别
星河欲转 2 долоо хоног өмнө
parent
commit
bb139f65df

+ 8 - 4
resources/CQRK/cqrk_01.js

@@ -108,10 +108,14 @@ function parseTimetableToModel(doc) {
                     let startSection = 0;
                     let startSection = 0;
                     let endSection = 0;
                     let endSection = 0;
                     if (weekStr) {
                     if (weekStr) {
-                        const secMatch = weekStr.match(/\[(\d+)(?:-(\d+))?节\]/);
-                        if (secMatch) {
-                            startSection = parseInt(secMatch[1]);
-                            endSection = secMatch[2] ? parseInt(secMatch[2]) : startSection;
+                        // 匹配方括号内所有的数字
+                        const sectionPart = weekStr.match(/\[(.*?)节\]/);
+                        if (sectionPart && sectionPart[1]) {
+                            const sections = sectionPart[1].split('-').map(Number).filter(n => !isNaN(n));
+                            if (sections.length > 0) {
+                                startSection = sections[0];
+                                endSection = sections[sections.length - 1];
+                            }
                         }
                         }
                     }
                     }