From 982a52372fcea48175133428aae87c30dbced337 Mon Sep 17 00:00:00 2001 From: guozhigq Date: Fri, 27 Sep 2024 16:57:18 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B5=8F=E8=A7=88=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=E4=B8=93=E6=A0=8F=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/http/search.dart | 6 +++++- lib/pages/history/widgets/item.dart | 13 ++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/http/search.dart b/lib/http/search.dart index 403e6a37..00e51497 100644 --- a/lib/http/search.dart +++ b/lib/http/search.dart @@ -143,7 +143,11 @@ class SearchHttp { } final dynamic res = await Request().get(Api.ab2c, data: {...data}); - return res.data['data'].first['cid']; + if (res.data['code'] == 0) { + return res.data['data'].first['cid']; + } else { + return -1; + } } static Future> bangumiInfo( diff --git a/lib/pages/history/widgets/item.dart b/lib/pages/history/widgets/item.dart index baebfedb..50466a6b 100644 --- a/lib/pages/history/widgets/item.dart +++ b/lib/pages/history/widgets/item.dart @@ -43,14 +43,17 @@ class HistoryItem extends StatelessWidget { } if (videoItem.history.business.contains('article')) { int cid = videoItem.history.cid ?? - // videoItem.history.oid ?? + videoItem.history.oid ?? await SearchHttp.ab2c(aid: aid, bvid: bvid); + if (cid == -1) { + return SmartDialog.showToast('无法获取文章内容'); + } Get.toNamed( - '/webview', + '/read', parameters: { - 'url': 'https://www.bilibili.com/read/cv$cid', - 'type': 'note', - 'pageTitle': videoItem.title + 'title': videoItem.title, + 'id': cid.toString(), + 'articleType': 'read', }, ); } else if (videoItem.history.business == 'live') {