mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-26 20:52:44 +08:00
Merge branch 'master' of https://gitee.com/koogua/course-tencent-cloud into develop
This commit is contained in:
commit
435653cee2
@ -45,7 +45,8 @@ class VodEventTask extends Task
|
|||||||
protected function handleNewFileUploadEvent($event)
|
protected function handleNewFileUploadEvent($event)
|
||||||
{
|
{
|
||||||
$fileId = $event['FileUploadEvent']['FileId'];
|
$fileId = $event['FileUploadEvent']['FileId'];
|
||||||
$format = $event['FileUploadEvent']['MediaBasicInfo']['Type'];
|
$width = $event['FileUploadEvent']['MetaData']['Height'];
|
||||||
|
$height = $event['FileUploadEvent']['MetaData']['Width'];
|
||||||
$duration = $event['FileUploadEvent']['MetaData']['Duration'];
|
$duration = $event['FileUploadEvent']['MetaData']['Duration'];
|
||||||
|
|
||||||
$chapterRepo = new ChapterRepo();
|
$chapterRepo = new ChapterRepo();
|
||||||
@ -56,7 +57,7 @@ class VodEventTask extends Task
|
|||||||
|
|
||||||
$vodService = new VodService();
|
$vodService = new VodService();
|
||||||
|
|
||||||
if ($this->isAudioFile($format)) {
|
if ($width == 0 && $height == 0) {
|
||||||
$vodService->createTransAudioTask($fileId);
|
$vodService->createTransAudioTask($fileId);
|
||||||
} else {
|
} else {
|
||||||
$vodService->createTransVideoTask($fileId);
|
$vodService->createTransVideoTask($fileId);
|
||||||
@ -144,13 +145,6 @@ class VodEventTask extends Task
|
|||||||
return $vodService->confirmEvents($handles);
|
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)
|
protected function updateVodAttrs(ChapterModel $chapter)
|
||||||
{
|
{
|
||||||
$courseStats = new CourseStatService();
|
$courseStats = new CourseStatService();
|
||||||
|
@ -78,6 +78,7 @@ class Chapter extends Service
|
|||||||
$data['parent_id'] = $parent->id;
|
$data['parent_id'] = $parent->id;
|
||||||
$data['free'] = $validator->checkFreeStatus($post['free']);
|
$data['free'] = $validator->checkFreeStatus($post['free']);
|
||||||
$data['priority'] = $chapterRepo->maxLessonPriority($post['parent_id']);
|
$data['priority'] = $chapterRepo->maxLessonPriority($post['parent_id']);
|
||||||
|
$parentId = $parent->id;
|
||||||
} else {
|
} else {
|
||||||
$data['priority'] = $chapterRepo->maxChapterPriority($post['course_id']);
|
$data['priority'] = $chapterRepo->maxChapterPriority($post['course_id']);
|
||||||
$data['parent_id'] = $parentId;
|
$data['parent_id'] = $parentId;
|
||||||
@ -120,7 +121,7 @@ class Chapter extends Service
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($attrs === false) {
|
if ($attrs === false) {
|
||||||
throw new \RuntimeException("Create Chapter {$course->model} Attrs Failed");
|
throw new \RuntimeException("Create Chapter Related Attrs Failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,10 +81,20 @@ class ChapterContent extends Service
|
|||||||
|
|
||||||
$vod = $chapterRepo->findChapterVod($chapter->id);
|
$vod = $chapterRepo->findChapterVod($chapter->id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 无新文件上传
|
||||||
|
*/
|
||||||
if ($fileId == $vod->file_id) {
|
if ($fileId == $vod->file_id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除旧文件
|
||||||
|
*/
|
||||||
|
if ($vod->file_id) {
|
||||||
|
$this->deleteVodFile($vod->file_id);
|
||||||
|
}
|
||||||
|
|
||||||
$vod->update([
|
$vod->update([
|
||||||
'file_id' => $fileId,
|
'file_id' => $fileId,
|
||||||
'file_transcode' => '',
|
'file_transcode' => '',
|
||||||
@ -102,10 +112,6 @@ class ChapterContent extends Service
|
|||||||
$chapter->update(['attrs' => $attrs]);
|
$chapter->update(['attrs' => $attrs]);
|
||||||
|
|
||||||
$this->updateCourseVodAttrs($vod->course_id);
|
$this->updateCourseVodAttrs($vod->course_id);
|
||||||
|
|
||||||
if (!empty($vod->file_id)) {
|
|
||||||
$this->deleteVodFile($vod->file_id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function updateChapterLive(ChapterModel $chapter)
|
protected function updateChapterLive(ChapterModel $chapter)
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
<span class="layui-badge layui-bg-blue">直播</span>
|
<span class="layui-badge layui-bg-blue">直播</span>
|
||||||
{% elseif value == 3 %}
|
{% elseif value == 3 %}
|
||||||
<span class="layui-badge layui-bg-black">专栏</span>
|
<span class="layui-badge layui-bg-black">专栏</span>
|
||||||
|
{% else %}
|
||||||
|
<span class="layui-badge layui-bg-gray">未知</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{%- endmacro %}
|
{%- endmacro %}
|
||||||
|
|
||||||
@ -22,19 +24,21 @@
|
|||||||
中级
|
中级
|
||||||
{% elseif value == 4 %}
|
{% elseif value == 4 %}
|
||||||
高级
|
高级
|
||||||
|
{% else %}
|
||||||
|
未知
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</span>
|
</span>
|
||||||
{%- endmacro %}
|
{%- endmacro %}
|
||||||
|
|
||||||
{%- macro category_info(category) %}
|
{%- macro category_info(category) %}
|
||||||
{% if category %}
|
{% if category.id is defined %}
|
||||||
{% set url = url({'for':'admin.course.list'},{'category_id':category.id}) %}
|
{% set url = url({'for':'admin.course.list'},{'category_id':category.id}) %}
|
||||||
分类:<a class="layui-badge layui-bg-gray" href="{{ url }}">{{ category.name }}</a>
|
分类:<a class="layui-badge layui-bg-gray" href="{{ url }}">{{ category.name }}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{%- endmacro %}
|
{%- endmacro %}
|
||||||
|
|
||||||
{%- macro teacher_info(teacher) %}
|
{%- macro teacher_info(teacher) %}
|
||||||
{% if teacher %}
|
{% if teacher.id is defined %}
|
||||||
{% set url = url({'for':'admin.course.list'},{'teacher_id':teacher.id}) %}
|
{% set url = url({'for':'admin.course.list'},{'teacher_id':teacher.id}) %}
|
||||||
讲师:<a class="layui-badge layui-bg-gray" href="{{ url }}">{{ teacher.name }}</a>
|
讲师:<a class="layui-badge layui-bg-gray" href="{{ url }}">{{ teacher.name }}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -9,11 +9,13 @@
|
|||||||
<span class="layui-badge layui-bg-blue">聊</span>
|
<span class="layui-badge layui-bg-blue">聊</span>
|
||||||
{% elseif value == 3 %}
|
{% elseif value == 3 %}
|
||||||
<span class="layui-badge layui-bg-cyan">职</span>
|
<span class="layui-badge layui-bg-cyan">职</span>
|
||||||
|
{% else %}
|
||||||
|
<span class="layui-badge layui-bg-gray">未知</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{%- endmacro %}
|
{%- endmacro %}
|
||||||
|
|
||||||
{%- macro owner_info(owner) %}
|
{%- macro owner_info(owner) %}
|
||||||
{% if owner %}
|
{% if owner.id is defined %}
|
||||||
{{ owner.name }}({{ owner.id }})
|
{{ owner.name }}({{ owner.id }})
|
||||||
{% else %}
|
{% else %}
|
||||||
未设置
|
未设置
|
||||||
|
@ -20,7 +20,7 @@ $scheduler->php($script, $bin, ['--task' => 'sync_learning', '--action' => 'main
|
|||||||
->at('*/7 * * * *');
|
->at('*/7 * * * *');
|
||||||
|
|
||||||
$scheduler->php($script, $bin, ['--task' => 'vod_event', '--action' => 'main'])
|
$scheduler->php($script, $bin, ['--task' => 'vod_event', '--action' => 'main'])
|
||||||
->at('*/9 * * * *');
|
->at('*/5 * * * *');
|
||||||
|
|
||||||
$scheduler->php($script, $bin, ['--task' => 'close_trade', '--action' => 'main'])
|
$scheduler->php($script, $bin, ['--task' => 'close_trade', '--action' => 'main'])
|
||||||
->at('*/13 * * * *');
|
->at('*/13 * * * *');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user