mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-07-02 15:20:18 +08:00
fix: bangumi like/coin/fav state
This commit is contained in:
@@ -123,6 +123,7 @@ class _ListSheetContentState extends State<ListSheetContent> {
|
|||||||
SmartDialog.showToast('切换到:$title');
|
SmartDialog.showToast('切换到:$title');
|
||||||
widget.onClose();
|
widget.onClose();
|
||||||
widget.changeFucCall(
|
widget.changeFucCall(
|
||||||
|
episode is bangumi.EpisodeItem ? episode.epId : null,
|
||||||
episode.runtimeType.toString() == "EpisodeItem"
|
episode.runtimeType.toString() == "EpisodeItem"
|
||||||
? episode.bvid
|
? episode.bvid
|
||||||
: widget.bvid,
|
: widget.bvid,
|
||||||
|
|||||||
@@ -51,6 +51,8 @@ class Api {
|
|||||||
// https://api.bilibili.com/x/web-interface/archive/has/like
|
// https://api.bilibili.com/x/web-interface/archive/has/like
|
||||||
static const String hasLikeVideo = '/x/web-interface/archive/has/like';
|
static const String hasLikeVideo = '/x/web-interface/archive/has/like';
|
||||||
|
|
||||||
|
static const String bangumiLikeCoinFav = '/pgc/season/episode/community';
|
||||||
|
|
||||||
// 视频点踩 web端不支持
|
// 视频点踩 web端不支持
|
||||||
|
|
||||||
// 点踩 Post(app端)
|
// 点踩 Post(app端)
|
||||||
|
|||||||
@@ -295,6 +295,19 @@ class VideoHttp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取点赞/投币/收藏状态 bangumi
|
||||||
|
static Future bangumiLikeCoinFav({dynamic epId}) async {
|
||||||
|
var res = await Request().get(
|
||||||
|
Api.bangumiLikeCoinFav,
|
||||||
|
data: {'ep_id': epId},
|
||||||
|
);
|
||||||
|
if (res.data['code'] == 0) {
|
||||||
|
return {'status': true, 'data': res.data['data']};
|
||||||
|
} else {
|
||||||
|
return {'status': false, 'data': []};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 获取点赞状态
|
// 获取点赞状态
|
||||||
static Future hasLikeVideo({required String bvid}) async {
|
static Future hasLikeVideo({required String bvid}) async {
|
||||||
var res = await Request().get(Api.hasLikeVideo, data: {'bvid': bvid});
|
var res = await Request().get(Api.hasLikeVideo, data: {'bvid': bvid});
|
||||||
|
|||||||
@@ -86,12 +86,13 @@ class BangumiIntroController extends CommonController {
|
|||||||
userLogin = userInfo != null;
|
userLogin = userInfo != null;
|
||||||
|
|
||||||
if (userLogin) {
|
if (userLogin) {
|
||||||
// 获取点赞状态
|
// // 获取点赞状态
|
||||||
queryHasLikeVideo();
|
// queryHasLikeVideo();
|
||||||
// 获取投币状态
|
// // 获取投币状态
|
||||||
queryHasCoinVideo();
|
// queryHasCoinVideo();
|
||||||
// 获取收藏状态
|
// // 获取收藏状态
|
||||||
queryHasFavVideo();
|
// queryHasFavVideo();
|
||||||
|
queryBangumiLikeCoinFav();
|
||||||
}
|
}
|
||||||
|
|
||||||
queryData();
|
queryData();
|
||||||
@@ -116,6 +117,14 @@ class BangumiIntroController extends CommonController {
|
|||||||
Future<LoadingState> customGetData() =>
|
Future<LoadingState> customGetData() =>
|
||||||
SearchHttp.bangumiInfoNew(seasonId: seasonId, epId: epId);
|
SearchHttp.bangumiInfoNew(seasonId: seasonId, epId: epId);
|
||||||
|
|
||||||
|
// 获取点赞/投币/收藏状态
|
||||||
|
Future queryBangumiLikeCoinFav() async {
|
||||||
|
var result = await VideoHttp.bangumiLikeCoinFav(epId: epId);
|
||||||
|
hasLike.value = result["data"]['like'] == 1;
|
||||||
|
hasCoin.value = result["data"]['coin_number'] != 0;
|
||||||
|
hasFav.value = result["data"]['favorite'] == 1;
|
||||||
|
}
|
||||||
|
|
||||||
// 获取点赞状态
|
// 获取点赞状态
|
||||||
Future queryHasLikeVideo() async {
|
Future queryHasLikeVideo() async {
|
||||||
var result = await VideoHttp.hasLikeVideo(bvid: bvid);
|
var result = await VideoHttp.hasLikeVideo(bvid: bvid);
|
||||||
@@ -308,10 +317,11 @@ class BangumiIntroController extends CommonController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 修改分P或番剧分集
|
// 修改分P或番剧分集
|
||||||
Future changeSeasonOrbangu(bvid, cid, aid, cover) async {
|
Future changeSeasonOrbangu(epId, bvid, cid, aid, cover) async {
|
||||||
// 重新获取视频资源
|
// 重新获取视频资源
|
||||||
VideoDetailController videoDetailCtr =
|
VideoDetailController videoDetailCtr =
|
||||||
Get.find<VideoDetailController>(tag: Get.arguments['heroTag']);
|
Get.find<VideoDetailController>(tag: Get.arguments['heroTag']);
|
||||||
|
this.epId = epId;
|
||||||
videoDetailCtr.bvid = bvid;
|
videoDetailCtr.bvid = bvid;
|
||||||
videoDetailCtr.cid.value = cid;
|
videoDetailCtr.cid.value = cid;
|
||||||
videoDetailCtr.danmakuCid.value = cid;
|
videoDetailCtr.danmakuCid.value = cid;
|
||||||
@@ -327,6 +337,9 @@ class BangumiIntroController extends CommonController {
|
|||||||
videoReplyCtr.aid = aid;
|
videoReplyCtr.aid = aid;
|
||||||
videoReplyCtr.onRefresh();
|
videoReplyCtr.onRefresh();
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
|
if (userLogin) {
|
||||||
|
queryBangumiLikeCoinFav();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 追番
|
// 追番
|
||||||
@@ -370,11 +383,12 @@ class BangumiIntroController extends CommonController {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
int epid = episodes[prevIndex].epid!;
|
||||||
int cid = episodes[prevIndex].cid!;
|
int cid = episodes[prevIndex].cid!;
|
||||||
String bvid = episodes[prevIndex].bvid!;
|
String bvid = episodes[prevIndex].bvid!;
|
||||||
int aid = episodes[prevIndex].aid!;
|
int aid = episodes[prevIndex].aid!;
|
||||||
dynamic cover = episodes[prevIndex].cover;
|
dynamic cover = episodes[prevIndex].cover;
|
||||||
changeSeasonOrbangu(bvid, cid, aid, cover);
|
changeSeasonOrbangu(epid, bvid, cid, aid, cover);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -405,11 +419,12 @@ class BangumiIntroController extends CommonController {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
int epid = episodes[nextIndex].epid!;
|
||||||
int cid = episodes[nextIndex].cid!;
|
int cid = episodes[nextIndex].cid!;
|
||||||
String bvid = episodes[nextIndex].bvid!;
|
String bvid = episodes[nextIndex].bvid!;
|
||||||
int aid = episodes[nextIndex].aid!;
|
int aid = episodes[nextIndex].aid!;
|
||||||
dynamic cover = episodes[nextIndex].cover;
|
dynamic cover = episodes[nextIndex].cover;
|
||||||
changeSeasonOrbangu(bvid, cid, aid, cover);
|
changeSeasonOrbangu(epid, bvid, cid, aid, cover);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -154,6 +154,7 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
widget.changeFuc(
|
widget.changeFuc(
|
||||||
|
widget.pages[i].epId,
|
||||||
widget.pages[i].bvid,
|
widget.pages[i].bvid,
|
||||||
widget.pages[i].cid,
|
widget.pages[i].cid,
|
||||||
widget.pages[i].aid,
|
widget.pages[i].aid,
|
||||||
|
|||||||
@@ -486,7 +486,7 @@ class VideoIntroController extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 修改分P或番剧分集
|
// 修改分P或番剧分集
|
||||||
Future changeSeasonOrbangu(bvid, cid, aid, cover) async {
|
Future changeSeasonOrbangu(epid, bvid, cid, aid, cover) async {
|
||||||
// 重新获取视频资源
|
// 重新获取视频资源
|
||||||
final VideoDetailController videoDetailCtr =
|
final VideoDetailController videoDetailCtr =
|
||||||
Get.find<VideoDetailController>(tag: heroTag);
|
Get.find<VideoDetailController>(tag: heroTag);
|
||||||
@@ -581,7 +581,7 @@ class VideoIntroController extends GetxController {
|
|||||||
final int cid = episodes[prevIndex].cid!;
|
final int cid = episodes[prevIndex].cid!;
|
||||||
final String rBvid = isPages ? bvid : episodes[prevIndex].bvid;
|
final String rBvid = isPages ? bvid : episodes[prevIndex].bvid;
|
||||||
final int rAid = isPages ? IdUtils.bv2av(bvid) : episodes[prevIndex].aid!;
|
final int rAid = isPages ? IdUtils.bv2av(bvid) : episodes[prevIndex].aid!;
|
||||||
changeSeasonOrbangu(rBvid, cid, rAid, null);
|
changeSeasonOrbangu(null, rBvid, cid, rAid, null);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -629,7 +629,7 @@ class VideoIntroController extends GetxController {
|
|||||||
final int cid = episodes[nextIndex].cid!;
|
final int cid = episodes[nextIndex].cid!;
|
||||||
final String rBvid = isPages ? bvid : episodes[nextIndex].bvid;
|
final String rBvid = isPages ? bvid : episodes[nextIndex].bvid;
|
||||||
final int rAid = isPages ? IdUtils.bv2av(bvid) : episodes[nextIndex].aid!;
|
final int rAid = isPages ? IdUtils.bv2av(bvid) : episodes[nextIndex].aid!;
|
||||||
changeSeasonOrbangu(rBvid, cid, rAid, null);
|
changeSeasonOrbangu(null, rBvid, cid, rAid, null);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ class ActionItem extends StatefulWidget {
|
|||||||
|
|
||||||
class ActionItemState extends State<ActionItem>
|
class ActionItemState extends State<ActionItem>
|
||||||
with SingleTickerProviderStateMixin {
|
with SingleTickerProviderStateMixin {
|
||||||
late AnimationController? controller;
|
AnimationController? controller;
|
||||||
late Animation<double>? _animation;
|
Animation<double>? _animation;
|
||||||
|
|
||||||
bool get _isThumbUp => widget.semanticsLabel == '点赞';
|
bool get _isThumbUp => widget.semanticsLabel == '点赞';
|
||||||
late int _lastTime;
|
late int _lastTime;
|
||||||
|
|||||||
@@ -126,6 +126,7 @@ class _PagesPanelState extends State<PagesPanel> {
|
|||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () => {
|
onTap: () => {
|
||||||
widget.changeFuc(
|
widget.changeFuc(
|
||||||
|
null,
|
||||||
widget.bvid,
|
widget.bvid,
|
||||||
widget.pages[i].cid,
|
widget.pages[i].cid,
|
||||||
IdUtils.bv2av(widget.bvid),
|
IdUtils.bv2av(widget.bvid),
|
||||||
|
|||||||
@@ -104,25 +104,27 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
videoPlayerServiceHandler.onVideoDetailChange(
|
videoPlayerServiceHandler.onVideoDetailChange(
|
||||||
value, videoDetailController.cid.value);
|
value, videoDetailController.cid.value);
|
||||||
});
|
});
|
||||||
bangumiIntroController = Get.put(BangumiIntroController(), tag: heroTag);
|
if (videoDetailController.videoType == SearchType.media_bangumi) {
|
||||||
bangumiIntroController.loadingState.listen((value) {
|
bangumiIntroController = Get.put(BangumiIntroController(), tag: heroTag);
|
||||||
if (!context.mounted) return;
|
bangumiIntroController.loadingState.listen((value) {
|
||||||
if (value is Success) {
|
if (!context.mounted) return;
|
||||||
videoPlayerServiceHandler.onVideoDetailChange(
|
if (value is Success) {
|
||||||
value.response,
|
videoPlayerServiceHandler.onVideoDetailChange(
|
||||||
videoDetailController.cid.value,
|
value.response,
|
||||||
);
|
videoDetailController.cid.value,
|
||||||
}
|
);
|
||||||
});
|
}
|
||||||
videoDetailController.cid.listen((p0) {
|
});
|
||||||
if (!context.mounted) return;
|
videoDetailController.cid.listen((p0) {
|
||||||
if (bangumiIntroController.loadingState.value is Success) {
|
if (!context.mounted) return;
|
||||||
videoPlayerServiceHandler.onVideoDetailChange(
|
if (bangumiIntroController.loadingState.value is Success) {
|
||||||
(bangumiIntroController.loadingState.value as Success).response,
|
videoPlayerServiceHandler.onVideoDetailChange(
|
||||||
p0,
|
(bangumiIntroController.loadingState.value as Success).response,
|
||||||
);
|
p0,
|
||||||
}
|
);
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
autoExitFullscreen =
|
autoExitFullscreen =
|
||||||
setting.get(SettingBoxKey.enableAutoExit, defaultValue: true);
|
setting.get(SettingBoxKey.enableAutoExit, defaultValue: true);
|
||||||
horizontalScreen =
|
horizontalScreen =
|
||||||
@@ -200,8 +202,8 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
plPlayerController!.playRepeat != PlayRepeat.singleCycle) {
|
plPlayerController!.playRepeat != PlayRepeat.singleCycle) {
|
||||||
if (videoDetailController.videoType == SearchType.video) {
|
if (videoDetailController.videoType == SearchType.video) {
|
||||||
notExitFlag = videoIntroController.nextPlay();
|
notExitFlag = videoIntroController.nextPlay();
|
||||||
}
|
} else if (videoDetailController.videoType ==
|
||||||
if (videoDetailController.videoType == SearchType.media_bangumi) {
|
SearchType.media_bangumi) {
|
||||||
notExitFlag = bangumiIntroController.nextPlay();
|
notExitFlag = bangumiIntroController.nextPlay();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1317,7 +1319,9 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
bvid: bvid,
|
bvid: bvid,
|
||||||
aid: aid,
|
aid: aid,
|
||||||
currentCid: cid,
|
currentCid: cid,
|
||||||
changeFucCall: videoIntroController.changeSeasonOrbangu,
|
changeFucCall: videoDetailController.videoType == SearchType.media_bangumi
|
||||||
|
? bangumiIntroController.changeSeasonOrbangu
|
||||||
|
: videoIntroController.changeSeasonOrbangu,
|
||||||
context: context,
|
context: context,
|
||||||
scaffoldState: isFullScreen
|
scaffoldState: isFullScreen
|
||||||
? videoDetailController.scaffoldKey.currentState
|
? videoDetailController.scaffoldKey.currentState
|
||||||
|
|||||||
Reference in New Issue
Block a user