From a2f0a6b621f60395455f7264f0135fd039fc2920 Mon Sep 17 00:00:00 2001 From: nano71 <80870408+nano71@users.noreply.github.com> Date: Thu, 21 Nov 2024 15:54:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=89=B9=E6=AE=8A=E8=AF=BE?= =?UTF-8?q?=E8=A1=A8=E7=9A=84=E8=A7=A3=E6=9E=90=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- android/local.properties | 2 +- lib/common/get.dart | 81 +++++++++++++++++++++++----------------- pubspec.yaml | 8 +++- 3 files changed, 55 insertions(+), 36 deletions(-) diff --git a/android/local.properties b/android/local.properties index 73407f6..b9e12ea 100644 --- a/android/local.properties +++ b/android/local.properties @@ -1,5 +1,5 @@ sdk.dir=C:\\sdk\\android-sdk flutter.sdk=C:\\sdk\\flutter -flutter.buildMode=release +flutter.buildMode=debug flutter.versionName=1.6.241118 flutter.versionCode=71 \ No newline at end of file diff --git a/lib/common/get.dart b/lib/common/get.dart index 5953d75..61831f7 100644 --- a/lib/common/get.dart +++ b/lib/common/get.dart @@ -157,6 +157,7 @@ Future getSchedule() async { String weekCN = innerHtmlTrimReplace(tableCells(tableRows(i)[j])[1]); String courseVenue = teachLocation(innerHtmlTrim(tableCells(tableRows(i)[j])[3])); bool specialWeek = true; + List initList(bool isEven) { List list = []; for (int i = int.parse(weekList.first); i <= int.parse(weekList.last); i++) { @@ -167,28 +168,50 @@ Future getSchedule() async { return list; } + void step3() { + List cache = weekInterval.split(","); + for (int i = 0; i < cache.length; i++) { + if (cache[i].split("-").length == 1) { + weekList.add(cache[i]); + continue; + } + for (int j = int.parse(cache[i].split("-")[0]); j <= int.parse(cache[i].split("-")[1]); j++) { + weekList.add(j.toString()); + } + } + } + + void step4(bool isEven) { + String key = isEven ? "双" : "单"; + if (weekInterval.indexOf(",") != -1) { + List cache = weekInterval.split(","); + if (cache[0].indexOf(key) != -1) { + weekList = cache[0].replaceAll(key, "").split("-"); + weekInterval = cache[1]; + } else { + weekList = cache[1].replaceAll(key, "").split("-"); + weekInterval = cache[0]; + } + weekList = initList(isEven); + + step3(); + weekList.sort((a, b) => int.parse(a) - int.parse(b)); + } else { + weekInterval = weekInterval.replaceAll(key, ""); + weekList = weekInterval.split("-"); + weekList = initList(isEven); + } + } + //单周 if (weekInterval.indexOf("单") != -1) { - weekInterval = weekInterval.replaceAll("单", ""); - weekList = weekInterval.split("-"); - weekList = initList(false); + step4(false); //双周 } else if (weekInterval.indexOf("双") != -1) { - weekInterval = weekInterval.replaceAll("双", ""); - weekList = weekInterval.split("-"); - weekList = initList(true); + step4(true); } else if (weekInterval.indexOf(",") != -1) { if (weekInterval.indexOf("-") != -1) { - List cache = weekInterval.split(","); - for (int i = 0; i < cache.length; i++) { - if (cache[i].split("-").length == 1) { - weekList.add(cache[i]); - continue; - } - for (int j = int.parse(cache[i].split("-")[0]); j <= int.parse(cache[i].split("-")[1]); j++) { - weekList.add(j.toString()); - } - } + step3(); } else { weekInterval = weekInterval.replaceAll(",", "-"); weekList = weekInterval.split("-"); @@ -198,12 +221,14 @@ Future getSchedule() async { specialWeek = false; weekList = weekInterval.split("-"); } + if (lessonList.length > 1 && weekCN != " ") for (int lesson = int.parse(lessonList[0]); lesson <= int.parse(lessonList[1]); lesson++) { - if (weekList.length > 1 && specialWeek) { - weekList.forEach((teachWeek) { + // 普通模式 + if ((weekList.length > 1 && specialWeek) || weekList.length >= 3) { + for (String teachWeek in weekList) { // print(teachWeek); - _schedule[teachWeek.toString()]?[week(i, j)]?[lesson.toString()] = [ + _schedule[teachWeek]?[week(i, j)]?[lesson.toString()] = [ //课程名 course(i), //老师名字 @@ -213,7 +238,8 @@ Future getSchedule() async { //备注 remark(i, j) ]; - }); + } + // 区间模式 } else if (weekList.length == 2) { for (int teachWeek = int.parse(weekList[0]); teachWeek <= int.parse(weekList[1]); teachWeek++) { _schedule[teachWeek.toString()]?[week(i, j)]?[lesson.toString()] = [ @@ -227,20 +253,7 @@ Future getSchedule() async { remark(i, j) ]; } - } else if (weekList.length >= 3) { - for (String teachWeek in weekList) { - // print(teachWeek); - _schedule[teachWeek]?[week(i, j)]?[lesson.toString()] = [ - //课程名 - course(i), - //老师名字 - teacher(i), - //上课地点 - courseVenue, - //备注 - remark(i, j) - ]; - } + // 一周模式 } else { _schedule[weekInterval]?[week(i, j)]?[lesson.toString()] = [ //课程名 diff --git a/pubspec.yaml b/pubspec.yaml index c89ec1a..0cadbb0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: "https://pub.flutter-io.cn" # Remove this line if you wish to publis # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.6.241114+70 +version: 1.6.241121+72 environment: sdk: ">=2.14.0 <4.0.0" @@ -44,6 +44,7 @@ dependencies: sentry_flutter: ^8.10.1 share_plus: ^10.1.2 dev_dependencies: + sentry_dart_plugin: ^2.1.0 flutter_test: sdk: flutter @@ -101,3 +102,8 @@ development—environment: kotlin: 2.0.0 gradle: 8.7.0 +sentry: + project: glut-assistant-n + org: lightningdevelopmentteam + auth_token: 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 + upload_sources: true