fix: bangumi heartbeat

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-01-01 20:01:17 +08:00
parent 1026fc79e1
commit d30dd96bbd
6 changed files with 49 additions and 9 deletions

View File

@@ -739,18 +739,23 @@ class VideoHttp {
}
// 视频播放进度
static Future heartBeat({bvid, cid, progress, realtime}) async {
static Future heartBeat({
bvid,
cid,
progress,
epid,
seasonId,
subType,
}) async {
await Request().post(Api.heartBeat, queryParameters: {
// 'aid': aid,
'bvid': bvid,
'cid': cid,
// 'epid': '',
// 'sid': '',
// 'mid': '',
if (epid != null) 'epid': epid,
if (seasonId != null) 'sid': seasonId,
if (epid != null) 'type': 4,
if (subType != null) 'sub_type': subType,
'played_time': progress,
// 'realtime': realtime,
// 'type': '',
// 'sub_type': '',
'csrf': await Request.getCsrf(),
});
}

View File

@@ -373,7 +373,8 @@ class BangumiIntroController extends CommonController {
Future changeSeasonOrbangu(epId, bvid, cid, aid, cover) async {
// 重新获取视频资源
VideoDetailController videoDetailCtr =
Get.find<VideoDetailController>(tag: Get.arguments['heroTag']);
Get.find<VideoDetailController>(tag: Get.arguments['heroTag'])
..epId = epId;
this.epId = epId;
this.bvid = bvid;
videoDetailCtr.bvid = bvid;

View File

@@ -255,6 +255,10 @@ class VideoDetailController extends GetxController
_ => -1,
};
late dynamic epId = Get.parameters['epId'];
late dynamic seasonId = Get.parameters['seasonId'];
late dynamic subType = Get.parameters['type'];
@override
void onInit() {
super.onInit();
@@ -1042,6 +1046,9 @@ class VideoDetailController extends GetxController
cid: cid.value,
enableHeart: enableHeart,
autoplay: autoplay ?? autoPlay.value,
epid: videoType == SearchType.media_bangumi ? epId : null,
seasonId: videoType == SearchType.media_bangumi ? seasonId : null,
subType: videoType == SearchType.media_bangumi ? subType : null,
);
_initSkip();

View File

@@ -328,6 +328,15 @@ class _VideoDetailPageState extends State<VideoDetailPage>
isManual: true,
bvid: videoDetailController.bvid,
cid: videoDetailController.cid.value,
epid: videoDetailController.videoType == SearchType.media_bangumi
? videoDetailController.epId
: null,
seasonId: videoDetailController.videoType == SearchType.media_bangumi
? videoDetailController.seasonId
: null,
subType: videoDetailController.videoType == SearchType.media_bangumi
? videoDetailController.subType
: null,
);
}

View File

@@ -92,6 +92,9 @@ class PlPlayerController {
// 记录历史记录
String _bvid = '';
int _cid = 0;
dynamic _epid;
dynamic _seasonId;
dynamic _subType;
int _heartDuration = 0;
bool _enableHeart = true;
@@ -458,6 +461,9 @@ class PlPlayerController {
int cid = 0,
// 历史记录开关
bool enableHeart = true,
dynamic epid,
dynamic seasonId,
dynamic subType,
}) async {
try {
this.dataSource = dataSource;
@@ -476,6 +482,9 @@ class PlPlayerController {
_direction.value = direction ?? 'horizontal';
_bvid = bvid;
_cid = cid;
_epid = epid;
_seasonId = seasonId;
_subType = subType;
_enableHeart = enableHeart;
if (_videoPlayerController != null &&
@@ -1267,6 +1276,9 @@ class PlPlayerController {
bool isManual = false,
dynamic bvid,
dynamic cid,
dynamic epid,
dynamic seasonId,
dynamic subType,
}) async {
if (!_enableHeart || MineController.anonymity.value || progress == 0) {
return;
@@ -1287,6 +1299,9 @@ class PlPlayerController {
bvid: bvid ?? _bvid,
cid: cid ?? _cid,
progress: isComplete ? -1 : progress,
epid: epid ?? _epid,
seasonId: seasonId ?? _seasonId,
subType: subType ?? _subType,
);
return;
}
@@ -1297,6 +1312,9 @@ class PlPlayerController {
bvid: bvid ?? _bvid,
cid: cid ?? _cid,
progress: progress,
epid: epid ?? _epid,
seasonId: seasonId ?? _seasonId,
subType: subType ?? _subType,
);
}
}

View File

@@ -410,7 +410,7 @@ class Utils {
dynamic pic = episode?.cover;
dynamic heroTag = Utils.makeHeroTag(cid);
Utils.toDupNamed(
'/video?bvid=$bvid&cid=$cid&seasonId=${result['data'].seasonId}&epId=${episode?.epId}',
'/video?bvid=$bvid&cid=$cid&seasonId=${result['data'].seasonId}&epId=${episode?.epId}&type=${result['data'].type}',
arguments: {
'pic': pic,
'heroTag': heroTag,