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
$qiniu = \Yii::$app->qiniu;
$previewUrl = $qiniu->getUrl('public', $course->preview_pic);
$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
/**
* @var $class \common\models\Classes
* @var $course \common\models\Course
* @var $previewUrl string
* @var $sourceUrl string
* @var $avUrl string
*/
use yii\helpers\Html;
......@@ -11,4 +15,7 @@ $this->title = $course->name;
<p><?=$class->name?></p>
<div><img src="<?=$previewUrl?>-m.preview"></div>
<div><?=$course->intro?></div>
<p>[<a href="<?=$sourceUrl?>" target="_blank">下载源视频</a>]</p>
\ No newline at end of file
<p>
[<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
//FPS 对比
//Todo: 目前FPS的测算方法都不是很正确,不管是 r_frame_rate 还是 avg_frame_rate 多种情况下结果不正确,还需要继续研究
//因为预算不是很正确,所以在 FPS 在于目标值并超过 10 以上时才转换
$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'];
}
......@@ -191,7 +192,7 @@ class QiniuTranscode
$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;
}
......
......@@ -263,9 +263,7 @@ class MyCourseController extends \yii\web\Controller
}
//保存课程数据
if (!$course->update()) {
Utils::ajaxResponse(false, '课程保存失败');
}
$course->update();
//保存讲师与课程关联数据
CourseTeacher::autoSaveRelations($course->id, $form->teacher);
......@@ -304,7 +302,7 @@ class MyCourseController extends \yii\web\Controller
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;}');
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= \Yii::$app->language ?>">
<html lang="<?=\Yii::$app->language?>">
<head>
<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 http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title><?= $this->title ? Html::encode($this->title) . '-' : '' ?>云涯</title>
<?= Html::csrfMetaTags() ?>
<?php $this->head() ?>
<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 http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title><?=($this->title ? Html::encode($this->title) . '-' : '')?>云涯</title>
<link rel="shortcut icon" href="<?=AppAsset::getStaticUrl('img/favicon.ico')?>">
<?=Html::csrfMetaTags()?>
<?php $this->head() ?>
</head>
<body>
<?php $this->beginBody(); ?>
......@@ -122,4 +123,4 @@ $this->registerCss('[v-cloak] {display:none;}');
<?php $this->endBody(); ?>
</body>
</html>
<?php $this->endPage(); ?>
<?php $this->endPage(); ?>
\ No newline at end of file
......@@ -66,7 +66,8 @@ var vm = new Vue({
time: 2000,
icon: 1,
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']
});
......
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