From 4b7581d9fe52eead054d3842f1dc4e276dd92f4e Mon Sep 17 00:00:00 2001 From: bggRGjQaUbCoE Date: Mon, 13 Jan 2025 18:51:53 +0800 Subject: [PATCH] opt: search Signed-off-by: bggRGjQaUbCoE --- lib/http/search.dart | 5 ++++- lib/http/video.dart | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/http/search.dart b/lib/http/search.dart index 49b784e3..d547fc33 100644 --- a/lib/http/search.dart +++ b/lib/http/search.dart @@ -97,7 +97,10 @@ class SearchHttp { if (pubEnd != null) 'pubtime_end_s': pubEnd, }; var res = await Request().get(Api.searchByType, queryParameters: reqData); - if (res.data['code'] is int && res.data['code'] == 0) { + if (res.data is! Map) { + return LoadingState.error('没有相关数据'); + } + if (res.data['code'] == 0) { dynamic data; try { switch (searchType) { diff --git a/lib/http/video.dart b/lib/http/video.dart index c54c01fc..1487e88b 100644 --- a/lib/http/video.dart +++ b/lib/http/video.dart @@ -245,7 +245,7 @@ class VideoHttp { 'web_location': 1550101, }); - final usePgcApi = forcePgcApi == true || GStorage.isLogin; + late final usePgcApi = forcePgcApi == true || GStorage.isLogin; try { var res = await Request().get(