fix: 请求github异常
This commit is contained in:
@ -253,12 +253,16 @@ class AboutController extends GetxController {
|
|||||||
// 获取远程版本
|
// 获取远程版本
|
||||||
Future getRemoteApp() async {
|
Future getRemoteApp() async {
|
||||||
var result = await Request().get(Api.latestApp, extra: {'ua': 'pc'});
|
var result = await Request().get(Api.latestApp, extra: {'ua': 'pc'});
|
||||||
|
isLoading.value = false;
|
||||||
|
if (result.data == null || result.data.isEmpty) {
|
||||||
|
SmartDialog.showToast('获取远程版本失败,请检查网络');
|
||||||
|
return;
|
||||||
|
}
|
||||||
data = LatestDataModel.fromJson(result.data);
|
data = LatestDataModel.fromJson(result.data);
|
||||||
remoteAppInfo = data;
|
remoteAppInfo = data;
|
||||||
remoteVersion.value = data.tagName!;
|
remoteVersion.value = data.tagName!;
|
||||||
isUpdate.value =
|
isUpdate.value =
|
||||||
Utils.needUpdate(currentVersion.value, remoteVersion.value);
|
Utils.needUpdate(currentVersion.value, remoteVersion.value);
|
||||||
isLoading.value = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 跳转下载/本地更新
|
// 跳转下载/本地更新
|
||||||
|
|||||||
@ -243,6 +243,10 @@ class Utils {
|
|||||||
SmartDialog.dismiss();
|
SmartDialog.dismiss();
|
||||||
var currentInfo = await PackageInfo.fromPlatform();
|
var currentInfo = await PackageInfo.fromPlatform();
|
||||||
var result = await Request().get(Api.latestApp, extra: {'ua': 'mob'});
|
var result = await Request().get(Api.latestApp, extra: {'ua': 'mob'});
|
||||||
|
if (result.data == null || result.data.isEmpty) {
|
||||||
|
SmartDialog.showToast('获取远程版本失败,请检查网络');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
LatestDataModel data = LatestDataModel.fromJson(result.data);
|
LatestDataModel data = LatestDataModel.fromJson(result.data);
|
||||||
bool isUpdate = Utils.needUpdate(currentInfo.version, data.tagName!);
|
bool isUpdate = Utils.needUpdate(currentInfo.version, data.tagName!);
|
||||||
if (isUpdate) {
|
if (isUpdate) {
|
||||||
|
|||||||
Reference in New Issue
Block a user