Commit e0ec2da2 authored by xiabin's avatar xiabin

Merge remote-tracking branch 'origin/dev' into dev

parents 00d6c581 a9c57066
...@@ -77,8 +77,11 @@ class CourseController extends Controller ...@@ -77,8 +77,11 @@ class CourseController extends Controller
$qiniu = \Yii::$app->qiniu; $qiniu = \Yii::$app->qiniu;
$previewUrl = $qiniu->getUrl('public', $course->preview_pic); $previewUrl = $qiniu->getUrl('public', $course->preview_pic);
$sourceUrl = $qiniu->getUrl('video', $courseware->name); $sourceUrl = $qiniu->getUrl('video', $courseware->name);
$baseUrl = $qiniu->getStorageConfig('video', 'url').$courseware->name;
$avUrl = $qiniu->getAuthInstance()->privateDownloadUrl($baseUrl.'?avinfo');
return $this->render('detail', compact('course', 'courseware', 'class', 'previewUrl', 'sourceUrl')); return $this->render('detail', compact('course', 'courseware', 'class', 'previewUrl', 'sourceUrl', 'avUrl'));
} }
/** /**
......
<?php <?php
/** /**
* @var $class \common\models\Classes
* @var $course \common\models\Course * @var $course \common\models\Course
* @var $previewUrl string
* @var $sourceUrl string
* @var $avUrl string
*/ */
use yii\helpers\Html; use yii\helpers\Html;
...@@ -11,4 +15,7 @@ $this->title = $course->name; ...@@ -11,4 +15,7 @@ $this->title = $course->name;
<p><?=$class->name?></p> <p><?=$class->name?></p>
<div><img src="<?=$previewUrl?>-m.preview"></div> <div><img src="<?=$previewUrl?>-m.preview"></div>
<div><?=$course->intro?></div> <div><?=$course->intro?></div>
<p>[<a href="<?=$sourceUrl?>" target="_blank">下载源视频</a>]</p> <p>
\ No newline at end of file [<a href="<?=$sourceUrl?>" target="_blank">下载源视频</a>]
[<a href="<?=$avUrl?>" target="_blank">AVINFO</a>]
</p>
\ No newline at end of file
...@@ -145,8 +145,9 @@ class QiniuTranscode ...@@ -145,8 +145,9 @@ class QiniuTranscode
//FPS 对比 //FPS 对比
//Todo: 目前FPS的测算方法都不是很正确,不管是 r_frame_rate 还是 avg_frame_rate 多种情况下结果不正确,还需要继续研究 //Todo: 目前FPS的测算方法都不是很正确,不管是 r_frame_rate 还是 avg_frame_rate 多种情况下结果不正确,还需要继续研究
//因为预算不是很正确,所以在 FPS 在于目标值并超过 10 以上时才转换
$frate = explode('/', $video['avg_frame_rate']); $frate = explode('/', $video['avg_frame_rate']);
if ($frate[0] / $frate[1] > $target['fps']) { if ($frate[0] / $frate[1] > $target['fps'] + 10) {
$fopsMain .= '/r/'.$target['fps']; $fopsMain .= '/r/'.$target['fps'];
} }
...@@ -191,7 +192,7 @@ class QiniuTranscode ...@@ -191,7 +192,7 @@ class QiniuTranscode
$fops = ''; $fops = '';
//如果视频不是目标格式,或有必要参数,则进行转码 //如果视频不是目标格式,或有必要参数,则进行转码
if ($force || strpos($avInfo['format']['format_name'], self::TARGET_FORMAT) === false) { if ($force || $fopsMain || strpos($avInfo['format']['format_name'], self::TARGET_FORMAT) === false) {
$fops = 'avthumb/'.self::TARGET_FORMAT.$fopsMain.$fopsAddon; $fops = 'avthumb/'.self::TARGET_FORMAT.$fopsMain.$fopsAddon;
} }
......
...@@ -263,9 +263,7 @@ class MyCourseController extends \yii\web\Controller ...@@ -263,9 +263,7 @@ class MyCourseController extends \yii\web\Controller
} }
//保存课程数据 //保存课程数据
if (!$course->update()) { $course->update();
Utils::ajaxResponse(false, '课程保存失败');
}
//保存讲师与课程关联数据 //保存讲师与课程关联数据
CourseTeacher::autoSaveRelations($course->id, $form->teacher); CourseTeacher::autoSaveRelations($course->id, $form->teacher);
...@@ -304,7 +302,7 @@ class MyCourseController extends \yii\web\Controller ...@@ -304,7 +302,7 @@ class MyCourseController extends \yii\web\Controller
AttachUpload::claimTmpAttachs($form->tmp, 'course:'.$course->id); AttachUpload::claimTmpAttachs($form->tmp, 'course:'.$course->id);
Utils::ajaxResponse(true, null, ['course_id'=>$course->id]); Utils::ajaxResponse(true, null, ['course_id'=>$course->id, 'recheck'=>$recheck]);
} }
/** /**
......
...@@ -51,14 +51,15 @@ $this->registerCss('[v-cloak] {display:none;}'); ...@@ -51,14 +51,15 @@ $this->registerCss('[v-cloak] {display:none;}');
?> ?>
<?php $this->beginPage() ?> <?php $this->beginPage() ?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="<?= \Yii::$app->language ?>"> <html lang="<?=\Yii::$app->language?>">
<head> <head>
<meta charset="<?= Yii::$app->charset ?>"> <meta charset="<?=Yii::$app->charset?>">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" > <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title><?= $this->title ? Html::encode($this->title) . '-' : '' ?>云涯</title> <title><?=($this->title ? Html::encode($this->title) . '-' : '')?>云涯</title>
<?= Html::csrfMetaTags() ?> <link rel="shortcut icon" href="<?=AppAsset::getStaticUrl('img/favicon.ico')?>">
<?php $this->head() ?> <?=Html::csrfMetaTags()?>
<?php $this->head() ?>
</head> </head>
<body> <body>
<?php $this->beginBody(); ?> <?php $this->beginBody(); ?>
...@@ -122,4 +123,4 @@ $this->registerCss('[v-cloak] {display:none;}'); ...@@ -122,4 +123,4 @@ $this->registerCss('[v-cloak] {display:none;}');
<?php $this->endBody(); ?> <?php $this->endBody(); ?>
</body> </body>
</html> </html>
<?php $this->endPage(); ?> <?php $this->endPage(); ?>
\ No newline at end of file
...@@ -66,7 +66,8 @@ var vm = new Vue({ ...@@ -66,7 +66,8 @@ var vm = new Vue({
time: 2000, time: 2000,
icon: 1, icon: 1,
end: function() { end: function() {
location.href = "/my-course/"; location.href = t.data.recheck ? "/my-course/result?id="+t.data.course_id+"&action=edit"
: "/my-course/";
}, },
shade:[0.2,'#000'] shade:[0.2,'#000']
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment