mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-28 03:58:39 +00:00
mod: try-catch some requests
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -604,11 +604,13 @@ class BangumiIntroController extends CommonController {
|
|||||||
RxInt followStatus = (-1).obs;
|
RxInt followStatus = (-1).obs;
|
||||||
|
|
||||||
Future queryIsFollowed() async {
|
Future queryIsFollowed() async {
|
||||||
|
try {
|
||||||
dynamic result = await Request().get(
|
dynamic result = await Request().get(
|
||||||
'https://www.bilibili.com/bangumi/play/ss$seasonId',
|
'https://www.bilibili.com/bangumi/play/ss$seasonId',
|
||||||
);
|
);
|
||||||
dom.Document document = html_parser.parse(result.data);
|
dom.Document document = html_parser.parse(result.data);
|
||||||
dom.Element? scriptElement = document.querySelector('script#__NEXT_DATA__');
|
dom.Element? scriptElement =
|
||||||
|
document.querySelector('script#__NEXT_DATA__');
|
||||||
if (scriptElement != null) {
|
if (scriptElement != null) {
|
||||||
dynamic scriptContent = jsonDecode(scriptElement.text);
|
dynamic scriptContent = jsonDecode(scriptElement.text);
|
||||||
isFollowed.value =
|
isFollowed.value =
|
||||||
@@ -620,5 +622,6 @@ class BangumiIntroController extends CommonController {
|
|||||||
// ['play_view_business_info']['user_status']['watch_progress']
|
// ['play_view_business_info']['user_status']['watch_progress']
|
||||||
// ['current_watch_progress'];
|
// ['current_watch_progress'];
|
||||||
}
|
}
|
||||||
|
} catch (_) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,10 +105,12 @@ class HomeController extends GetxController with GetTickerProviderStateMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void querySearchDefault() async {
|
void querySearchDefault() async {
|
||||||
|
try {
|
||||||
var res = await Request().get(Api.searchDefault);
|
var res = await Request().get(Api.searchDefault);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
defaultSearch.value = res.data['data']['name'];
|
defaultSearch.value = res.data['data']['name'];
|
||||||
}
|
}
|
||||||
|
} catch (_) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
showUserInfoDialog(context) {
|
showUserInfoDialog(context) {
|
||||||
|
|||||||
@@ -124,6 +124,7 @@ class MainController extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future _queryPMUnread() async {
|
Future _queryPMUnread() async {
|
||||||
|
try {
|
||||||
dynamic res = await Request().get(Api.msgUnread);
|
dynamic res = await Request().get(Api.msgUnread);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
return {
|
return {
|
||||||
@@ -137,12 +138,14 @@ class MainController extends GetxController {
|
|||||||
'msg': res.data['message'],
|
'msg': res.data['message'],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
} catch (_) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future _queryMsgFeedUnread() async {
|
Future _queryMsgFeedUnread() async {
|
||||||
if (isLogin.value.not) {
|
if (isLogin.value.not) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
dynamic res = await Request().get(Api.msgFeedUnread);
|
dynamic res = await Request().get(Api.msgFeedUnread);
|
||||||
if (res.data['code'] == 0) {
|
if (res.data['code'] == 0) {
|
||||||
return {
|
return {
|
||||||
@@ -155,6 +158,7 @@ class MainController extends GetxController {
|
|||||||
'msg': res.data['message'],
|
'msg': res.data['message'],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
} catch (_) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
void getUnreadDynamic() async {
|
void getUnreadDynamic() async {
|
||||||
|
|||||||
Reference in New Issue
Block a user