mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-24 20:06:09 +08:00
增加获取视频时长补充机制
This commit is contained in:
parent
a06edb6f4b
commit
23305e1738
@ -1,3 +1,7 @@
|
||||
### [v1.5.4](https://gitee.com/koogua/course-tencent-cloud/releases/v1.5.4)(2022-06-30)
|
||||
|
||||
- 优化章节排序初始值和步长
|
||||
|
||||
### [v1.5.3](https://gitee.com/koogua/course-tencent-cloud/releases/v1.5.3)(2022-05-30)
|
||||
|
||||
- 优化章节排序初始值和步长
|
||||
|
@ -56,6 +56,13 @@ class VodEventTask extends Task
|
||||
|
||||
$attrs = $chapter->attrs;
|
||||
|
||||
/**
|
||||
* 获取不到时长,尝试通过接口获得
|
||||
*/
|
||||
if ($duration == 0) {
|
||||
$duration = $this->getFileDuration($fileId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取不到时长视为失败
|
||||
*/
|
||||
@ -78,7 +85,7 @@ class VodEventTask extends Task
|
||||
|
||||
$chapter->update(['attrs' => $attrs]);
|
||||
|
||||
$this->updateVodAttrs($chapter);
|
||||
$this->updateCourseVodAttrs($chapter->course_id);
|
||||
}
|
||||
|
||||
protected function handleProcedureStateChangedEvent($event)
|
||||
@ -95,6 +102,13 @@ class VodEventTask extends Task
|
||||
|
||||
$attrs = $chapter->attrs;
|
||||
|
||||
/**
|
||||
* 获取不到时长,尝试通过接口获得
|
||||
*/
|
||||
if ($attrs['duration'] == 0) {
|
||||
$attrs['duration'] = $this->getFileDuration($fileId);
|
||||
}
|
||||
|
||||
$processResult = $event['ProcedureStateChangeEvent']['MediaProcessResultSet'] ?? [];
|
||||
|
||||
/**
|
||||
@ -156,11 +170,20 @@ class VodEventTask extends Task
|
||||
return $vodService->confirmEvents($handles);
|
||||
}
|
||||
|
||||
protected function updateVodAttrs(ChapterModel $chapter)
|
||||
protected function updateCourseVodAttrs($courseId)
|
||||
{
|
||||
$courseStats = new CourseStatService();
|
||||
|
||||
$courseStats->updateVodAttrs($chapter->course_id);
|
||||
$courseStats->updateVodAttrs($courseId);
|
||||
}
|
||||
|
||||
protected function getFileDuration($fileId)
|
||||
{
|
||||
$service = new VodService();
|
||||
|
||||
$metaInfo = $service->getOriginVideoInfo($fileId);
|
||||
|
||||
return $metaInfo['duration'] ?? 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ class AppInfo
|
||||
|
||||
protected $link = 'https://koogua.com';
|
||||
|
||||
protected $version = '1.5.2';
|
||||
protected $version = '1.5.4';
|
||||
|
||||
public function __get($name)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user