Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zuiketang
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
zuiketang
Commits
8762a5aa
Commit
8762a5aa
authored
Oct 27, 2016
by
汪波
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
7bab12ea
d00b25bc
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
216 additions
and
25 deletions
+216
-25
QiniuTranscode.php
src/common/libs/QiniuTranscode.php
+8
-1
Teacher.php
src/common/models/Teacher.php
+28
-0
TestController.php
src/console/controllers/TestController.php
+34
-0
ClassesFilter.php
src/frontend/components/ClassesFilter.php
+7
-1
MobileFilter.php
src/frontend/components/MobileFilter.php
+33
-0
MyCourseController.php
src/frontend/controllers/MyCourseController.php
+6
-2
TeacherManagerController.php
src/frontend/controllers/TeacherManagerController.php
+26
-1
index.php
src/frontend/views/teacher-manager/index.php
+6
-2
video-play.vue
src/frontend/web/js/home/components/video-play.vue
+34
-16
video.vue
src/frontend/web/js/home/components/video.vue
+2
-2
index.js
src/frontend/web/js/teacher-manager/index.js
+31
-0
webpack.config.js
src/frontend/web/webpack.config.js
+1
-0
No files found.
src/common/libs/QiniuTranscode.php
View file @
8762a5aa
...
@@ -150,8 +150,15 @@ class QiniuTranscode
...
@@ -150,8 +150,15 @@ class QiniuTranscode
$fopsMain
.=
'/r/'
.
$target
[
'fps'
];
$fopsMain
.=
'/r/'
.
$target
[
'fps'
];
}
}
//print_r($avInfo);
//opcache_invalidate(__FILE__);
//exit;
//视频采样率对比,七牛文档指出如果给出的码率大于原码率,则会使用原码率转换,但某些视频仍然会出现码率变大,所以此处加上判断
//视频采样率对比,七牛文档指出如果给出的码率大于原码率,则会使用原码率转换,但某些视频仍然会出现码率变大,所以此处加上判断
$fopsAddon
.=
'/vb/'
.
(
$video
[
'bit_rate'
]
>
$target
[
'vb'
]
?
$target
[
'vb'
]
:
$video
[
'bit_rate'
]);
$bitRate
=
isset
(
$video
[
'bit_rate'
])
?
$video
[
'bit_rate'
]
:
(
isset
(
$avInfo
[
'format'
][
'bit_rate'
])
?
$avInfo
[
'format'
][
'bit_rate'
]
:
0
);
if
(
$bitRate
)
{
$fopsAddon
.=
'/vb/'
.
(
$bitRate
>
$target
[
'vb'
]
?
$target
[
'vb'
]
:
$bitRate
);
}
//编码对比
//编码对比
if
(
$video
[
'codec_name'
]
!=
'h264'
)
{
if
(
$video
[
'codec_name'
]
!=
'h264'
)
{
...
...
src/common/models/Teacher.php
View file @
8762a5aa
...
@@ -85,6 +85,20 @@ class Teacher extends ActiveRecord
...
@@ -85,6 +85,20 @@ class Teacher extends ActiveRecord
];
];
}
}
/**
* 删除当前讲师所有数据
*/
public
function
deleteMe
()
{
//删除头像
if
(
$this
->
avatar
)
{
UploadPools
::
deleteFile
(
'public:'
.
$this
->
avatar
);
}
CourseTeacher
::
deleteAll
([
'teacher_id'
=>
$this
->
id
]);
self
::
deleteAll
([
'id'
=>
$this
->
id
]);
}
/**
/**
* 获取指定课堂下所有讲师的简单列表
* 获取指定课堂下所有讲师的简单列表
*
*
...
@@ -149,4 +163,18 @@ class Teacher extends ActiveRecord
...
@@ -149,4 +163,18 @@ class Teacher extends ActiveRecord
return
$data
;
return
$data
;
}
}
/**
* 删除指定讲师所有数据
*
* @param int $teacherId
*/
public
static
function
deleteTeacher
(
$teacherId
)
{
$teacher
=
self
::
findOne
([
'id'
=>
$teacherId
]);
if
(
$teacher
)
{
$teacher
->
deleteMe
();
}
}
}
}
src/console/controllers/TestController.php
0 → 100644
View file @
8762a5aa
<?php
/**
* Created by PhpStorm.
* User: xiabin
* Date: 2016/10/27
* Time: 上午11:52
*/
namespace
console\controllers
;
use
yii\console\Controller
;
class
TestController
extends
Controller
{
public
function
actionIndex
(){
$t
=
mktime
();
set_time_limit
(
1000
);
$myFile
=
"./insert.sql"
;
$fhandler
=
fopen
(
$myFile
,
'wb'
);
if
(
$fhandler
){
$sql
=
"268
\t
2
\t
'0,262,268,'
\t
0
\t
'2342'
\t
'423423'
\t
'123123'
\t
'23423423'
\t
'2012-01-09 09:55:43'
\t
'upload/product/20111205153432_53211.jpg'
\t
'upload/product/thumb_20111205153432_53211.jpg'
\t
NULL
\t
NULL
\t
38
\t
'件'
\t
''
\t
123
\t
123
\t
0"
;
$i
=
0
;
while
(
$i
<
10
)
//1,000,000
{
$i
++
;
fwrite
(
$fhandler
,
$sql
.
"
\r\n
"
);
}
echo
"写入成功,耗时:"
,
mktime
()
-
$t
;
}
}
}
\ No newline at end of file
src/frontend/components/ClassesFilter.php
View file @
8762a5aa
...
@@ -52,7 +52,13 @@ class ClassesFilter extends ActionFilter
...
@@ -52,7 +52,13 @@ class ClassesFilter extends ActionFilter
}
}
if
(
$this
->
_checkStatus
&&
$class
[
'status'
]
!=
Classes
::
STATUS_OK
)
{
if
(
$this
->
_checkStatus
&&
$class
[
'status'
]
!=
Classes
::
STATUS_OK
)
{
Utils
::
showWarn
(
'您提交的课堂资料尚未通过审核,无法访问此页面!'
);
switch
(
$class
[
'status'
])
{
case
Classes
::
STATUS_LOCKED
:
Utils
::
showWarn
(
'课堂被锁定无法访问!'
);
break
;
default
:
Utils
::
showWarn
(
'您提交的课堂资料尚未通过审核,无法访问此页面!'
);
}
}
}
if
(
property_exists
(
Yii
::
$app
->
controller
,
'classStatus'
))
{
if
(
property_exists
(
Yii
::
$app
->
controller
,
'classStatus'
))
{
...
...
src/frontend/components/MobileFilter.php
0 → 100644
View file @
8762a5aa
<?php
/**
* Created by PhpStorm.
* User: pader
* Date: 2016/10/27
* Time: 11:43
*/
namespace
frontend\components
;
use
common\libs\Utils
;
use
yii\base\ActionFilter
;
class
MobileFilter
extends
ActionFilter
{
protected
$message
;
public
function
setMessage
(
$message
)
{
$this
->
message
=
$message
;
}
public
function
beforeAction
(
$action
)
{
if
(
\Yii
::
$app
->
deviceDetect
->
isMobile
())
{
Utils
::
showWarn
(
$this
->
message
);
}
return
parent
::
beforeAction
(
$action
);
}
}
\ No newline at end of file
src/frontend/controllers/MyCourseController.php
View file @
8762a5aa
...
@@ -8,6 +8,7 @@ use common\models\CourseTeacher;
...
@@ -8,6 +8,7 @@ use common\models\CourseTeacher;
use
common\models\Courseware
;
use
common\models\Courseware
;
use
common\models\UploadPools
;
use
common\models\UploadPools
;
use
frontend\components\ClassesFilter
;
use
frontend\components\ClassesFilter
;
use
frontend\components\MobileFilter
;
use
frontend\models\CoursePublishForm
;
use
frontend\models\CoursePublishForm
;
use
Yii
;
use
Yii
;
use
yii\filters\AccessControl
;
use
yii\filters\AccessControl
;
...
@@ -38,10 +39,13 @@ class MyCourseController extends \yii\web\Controller
...
@@ -38,10 +39,13 @@ class MyCourseController extends \yii\web\Controller
'roles'
=>
[
'@'
]
'roles'
=>
[
'@'
]
]
]
]
]
],
],
[
'classes'
=>
[
'class'
=>
ClassesFilter
::
className
(),
'class'
=>
ClassesFilter
::
className
(),
'checkStatus'
=>
true
'checkStatus'
=>
true
],
[
'class'
=>
MobileFilter
::
className
(),
'only'
=>
[
'publish'
,
'edit'
],
'message'
=>
'移动端暂不支持发布课程'
]
]
];
];
}
}
...
...
src/frontend/controllers/TeacherManagerController.php
View file @
8762a5aa
...
@@ -4,6 +4,7 @@ namespace frontend\controllers;
...
@@ -4,6 +4,7 @@ namespace frontend\controllers;
use
common\components\Qiniu
;
use
common\components\Qiniu
;
use
common\libs\Utils
;
use
common\libs\Utils
;
use
common\models\CourseTeacher
;
use
common\models\Teacher
;
use
common\models\Teacher
;
use
common\models\UploadPools
;
use
common\models\UploadPools
;
use
common\models\User
;
use
common\models\User
;
...
@@ -145,6 +146,30 @@ class TeacherManagerController extends \yii\web\Controller
...
@@ -145,6 +146,30 @@ class TeacherManagerController extends \yii\web\Controller
return
Teacher
::
fetchTeacherNames
(
$classId
);
return
Teacher
::
fetchTeacherNames
(
$classId
);
}
}
/**
* 讲师管理
*
* @throws \yii\base\ExitException
*/
public
function
actionDelete
()
{
$teacherId
=
Yii
::
$app
->
request
->
post
(
'id'
,
0
);
if
(
!
$teacherId
)
{
Utils
::
ajaxResponse
(
false
,
'参数错误'
);
}
$teacher
=
Teacher
::
findOne
([
'id'
=>
$teacherId
,
'class_id'
=>
$this
->
classStatus
[
'id'
]]);
if
(
!
$teacher
)
{
Utils
::
ajaxResponse
(
false
,
'该讲师不存在或无权操作!'
);
}
//删除讲师与课程的关系
$teacher
->
deleteMe
();
Utils
::
ajaxResponse
(
true
);
}
}
}
src/frontend/views/teacher-manager/index.php
View file @
8762a5aa
<?php
<?php
/* @var $this yii\web\View */
/* @var $this yii\web\View */
use
frontend\assets\AppAsset
;
$this
->
title
=
'讲师管理'
;
$this
->
title
=
'讲师管理'
;
AppAsset
::
addScript
(
$this
,
'@web/assets/teacher_manager.js'
);
?>
?>
<div
class=
"teacher-list"
>
<div
class=
"teacher-list"
>
<?php
foreach
(
$data
as
$row
)
{
?>
<?php
foreach
(
$data
as
$row
)
{
?>
<div
class=
"col-md-3"
>
<div
class=
"col-md-3
TEACHER_ROW"
data-teacher-id=
"
<?=
$row
[
'id'
]
?>
"
>
<div
class=
"teacher-box"
>
<div
class=
"teacher-box"
>
<img
src=
"
<?=
\common\models\User
::
getAvatarUrl
(
$row
[
'avatar'
])
?>
"
>
<img
src=
"
<?=
\common\models\User
::
getAvatarUrl
(
$row
[
'avatar'
])
?>
"
>
<h3>
<?=
$row
[
'name'
]
?>
</h3>
<h3>
<?=
$row
[
'name'
]
?>
</h3>
<p>
<?=
$row
[
'intro'
]
?>
</p>
<p>
<?=
$row
[
'intro'
]
?>
</p>
<a
class=
"edit"
href=
"
<?=
\yii\helpers\Url
::
to
([
'teacher-manager/edit'
,
'id'
=>
$row
[
'id'
]])
?>
"
><i
class=
"icon-mode_edit"
></i></a>
<a
class=
"edit"
href=
"
<?=
\yii\helpers\Url
::
to
([
'teacher-manager/edit'
,
'id'
=>
$row
[
'id'
]])
?>
"
><i
class=
"icon-mode_edit"
></i></a>
<a
href=
"
#
"
class=
"delete"
><i
class=
"icon-trash"
></i></a>
<a
href=
"
javascript:;
"
class=
"delete"
><i
class=
"icon-trash"
></i></a>
</div>
</div>
</div>
</div>
<?php
}
?>
<?php
}
?>
...
...
src/frontend/web/js/home/components/video-play.vue
View file @
8762a5aa
...
@@ -13,11 +13,13 @@
...
@@ -13,11 +13,13 @@
<a
href=
"javascript:;"
class=
"qzone post-icons bds_qzone"
data-cmd=
"qzone"
title=
"分享到QQ空间"
></a>
<a
href=
"javascript:;"
class=
"qzone post-icons bds_qzone"
data-cmd=
"qzone"
title=
"分享到QQ空间"
></a>
</div>
</div>
</div>
</div>
<myvideo
v-if=
"!coursewareInfo.isPreview"
:preview-url=
"coursewareInfo.previewUrl"
:video-url=
"coursewareInfo.videoUrl"
></myvideo>
<myvideo
v-if=
"!coursewareInfo.isPreview"
:preview-url=
"coursewareInfo.previewUrl"
:video-url=
"coursewareInfo.videoUrl"
></myvideo>
<div
v-else
class=
"video-main"
>
<div
v-else
class=
"video-main"
>
<div
class=
"video-empty"
style=
"height:500px; width: 100%; background-color: #444; color: #fff; text-align: center;"
>
<div
class=
"video-empty"
style=
"height:500px; width: 100%; background-color: #444; color: #fff; text-align: center;"
>
<i
class=
"icon-clock"
></i>
<i
class=
"icon-clock"
></i>
<p>
课程审核中,审核通过后大家才可以看到您的课程
<br
/>
<p>
课程审核中,审核通过后大家才可以看到您的课程
<br/>
审核结果将以短信形式通知您
</p>
审核结果将以短信形式通知您
</p>
</div>
</div>
</div>
</div>
...
@@ -37,13 +39,13 @@
...
@@ -37,13 +39,13 @@
</p>
</p>
<p v-else class="
mb
-
right
">
<p v-else class="
mb
-
right
">
<a href="
javascript
:;
"><i class="
icon
-
comment
-
empty
"></i>{{coursewareInfo.comment_count
}}
</a>
<a href="
javascript
:;
"><i class="
icon
-
comment
-
empty
"></i>{{coursewareInfo.comment_count
}}
</a>
<a
href="
javascript
:;
"><i
<a href="
javascript
:;
"><i
:class="
{
'icon-fav-full'
:
coursewareInfo
.
isFavorite
,
'icon-fav-empty'
:
!
coursewareInfo
.
isFavorite
}
"></i>{{coursewareInfo.favorite_count
}}
</a>
:class="
{
'icon-fav-full'
:
coursewareInfo
.
isFavorite
,
'icon-fav-empty'
:
!
coursewareInfo
.
isFavorite
}
"></i>{{coursewareInfo.favorite_count
}}
</a>
<a
href="
javascript
:;
"><i
<a href="
javascript
:;
"><i
:class="
{
'icon-zan-full'
:
coursewareInfo
.
isSupport
,
'icon-zan-empty'
:
!
coursewareInfo
.
isSupport
}
"></i>{{coursewareInfo.support_count
}}
</a>
:class="
{
'icon-zan-full'
:
coursewareInfo
.
isSupport
,
'icon-zan-empty'
:
!
coursewareInfo
.
isSupport
}
"></i>{{coursewareInfo.support_count
}}
</a>
</p>
</p>
<button v-if="
coursewareInfo
.
isPreview
"
class="
btn
btn
-
danger
m
-
l
-
20
mb
-
left
">购买
<button v-if="
coursewareInfo
.
isPreview
" class="
btn
btn
-
danger
m
-
l
-
20
mb
-
left
">购买
¥{{coursewareInfo.price
}}
¥{{coursewareInfo.price
}}
</button>
</button>
<template v-else>
<template v-else>
...
@@ -55,7 +57,8 @@
...
@@ -55,7 +57,8 @@
data-toggle="
modal
" disabled="
disabled
">已购买
data-toggle="
modal
" disabled="
disabled
">已购买
</button>
</button>
<template v-else>
<template v-else>
<button v-if="
isMobile
===
false
&&
isWeixin
===
false
" class="
btn
btn
-
danger
m
-
l
-
20
mb
-
left
"
<button id="
web
-
pay
" v-if="
isMobile
===
false
&&
isWeixin
===
false
"
class="
btn
btn
-
danger
m
-
l
-
20
mb
-
left
"
data-toggle="
modal
"
data-toggle="
modal
"
data-target="
#
pay
">购买 ¥{{coursewareInfo.price
}}
data-target="
#
pay
">购买 ¥{{coursewareInfo.price
}}
</button>
</button>
...
@@ -189,14 +192,14 @@
...
@@ -189,14 +192,14 @@
}
,
}
,
mobileAliPay(courseId){
mobileAliPay(courseId){
var url = __BASE_URL__ + 'home/pay?courseId=' + courseId;
var url = __BASE_URL__ + 'home/pay?courseId=' + courseId;
window.location.href =
url;
window.location.href = url;
}
,
}
,
weixinJsPay(courseId){
weixinJsPay(courseId){
var url = __BASE_URL__ + 'weixin-js-pay/index?courseId=' + courseId;
var url = __BASE_URL__ + 'weixin-js-pay/index?courseId=' + courseId;
window.location.href = url;
window.location.href = url;
}
,
}
,
login(){
login(){
var returnUrl = __BASE_URL__ + 'home/video?courseId=' + this.coursewareInfo.course_id;
var returnUrl = __BASE_URL__ + 'home/video?courseId=' + this.coursewareInfo.course_id
+ '&pay=1'
;
var url = __BASE_URL__ + 'site/set-return-url?url=' + returnUrl;
var url = __BASE_URL__ + 'site/set-return-url?url=' + returnUrl;
$.getJSON(url, function () {
$.getJSON(url, function () {
window.location.href = __BASE_URL__ + 'site/login';
window.location.href = __BASE_URL__ + 'site/login';
...
@@ -251,22 +254,37 @@
...
@@ -251,22 +254,37 @@
}
}
}
,
}
,
components: {
components: {
myvideo:myvideo
myvideo:
myvideo
}
,
}
,
ready(){
ready(){
var self = this;
var self = this;
this.isMobile = this.coursewareInfo.isMobile;
this.isMobile = this.coursewareInfo.isMobile;
this.isWeixin = Utils.isWeixin();
this.isWeixin = Utils.isWeixin();
//判断是否要显示支付信息
var pay = getQueryString('pay');
if (pay == 1 && !this.coursewareInfo.isShop) {
if(this.isMobile == false && this.isWeixin == false){
$('#web-pay').trigger('click');
}
else if(this.isMobile == true && this.isWeixin == false){
this.mobileAliPay(this.coursewareInfo.course_id);
}
else if(this.isWeixin === true){
this.weixinJsPay(this.coursewareInfo.course_id);
}
}
}
}
}
}
function getQueryString(name) {
var reg = new RegExp("
(
^|&
)
" + name + "
=
([
^&
]
*
)(
&|
$
)
", "
i
");
var r = window.location.search.substr(1).match(reg); //获取url中"
?
"符后的字符串并正则匹配
var context = "";
if (r != null)
context = r[2];
reg = null;
r = null;
return context == null || context == "" || context == "
undefined
" ? "" : context;
}
</script>
</script>
...
...
src/frontend/web/js/home/components/video.vue
View file @
8762a5aa
...
@@ -47,11 +47,11 @@
...
@@ -47,11 +47,11 @@
"poster"
:
self
.
previewUrl
"poster"
:
self
.
previewUrl
}).
ready
(
function
()
{
}).
ready
(
function
()
{
$
(
'#my-video-play'
).
css
(
'width'
,
'100%'
);
$
(
'#my-video-play'
).
css
(
'width'
,
'100%'
);
var
wVideo
=
$
(
'
.video-detail-info
'
).
width
();
var
wVideo
=
$
(
'
#my-video-play
'
).
width
();
var
hVideo
=
wVideo
*
rate
;
var
hVideo
=
wVideo
*
rate
;
$
(
'#my-video-play'
).
css
(
'height'
,
hVideo
);
$
(
'#my-video-play'
).
css
(
'height'
,
hVideo
);
window
.
onresize
=
function
()
{
window
.
onresize
=
function
()
{
var
wVideo
=
$
(
'
.video-detail-info
'
).
width
();
var
wVideo
=
$
(
'
#my-video-play
'
).
width
();
var
hVideo
=
wVideo
*
rate
;
var
hVideo
=
wVideo
*
rate
;
$
(
'#my-video-play'
).
css
(
'height'
,
hVideo
);
$
(
'#my-video-play'
).
css
(
'height'
,
hVideo
);
};
};
...
...
src/frontend/web/js/teacher-manager/index.js
0 → 100644
View file @
8762a5aa
/**
* Created by pader on 2016/10/27.
*/
var
layer
=
require
(
"layer-js"
);
$
(
".TEACHER_ROW a.delete"
).
click
(
function
()
{
var
teacherId
=
$
(
this
).
closest
(
".TEACHER_ROW"
).
data
(
"teacherId"
);
layer
.
confirm
(
"确定删除该讲师吗?"
,
{
title
:
"删除讲师"
,
btn
:
[
'确定'
,
'取消'
]
},
function
()
{
var
idx
=
layer
.
msg
(
"正在提交.."
,
{
icon
:
16
,
shade
:
[
0.2
,
'#000'
],
time
:
0
});
$
.
post
(
"/teacher-manager/delete"
,
{
id
:
teacherId
},
function
(
t
)
{
layer
.
close
(
idx
);
if
(
t
.
status
)
{
layer
.
msg
(
"已删除指定讲师!"
,
{
time
:
1500
,
icon
:
1
,
end
:
function
()
{
location
.
reload
();
},
shade
:
[
0.2
,
'#000'
]
});
}
else
{
layer
.
alert
(
t
.
message
,
{
icon
:
5
,
title
:
"提示"
});
}
},
"json"
);
});
});
\ No newline at end of file
src/frontend/web/webpack.config.js
View file @
8762a5aa
...
@@ -25,6 +25,7 @@ var entry = {
...
@@ -25,6 +25,7 @@ var entry = {
home_video
:
[
js_dir
+
'/home/video.js'
],
home_video
:
[
js_dir
+
'/home/video.js'
],
course_publish
:
[
js_dir
+
'/my-course/publish.js'
],
course_publish
:
[
js_dir
+
'/my-course/publish.js'
],
course_edit
:
[
js_dir
+
'/my-course/edit.js'
],
course_edit
:
[
js_dir
+
'/my-course/edit.js'
],
teacher_manager
:
[
js_dir
+
'/teacher-manager/index.js'
],
teacher_form
:
[
js_dir
+
'/teacher-manager/form.js'
],
teacher_form
:
[
js_dir
+
'/teacher-manager/form.js'
],
my_income
:
[
js_dir
+
'/my-income/index.js'
]
my_income
:
[
js_dir
+
'/my-income/index.js'
]
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment