mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-07-16 14:20:13 +08:00
@@ -1160,11 +1160,11 @@ class VideoDetailController extends GetxController
|
||||
seasonId: isUgc ? null : seasonId,
|
||||
pgcType: isUgc ? null : pgcType,
|
||||
videoType: videoType,
|
||||
onInit: () async {
|
||||
onInit: () {
|
||||
if (videoState.value is! Success) {
|
||||
videoState.value = const Success(null);
|
||||
}
|
||||
await setSubtitle(vttSubtitlesIndex.value);
|
||||
setSubtitle(vttSubtitlesIndex.value);
|
||||
},
|
||||
width: firstVideo.width,
|
||||
height: firstVideo.height,
|
||||
@@ -1243,8 +1243,8 @@ class VideoDetailController extends GetxController
|
||||
language: currLang.value,
|
||||
);
|
||||
|
||||
if (result.isSuccess) {
|
||||
data = result.data;
|
||||
if (result case Success(:final response)) {
|
||||
data = response;
|
||||
|
||||
languages.value = data.language?.items;
|
||||
currLang.value = data.curLanguage;
|
||||
@@ -1979,9 +1979,8 @@ class VideoDetailController extends GetxController
|
||||
qn: currentVideoQa.value?.code,
|
||||
);
|
||||
SmartDialog.dismiss();
|
||||
if (res.isSuccess) {
|
||||
final data = res.data;
|
||||
final first = data.durl?.firstOrNull;
|
||||
if (res case Success(:final response)) {
|
||||
final first = response.durl?.firstOrNull;
|
||||
if (first == null || first.playUrls.isEmpty) {
|
||||
SmartDialog.showToast('不支持投屏');
|
||||
return;
|
||||
|
||||
@@ -13,7 +13,6 @@ import 'package:PiliPlus/http/video.dart';
|
||||
import 'package:PiliPlus/models/common/video/source_type.dart';
|
||||
import 'package:PiliPlus/models_new/member_card_info/data.dart';
|
||||
import 'package:PiliPlus/models_new/video/video_ai_conclusion/model_result.dart';
|
||||
import 'package:PiliPlus/models_new/video/video_detail/data.dart';
|
||||
import 'package:PiliPlus/models_new/video/video_detail/episode.dart';
|
||||
import 'package:PiliPlus/models_new/video/video_detail/page.dart';
|
||||
import 'package:PiliPlus/models_new/video/video_detail/section.dart';
|
||||
@@ -29,7 +28,6 @@ import 'package:PiliPlus/plugin/pl_player/models/play_repeat.dart';
|
||||
import 'package:PiliPlus/services/service_locator.dart';
|
||||
import 'package:PiliPlus/utils/accounts.dart';
|
||||
import 'package:PiliPlus/utils/extension/context_ext.dart';
|
||||
import 'package:PiliPlus/utils/extension/iterable_ext.dart';
|
||||
import 'package:PiliPlus/utils/extension/string_ext.dart';
|
||||
import 'package:PiliPlus/utils/feed_back.dart';
|
||||
import 'package:PiliPlus/utils/global_data.dart';
|
||||
@@ -90,30 +88,33 @@ class UgcIntroController extends CommonIntroController with ReloadMixin {
|
||||
Future<void> queryVideoIntro() async {
|
||||
queryVideoTags();
|
||||
final res = await VideoHttp.videoIntro(bvid: bvid);
|
||||
if (res.isSuccess) {
|
||||
VideoDetailData data = res.data;
|
||||
videoPlayerServiceHandler?.onVideoDetailChange(data, cid.value, heroTag);
|
||||
if (videoDetail.value.ugcSeason?.id == data.ugcSeason?.id) {
|
||||
if (res case Success(:final response)) {
|
||||
videoPlayerServiceHandler?.onVideoDetailChange(
|
||||
response,
|
||||
cid.value,
|
||||
heroTag,
|
||||
);
|
||||
if (videoDetail.value.ugcSeason?.id == response.ugcSeason?.id) {
|
||||
// keep reversed season
|
||||
data.ugcSeason = videoDetail.value.ugcSeason;
|
||||
response.ugcSeason = videoDetail.value.ugcSeason;
|
||||
}
|
||||
if (videoDetail.value.cid == data.cid) {
|
||||
if (videoDetail.value.cid == response.cid) {
|
||||
// keep reversed pages
|
||||
data
|
||||
response
|
||||
..pages = videoDetail.value.pages
|
||||
..isPageReversed = videoDetail.value.isPageReversed;
|
||||
}
|
||||
videoDetail.value = data;
|
||||
videoDetail.value = response;
|
||||
try {
|
||||
if (videoDetailCtr.cover.value.isEmpty ||
|
||||
(videoDetailCtr.videoUrl.isNullOrEmpty &&
|
||||
!videoDetailCtr.isQuerying)) {
|
||||
videoDetailCtr.cover.value = data.pic ?? '';
|
||||
videoDetailCtr.cover.value = response.pic ?? '';
|
||||
}
|
||||
if (videoDetailCtr.showReply) {
|
||||
try {
|
||||
Get.find<VideoReplyController>(tag: heroTag).count.value =
|
||||
data.stat?.reply ?? 0;
|
||||
response.stat?.reply ?? 0;
|
||||
} catch (_) {}
|
||||
}
|
||||
} catch (_) {}
|
||||
@@ -121,7 +122,7 @@ class UgcIntroController extends CommonIntroController with ReloadMixin {
|
||||
if (pages != null && pages.isNotEmpty && cid.value == 0) {
|
||||
cid.value = pages.first.cid!;
|
||||
}
|
||||
queryUserStat(data.staff);
|
||||
queryUserStat(response.staff);
|
||||
} else {
|
||||
res.toast();
|
||||
status.value = false;
|
||||
@@ -136,27 +137,21 @@ class UgcIntroController extends CommonIntroController with ReloadMixin {
|
||||
// 获取up主粉丝数
|
||||
Future<void> queryUserStat(List<Staff>? staff) async {
|
||||
if (staff != null && staff.isNotEmpty) {
|
||||
Request()
|
||||
.get(
|
||||
Api.relations,
|
||||
queryParameters: {'fids': staff.map((item) => item.mid).join(',')},
|
||||
)
|
||||
.then((res) {
|
||||
if (res.data['code'] == 0) {
|
||||
staffRelations.addAll({
|
||||
'status': true,
|
||||
if (res.data['data'] != null) ...res.data['data'],
|
||||
});
|
||||
}
|
||||
});
|
||||
final res = await Request().get(
|
||||
Api.relations,
|
||||
queryParameters: {'fids': staff.map((item) => item.mid).join(',')},
|
||||
);
|
||||
if (res.data['code'] == 0) {
|
||||
staffRelations.addAll({'status': true, ...?res.data['data']});
|
||||
}
|
||||
} else {
|
||||
final mid = videoDetail.value.owner?.mid;
|
||||
if (mid == null) {
|
||||
return;
|
||||
}
|
||||
final result = await MemberHttp.memberCardInfo(mid: mid);
|
||||
if (result.isSuccess) {
|
||||
userStat.value = result.data;
|
||||
final res = await MemberHttp.memberCardInfo(mid: mid);
|
||||
if (res case Success(:final response)) {
|
||||
userStat.value = response;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -247,11 +242,11 @@ class UgcIntroController extends CommonIntroController with ReloadMixin {
|
||||
SmartDialog.showToast('账号未登录');
|
||||
return;
|
||||
}
|
||||
final result = await VideoHttp.dislikeVideo(
|
||||
final res = await VideoHttp.dislikeVideo(
|
||||
bvid: bvid,
|
||||
type: !hasDislike.value,
|
||||
);
|
||||
if (result.isSuccess) {
|
||||
if (res.isSuccess) {
|
||||
if (!hasDislike.value) {
|
||||
SmartDialog.showToast('点踩成功');
|
||||
hasDislike.value = true;
|
||||
@@ -264,7 +259,7 @@ class UgcIntroController extends CommonIntroController with ReloadMixin {
|
||||
hasDislike.value = false;
|
||||
}
|
||||
} else {
|
||||
result.toast();
|
||||
res.toast();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -727,25 +722,24 @@ class UgcIntroController extends CommonIntroController with ReloadMixin {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (relatedCtr.loadingState.value is! Success) {
|
||||
return false;
|
||||
if (relatedCtr.loadingState.value case Success(:final response)) {
|
||||
final firstItem = response?.firstOrNull;
|
||||
if (firstItem == null) {
|
||||
SmartDialog.showToast('暂无相关视频,停止连播');
|
||||
return false;
|
||||
}
|
||||
onChangeEpisode(
|
||||
BaseEpisodeItem(
|
||||
aid: firstItem.aid,
|
||||
bvid: firstItem.bvid,
|
||||
cid: firstItem.cid,
|
||||
cover: firstItem.cover,
|
||||
),
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (relatedCtr.loadingState.value.data.isNullOrEmpty) {
|
||||
SmartDialog.showToast('暂无相关视频,停止连播');
|
||||
return false;
|
||||
}
|
||||
|
||||
final firstItem = relatedCtr.loadingState.value.data!.first;
|
||||
onChangeEpisode(
|
||||
BaseEpisodeItem(
|
||||
aid: firstItem.aid,
|
||||
bvid: firstItem.bvid,
|
||||
cid: firstItem.cid,
|
||||
cover: firstItem.cover,
|
||||
),
|
||||
);
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ai总结
|
||||
|
||||
@@ -63,12 +63,14 @@ class HorizontalMemberPageController
|
||||
hasNext = data.hasNext ?? false;
|
||||
}
|
||||
}
|
||||
if (isLoadPrevious && loadingState.value.isSuccess) {
|
||||
data.item ??= <SpaceArchiveItem>[];
|
||||
data.item!.addAll(loadingState.value.data!);
|
||||
} else if (!isRefresh && loadingState.value.isSuccess) {
|
||||
data.item ??= <SpaceArchiveItem>[];
|
||||
data.item!.insertAll(0, loadingState.value.data!);
|
||||
if (isLoadPrevious) {
|
||||
if (loadingState.value case Success(:final response)) {
|
||||
(data.item ??= <SpaceArchiveItem>[]).addAll(response!);
|
||||
}
|
||||
} else if (!isRefresh) {
|
||||
if (loadingState.value case Success(:final response)) {
|
||||
(data.item ??= <SpaceArchiveItem>[]).insertAll(0, response!);
|
||||
}
|
||||
}
|
||||
firstAid = data.item?.firstOrNull?.param;
|
||||
lastAid = data.item?.lastOrNull?.param;
|
||||
|
||||
@@ -921,17 +921,17 @@ class ReplyItemGrpc extends StatelessWidget {
|
||||
return;
|
||||
}
|
||||
SmartDialog.showLoading(msg: '删除中...');
|
||||
final result = await VideoHttp.replyDel(
|
||||
final res = await VideoHttp.replyDel(
|
||||
type: item.type.toInt(),
|
||||
oid: item.oid.toInt(),
|
||||
rpid: item.id.toInt(),
|
||||
);
|
||||
SmartDialog.dismiss();
|
||||
if (result.isSuccess) {
|
||||
if (res.isSuccess) {
|
||||
SmartDialog.showToast('删除成功');
|
||||
onDelete();
|
||||
} else {
|
||||
SmartDialog.showToast('删除失败, $result');
|
||||
SmartDialog.showToast('删除失败, $res');
|
||||
}
|
||||
},
|
||||
minLeadingWidth: 0,
|
||||
|
||||
@@ -208,12 +208,15 @@ class HeaderControl extends StatefulWidget {
|
||||
return true;
|
||||
} else {
|
||||
res.toast();
|
||||
if ((res as Error).code == 65006) {
|
||||
extra.isLike = true;
|
||||
return true;
|
||||
} else if (res.code == 65004) {
|
||||
extra.isLike = false;
|
||||
return true;
|
||||
if (res case Error(:final code)) {
|
||||
if (code == 65006) {
|
||||
extra.isLike = true;
|
||||
return true;
|
||||
}
|
||||
if (code == 65004) {
|
||||
extra.isLike = false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user