Skip to content

Commit d2306e1

Browse files
committed
fix: school card remain display error
1 parent b7b1452 commit d2306e1

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

lib/repository/xidian_ids/school_card_session.dart

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,21 +126,30 @@ class SchoolCardSession extends IDSSession {
126126

127127
/// Post formula: fetch money.
128128
String text = "";
129-
var getSpans = page.getElementsByTagName("span");
130-
for (var i in getSpans) {
129+
for (var i in page.getElementsByTagName("span")) {
131130
if (i.attributes["name"] == "showbalanceid") {
132131
text = i.innerHtml;
133132
break;
134133
}
135134
}
136-
if (text.isEmpty) text = "school_card_status.failed_to_query";
137-
if (text.contains(RegExp(r'[0-9]'))) {
138-
money.value = text.substring(4);
135+
log.info("[SchoolCardSession] remains on the surface: $text");
136+
137+
if (text.contains("余额未结转")) {
138+
var element = page.getElementById("hidebalanceid");
139+
if (element != null) {
140+
text = element.innerHtml;
141+
}
142+
} else if (text.contains(RegExp(r'[0-9]'))) {
143+
text = text.substring(4);
144+
}
145+
log.info("[SchoolCardSession] remains: $text");
146+
147+
if (text.isEmpty) {
148+
text = "school_card_status.failed_to_query";
139149
} else if (text.contains("school_card_status.failed_to_query")) {
140150
money.value = "school_card_status.failed_to_query";
141151
} else {
142-
/// Should not exec it.
143-
money.value = "0.00";
152+
money.value = text;
144153
}
145154
isInit.value = SessionState.fetched;
146155
} catch (e) {

0 commit comments

Comments
 (0)