mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-07-02 07:04:56 +08:00
parent
edc6edbfda
commit
3b99ddae26
@ -45,7 +45,8 @@ class VodEventTask extends Task
|
||||
protected function handleNewFileUploadEvent($event)
|
||||
{
|
||||
$fileId = $event['FileUploadEvent']['FileId'];
|
||||
$format = $event['FileUploadEvent']['MediaBasicInfo']['Type'];
|
||||
$width = $event['FileUploadEvent']['MetaData']['Height'];
|
||||
$height = $event['FileUploadEvent']['MetaData']['Width'];
|
||||
$duration = $event['FileUploadEvent']['MetaData']['Duration'];
|
||||
|
||||
$chapterRepo = new ChapterRepo();
|
||||
@ -56,7 +57,7 @@ class VodEventTask extends Task
|
||||
|
||||
$vodService = new VodService();
|
||||
|
||||
if ($this->isAudioFile($format)) {
|
||||
if ($width == 0 && $height == 0) {
|
||||
$vodService->createTransAudioTask($fileId);
|
||||
} else {
|
||||
$vodService->createTransVideoTask($fileId);
|
||||
@ -144,13 +145,6 @@ class VodEventTask extends Task
|
||||
return $vodService->confirmEvents($handles);
|
||||
}
|
||||
|
||||
protected function isAudioFile($format)
|
||||
{
|
||||
$formats = ['mp3', 'm4a', 'wav', 'flac', 'ogg'];
|
||||
|
||||
return in_array(strtolower($format), $formats);
|
||||
}
|
||||
|
||||
protected function updateVodAttrs(ChapterModel $chapter)
|
||||
{
|
||||
$courseStats = new CourseStatService();
|
||||
|
@ -81,10 +81,20 @@ class ChapterContent extends Service
|
||||
|
||||
$vod = $chapterRepo->findChapterVod($chapter->id);
|
||||
|
||||
/**
|
||||
* 无新文件上传
|
||||
*/
|
||||
if ($fileId == $vod->file_id) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除旧文件
|
||||
*/
|
||||
if ($vod->file_id) {
|
||||
$this->deleteVodFile($vod->file_id);
|
||||
}
|
||||
|
||||
$vod->update([
|
||||
'file_id' => $fileId,
|
||||
'file_transcode' => '',
|
||||
@ -102,10 +112,6 @@ class ChapterContent extends Service
|
||||
$chapter->update(['attrs' => $attrs]);
|
||||
|
||||
$this->updateCourseVodAttrs($vod->course_id);
|
||||
|
||||
if (!empty($vod->file_id)) {
|
||||
$this->deleteVodFile($vod->file_id);
|
||||
}
|
||||
}
|
||||
|
||||
protected function updateChapterLive(ChapterModel $chapter)
|
||||
|
@ -20,7 +20,7 @@ $scheduler->php($script, $bin, ['--task' => 'sync_learning', '--action' => 'main
|
||||
->at('*/7 * * * *');
|
||||
|
||||
$scheduler->php($script, $bin, ['--task' => 'vod_event', '--action' => 'main'])
|
||||
->at('*/9 * * * *');
|
||||
->at('*/5 * * * *');
|
||||
|
||||
$scheduler->php($script, $bin, ['--task' => 'close_trade', '--action' => 'main'])
|
||||
->at('*/13 * * * *');
|
||||
|
Loading…
x
Reference in New Issue
Block a user