Skip to content

Commit 1fd0c0b

Browse files
authored
Merge pull request #4 from ZCWzy/main
fix: electricity fix
2 parents 67087b7 + e9d83cb commit 1fd0c0b

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

lib/repository/electricity/electricity_session.dart

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ Future<void> updateInformation() async {
134134
options: Options(headers: {"Cookie": sessionId}))
135135
.then((value) => value.data);
136136

137-
int building = int.parse(account.substring(0, 1));
137+
int building = int.parse(account.substring(1, 4));
138138
RegExp name = RegExp(r"表名称:.*");
139139
RegExp data = RegExp(r"剩余量:.*");
140140

@@ -152,13 +152,10 @@ Future<void> updateInformation() async {
152152
}
153153
}
154154
} else {
155-
int dingXiangElectricity = 0;
156-
for (int i = nameArray.length - 1; i >= 0; --i) {
157-
if (nameArray[i][0]!.contains("电表")) {
158-
electricityInfo.value = "$dingXiangElectricity 度";
159-
return;
160-
}
161-
}
155+
//by ZCWzy
156+
String? dingXiangElectricity = dataArray[nameArray.length - 1][0];
157+
electricityInfo.value = "$dingXiangElectricity 度";
158+
return;
162159
}
163160

164161
throw NotFoundException();

0 commit comments

Comments
 (0)