mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: try-catch some requests
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -124,37 +124,41 @@ class MainController extends GetxController {
|
||||
}
|
||||
|
||||
Future _queryPMUnread() async {
|
||||
dynamic res = await Request().get(Api.msgUnread);
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': ((res.data['data']?['unfollow_unread'] as int?) ?? 0) +
|
||||
((res.data['data']?['follow_unread'] as int?) ?? 0),
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
}
|
||||
try {
|
||||
dynamic res = await Request().get(Api.msgUnread);
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': ((res.data['data']?['unfollow_unread'] as int?) ?? 0) +
|
||||
((res.data['data']?['follow_unread'] as int?) ?? 0),
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
}
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
Future _queryMsgFeedUnread() async {
|
||||
if (isLogin.value.not) {
|
||||
return;
|
||||
}
|
||||
dynamic res = await Request().get(Api.msgFeedUnread);
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data'],
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
}
|
||||
try {
|
||||
dynamic res = await Request().get(Api.msgFeedUnread);
|
||||
if (res.data['code'] == 0) {
|
||||
return {
|
||||
'status': true,
|
||||
'data': res.data['data'],
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
'status': false,
|
||||
'msg': res.data['message'],
|
||||
};
|
||||
}
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
void getUnreadDynamic() async {
|
||||
|
||||
Reference in New Issue
Block a user