check cid

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-06-07 15:18:55 +08:00
parent e3c920dc87
commit bffcfd1f90
3 changed files with 22 additions and 21 deletions

View File

@@ -41,17 +41,17 @@ class VideoCardV extends StatelessWidget {
break;
case 'av':
String bvid = videoItem.bvid ?? IdUtils.av2bv(videoItem.aid!);
int? cid = videoItem.cid;
if (cid == null || cid == 0 || cid == -1) {
cid = await SearchHttp.ab2c(aid: videoItem.aid, bvid: bvid);
int? cid = videoItem.cid ??
await SearchHttp.ab2c(aid: videoItem.aid, bvid: bvid);
if (cid != null) {
PageUtils.toVideoPage(
'bvid=$bvid&cid=$cid',
arguments: {
'pic': videoItem.cover,
'heroTag': heroTag,
},
);
}
PageUtils.toVideoPage(
'bvid=$bvid&cid=$cid',
arguments: {
'pic': videoItem.cover,
'heroTag': heroTag,
},
);
break;
// 动态
case 'picture':

View File

@@ -4,17 +4,16 @@ import 'package:PiliPlus/utils/id_utils.dart';
import 'package:PiliPlus/utils/utils.dart';
class RecVideoItemAppModel extends BaseRecVideoItemModel {
int? id;
int? get id => aid;
String? talkBack;
String? cardType;
ThreePoint? threePoint;
RecVideoItemAppModel.fromJson(Map<String, dynamic> json) {
id = json['player_args']?['aid'] ?? int.tryParse(json['param'] ?? '0');
aid = id;
aid = json['player_args']?['aid'] ?? int.tryParse(json['param'] ?? '0');
bvid = json['bvid'] ?? IdUtils.av2bv(id!);
cid = json['player_args']?['cid'] ?? 0;
cid = json['player_args']?['cid'];
cover = json['cover'];
stat = RcmdStat.fromJson(json);
// 改用player_args中的duration作为原始数据秒数

View File

@@ -43,13 +43,15 @@ class VideoCardVMemberHome extends StatelessWidget {
bvid ??= IdUtils.av2bv(int.parse(aid!));
int? cid = videoItem.cid ?? await SearchHttp.ab2c(aid: aid, bvid: bvid);
PageUtils.toVideoPage(
'bvid=$bvid&cid=$cid',
arguments: {
'pic': videoItem.cover,
'heroTag': heroTag,
},
);
if (cid != null) {
PageUtils.toVideoPage(
'bvid=$bvid&cid=$cid',
arguments: {
'pic': videoItem.cover,
'heroTag': heroTag,
},
);
}
break;
default: