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
9e34a849
Commit
9e34a849
authored
Oct 27, 2016
by
xiabin
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
dfb37eb4
c7181066
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
88 additions
and
22 deletions
+88
-22
ClassesController.php
src/backend/controllers/ClassesController.php
+12
-3
CourseController.php
src/backend/controllers/CourseController.php
+3
-0
index.php
src/backend/views/classes/index.php
+2
-2
index.php
src/backend/views/course/index.php
+6
-6
Utils.php
src/common/libs/Utils.php
+39
-0
Classes.php
src/common/models/Classes.php
+2
-1
Course.php
src/common/models/Course.php
+2
-1
m160927_115114_classes_init.php
src/console/migrations/m160927_115114_classes_init.php
+1
-0
m160927_121107_course_init.php
src/console/migrations/m160927_121107_course_init.php
+2
-1
ClassesFilter.php
src/frontend/components/ClassesFilter.php
+3
-0
MyCourseController.php
src/frontend/controllers/MyCourseController.php
+1
-1
index.php
src/frontend/views/my-course/index.php
+4
-3
index.php
src/frontend/views/my-income/index.php
+4
-1
index.php
src/frontend/views/my-member/index.php
+5
-1
index.php
src/frontend/views/teacher-manager/index.php
+2
-2
No files found.
src/backend/controllers/ClassesController.php
View file @
9e34a849
...
...
@@ -78,10 +78,15 @@ class ClassesController extends Controller
switch
(
$check
)
{
case
Classes
::
STATUS_OK
:
$class
->
status
=
$check
;
if
(
$class
->
save
()
&&
$msg
)
{
$class
->
reason
=
''
;
$user
->
role
=
User
::
ROLE_TEACHER
;
if
(
$class
->
update
()
&&
$user
->
update
()
&&
$msg
)
{
$template
=
Yii
::
$app
->
params
[
'classes.check.msg.ok'
];
$sms
->
send
(
$user
->
telephone
,
str_replace
(
'{className}'
,
$class
->
name
,
$template
));
}
Utils
::
ajaxResponse
(
true
);
break
;
...
...
@@ -93,7 +98,9 @@ class ClassesController extends Controller
}
$class
->
status
=
$check
;
if
(
$class
->
save
()
&&
$msg
)
{
$class
->
reason
=
$reason
;
if
(
$class
->
update
()
&&
$msg
)
{
$template
=
Yii
::
$app
->
params
[
'classes.check.msg.failed'
];
$sms
->
send
(
$user
->
telephone
,
str_replace
([
'{className}'
,
'{reason}'
],
[
$class
->
name
,
$reason
],
$template
));
}
...
...
@@ -109,7 +116,9 @@ class ClassesController extends Controller
}
$class
->
status
=
$check
;
if
(
$class
->
save
()
&&
$msg
)
{
$class
->
reason
=
$reason
;
if
(
$class
->
update
()
&&
$msg
)
{
$template
=
Yii
::
$app
->
params
[
'classes.check.msg.locked'
];
$sms
->
send
(
$user
->
telephone
,
str_replace
([
'{className}'
,
'{reason}'
],
[
$class
->
name
,
$reason
],
$template
));
}
...
...
src/backend/controllers/CourseController.php
View file @
9e34a849
...
...
@@ -122,6 +122,7 @@ class CourseController extends Controller
}
$course
->
status
=
$check
;
$course
->
reason
=
''
;
$courseware
->
status
=
$check
;
if
(
$course
->
save
()
&&
$courseware
->
save
()
&&
$msg
)
{
...
...
@@ -140,6 +141,7 @@ class CourseController extends Controller
}
$course
->
status
=
$check
;
$course
->
reason
=
$reason
;
$courseware
->
status
=
Courseware
::
STATUS_FAILED
;
if
(
$course
->
save
()
&&
$courseware
->
save
()
&&
$msg
)
{
...
...
@@ -158,6 +160,7 @@ class CourseController extends Controller
}
$course
->
status
=
$check
;
$course
->
reason
=
$reason
;
$courseware
->
status
=
Courseware
::
STATUS_LOCKED
;
if
(
$course
->
save
()
&&
$courseware
->
save
()
&&
$msg
)
{
...
...
src/backend/views/classes/index.php
View file @
9e34a849
...
...
@@ -99,11 +99,11 @@ $this->title = "课堂管理";
<script
type=
"text/javascript"
>
$
(
function
()
{
$
(
"button.CLASS_CHECK"
).
click
(
function
()
{
accessAction
(
this
,
1
,
'确定要通过该课堂申请吗?'
,
true
);
accessAction
(
this
,
1
,
'确定要通过该课堂申请吗?'
,
"已通过该课堂申请。"
,
true
);
});
$
(
"button.CLASS_REFUSE"
).
click
(
function
()
{
refuseAction
(
this
,
2
,
"请输入拒绝原因!"
,
"已拒绝课堂申请!"
,
true
);
refuseAction
(
this
,
2
,
"请输入拒绝原因!"
,
"已拒绝
该
课堂申请!"
,
true
);
});
$
(
"button.CLASS_LOCK"
).
click
(
function
()
{
...
...
src/backend/views/course/index.php
View file @
9e34a849
...
...
@@ -6,6 +6,7 @@
* @var $pagination \yii\data\Pagination
* @var $qiniu \common\components\Qiniu
*/
use
common\libs\Utils
;
use
common\models\Course
;
use
yii\helpers\Html
;
use
yii\helpers\Url
;
...
...
@@ -38,7 +39,6 @@ $qiniu = \Yii::$app->qiniu;
<li
<?php
if
(
$status
==
Course
::
STATUS_LOCKED
)
{
?>
class=
"active"
<?php
}
?>
><a
href=
"
<?=
Url
::
to
([
'course/index'
,
'status'
=>
Course
::
STATUS_LOCKED
])
?>
"
><i
class=
"fa fa-lock"
></i>
已锁定
</a></li>
</ul>
</div>
<!-- /.box-body -->
</div>
<?php
if
(
$count
>
0
)
{
?>
...
...
@@ -49,11 +49,11 @@ $qiniu = \Yii::$app->qiniu;
<tr
role=
"row"
>
<th>
课程ID
</th>
<th
colspan=
"2"
>
视频
</th>
<th>
时长
/秒
</th>
<th>
时长
</th>
<th>
文件大小
</th>
<th>
原始格式
</th>
<th>
价格/元
</th>
<th>
免费试看
/分钟
</th>
<th>
免费试看
</th>
<th>
ACTION
</th>
</tr>
</thead>
...
...
@@ -63,11 +63,11 @@ $qiniu = \Yii::$app->qiniu;
<td
class=
"sorting_1"
>
<?=
$course
[
'id'
]
?>
</td>
<td
width=
"110"
><a
href=
"
<?=
$qiniu
->
getUrl
(
'public'
,
$course
[
'preview_pic'
])
?>
-m.preview"
target=
"_blank"
><img
src=
"
<?=
$qiniu
->
getUrl
(
'public'
,
$course
[
'preview_pic'
])
?>
-s.preview"
height=
"50"
></a></td>
<td><a
href=
"#"
>
<?=
Html
::
encode
(
$course
[
'name'
])
?>
</a><span
class=
"help-block"
>
<?=
date
(
'Y-m-d H:i:s'
,
$course
[
'created_at'
])
?>
</span></td>
<td>
<?=
$course
[
'courseware'
][
'time'
]
?>
</td>
<td>
<?=
$course
[
'courseware'
][
'size'
]
?>
</td>
<td>
<?=
Utils
::
humanSeconds
(
$course
[
'courseware'
][
'time'
])
?>
</td>
<td>
<?=
Utils
::
byteConvert
(
$course
[
'courseware'
][
'size'
])
?>
</td>
<td>
<?=
$course
[
'courseware'
][
'format'
]
?>
</td>
<td>
<?=
$course
[
'price'
]
?>
</td>
<td>
<?=
$course
[
'free_time'
]
?>
</td>
<td>
<?=
(
$course
[
'free_time'
]
?
$course
[
'free_time'
]
.
'分钟'
:
'-'
)
?>
</td>
<td>
<a
class=
"btn btn-info btn-xs COURSE_DETAIL"
href=
"
<?=
Url
::
to
([
'course/detail'
,
'id'
=>
$course
[
'id'
]])
?>
"
target=
"_blank"
><i
class=
"fa fa-info"
></i>
详情
</a>
<?php
if
(
$course
[
'status'
]
==
Course
::
STATUS_OK
)
{
?>
...
...
src/common/libs/Utils.php
View file @
9e34a849
...
...
@@ -207,6 +207,45 @@ class Utils
return
$count
;
}
/**
* 将字节数转换为可读文件大小
*
* @param int $bytes
* @return string
*/
public
static
function
byteConvert
(
$bytes
)
{
if
(
$bytes
==
0
)
return
"0.00 B"
;
$s
=
array
(
'B'
,
'KB'
,
'MB'
,
'GB'
,
'TB'
,
'PB'
);
$e
=
floor
(
log
(
$bytes
,
1024
));
return
round
(
$bytes
/
pow
(
1024
,
$e
),
2
)
.
' '
.
$s
[
$e
];
}
/**
* 将秒数转换为自然时间
*
* @param int
* @return string
*/
public
static
function
humanSeconds
(
$tl
)
{
$units
=
[
'年'
=>
31536000
,
'月'
=>
2628000
,
'天'
=>
86400
,
'小时'
=>
3600
,
'分钟'
=>
60
,
'秒'
=>
1
];
$str
=
''
;
foreach
(
$units
as
$un
=>
$it
)
{
if
(
$tl
>=
$it
)
{
$floor
=
floor
(
$tl
/
$it
);
$tl
=
fmod
(
$tl
,
$it
);
$str
.=
$floor
.
$un
;
}
}
return
$str
;
}
/**
* @param $rootElementName
* @param $ar
...
...
src/common/models/Classes.php
View file @
9e34a849
...
...
@@ -18,6 +18,7 @@ use yii\db\ActiveRecord;
* @property string $intro
* @property string $desc
* @property integer $status
* @property string $reason
* @property integer $created_at
* @property integer $updated_at
*/
...
...
@@ -65,7 +66,7 @@ class Classes extends ActiveRecord
return
[
[[
'user_id'
,
'name'
,
'intro'
],
'required'
],
[[
'user_id'
,
'status'
],
'integer'
],
[[
'intro'
,
'desc'
],
'string'
],
[[
'intro'
,
'desc'
,
'reason'
],
'string'
],
[[
'name'
],
'string'
,
'max'
=>
30
],
];
}
...
...
src/common/models/Course.php
View file @
9e34a849
...
...
@@ -22,6 +22,7 @@ use yii\redis\ActiveRecord;
* @property string $preview_pic
* @property integer $recommend
* @property integer $status
* @property string $reason
* @property integer $play_count
* @property integer $comment_count
* @property integer $favorite_count
...
...
@@ -85,7 +86,7 @@ class Course extends \yii\db\ActiveRecord
[[
'name'
,
'preview_pic'
],
'required'
],
[
'name'
,
'string'
,
'length'
=>
[
1
,
60
]],
[[
'user_id'
,
'class_id'
],
'integer'
],
[
'intro'
,
'string'
],
[
[
'intro'
,
'reason'
]
,
'string'
],
[[
'price'
],
'number'
],
[
'free_time'
,
'integer'
,
'min'
=>
0
,
'max'
=>
15
],
[
'recommend'
,
'boolean'
],
...
...
src/console/migrations/m160927_115114_classes_init.php
View file @
9e34a849
...
...
@@ -23,6 +23,7 @@ class m160927_115114_classes_init extends Migration
'intro'
=>
$this
->
text
()
->
notNull
(),
'desc'
=>
$this
->
text
()
->
notNull
()
->
comment
(
'案例资源'
),
'status'
=>
$this
->
smallInteger
()
->
notNull
()
->
defaultValue
(
0
)
->
comment
(
'0 未审核 1 审核通过 2 审核不通过 3 锁定 '
),
'reason'
=>
$this
->
string
(
128
)
->
notNull
()
->
comment
(
'未审核通过时的原因'
),
'created_at'
=>
$this
->
integer
()
->
notNull
(),
'updated_at'
=>
$this
->
integer
()
->
notNull
(),
],
$tableOptions
);
...
...
src/console/migrations/m160927_121107_course_init.php
View file @
9e34a849
...
...
@@ -22,8 +22,9 @@ class m160927_121107_course_init extends Migration
'price'
=>
$this
->
decimal
(
6
,
2
)
->
unsigned
()
->
notNull
()
->
defaultValue
(
0
),
'free_time'
=>
$this
->
integer
(
10
)
->
notNull
()
->
defaultValue
(
0
),
'intro'
=>
$this
->
text
()
->
notNull
(),
'preview_pic'
=>
$this
->
string
(
2
55
)
->
notNull
(),
'preview_pic'
=>
$this
->
string
(
2
00
)
->
notNull
(),
'recommend'
=>
$this
->
smallInteger
()
->
notNull
()
->
defaultValue
(
0
)
->
comment
(
'0 表示推荐 1推荐'
),
'reason'
=>
$this
->
string
(
128
)
->
notNull
()
->
comment
(
'未审核通过时的原因'
),
'status'
=>
$this
->
smallInteger
()
->
notNull
()
->
defaultValue
(
0
)
->
comment
(
'0 未审核 1 审核通过 2 审核不通过 3 锁定 '
),
'play_count'
=>
$this
->
integer
(
10
)
->
unsigned
()
->
notNull
()
->
defaultValue
(
0
)
->
comment
(
'播放次数'
),
'comment_count'
=>
$this
->
integer
(
8
)
->
unsigned
()
->
notNull
()
->
defaultValue
(
0
)
->
comment
(
'评论次数'
),
...
...
src/frontend/components/ClassesFilter.php
View file @
9e34a849
...
...
@@ -56,6 +56,9 @@ class ClassesFilter extends ActionFilter
case
Classes
::
STATUS_LOCKED
:
Utils
::
showWarn
(
'课堂被锁定无法访问!'
);
break
;
case
Classes
::
STATUS_FAILED
:
Utils
::
showWarn
(
'您提交的课堂资料未能通过审核!'
);
break
;
default
:
Utils
::
showWarn
(
'您提交的课堂资料尚未通过审核,无法访问此页面!'
);
}
...
...
src/frontend/controllers/MyCourseController.php
View file @
9e34a849
...
...
@@ -58,7 +58,7 @@ class MyCourseController extends \yii\web\Controller
public
function
actionIndex
()
{
$list
=
Course
::
getCourseListsByClassId
(
$this
->
classStatus
[
'id'
],
null
,
12
,
null
);
return
$this
->
render
(
'index'
,
[
'list'
=>
$list
[
'data'
],
'pagination'
=>
$list
[
'pagination'
]]);
return
$this
->
render
(
'index'
,
[
'
count'
=>
$list
[
'count'
],
'
list'
=>
$list
[
'data'
],
'pagination'
=>
$list
[
'pagination'
]]);
}
/**
...
...
src/frontend/views/my-course/index.php
View file @
9e34a849
...
...
@@ -26,6 +26,7 @@ $this->registerJs($js);
*/
$qiniu
=
\Yii
::
$app
->
qiniu
;
?>
<?php
if
(
$count
>
0
)
{
?>
<div
class=
"cls-list-box clearfix"
>
<?php
foreach
(
$list
as
$course
)
{
?>
<div
class=
"col-md-4"
>
...
...
@@ -105,11 +106,11 @@ $qiniu = \Yii::$app->qiniu;
</div>
<?php
}
?>
</div>
<div
class=
"text-center"
>
<?=
LinkPager
::
widget
([
'pagination'
=>
$pagination
])
?>
</div>
<?php
}
else
{
?>
<div
class=
"empty-data"
>
您还没有添加课程!
</div>
<?php
}
?>
\ No newline at end of file
src/frontend/views/my-income/index.php
View file @
9e34a849
...
...
@@ -37,6 +37,7 @@ AppAsset::addScript($this, '@web/assets/my_income.js');
</div>
</div>
<?php
if
(
$count
>
0
)
{
?>
<div
class=
"con-md-12"
>
<div
class=
"table-responsive table-box"
>
<table
class=
"table table-hover"
>
...
...
@@ -70,4 +71,6 @@ AppAsset::addScript($this, '@web/assets/my_income.js');
</div>
</div>
</div>
<?php
}
else
{
?>
<div
class=
"empty-data"
style=
"margin-top:80px;"
>
您还没有卖出课程的记录!
</div>
<?php
}
?>
\ No newline at end of file
src/frontend/views/my-member/index.php
View file @
9e34a849
...
...
@@ -26,6 +26,7 @@ $this->title = '我的会员';
</div>
</div>
<?php
if
(
$count
>
0
)
{
?>
<div
class=
"con-md-12"
>
<div
class=
"table-responsive table-box"
>
<table
class=
"table table-hover"
>
...
...
@@ -59,4 +60,7 @@ $this->title = '我的会员';
<?=
\yii\widgets\LinkPager
::
widget
([
'pagination'
=>
$pagination
])
?>
</div>
</div>
</div>
\ No newline at end of file
</div>
<?php
}
else
{
?>
<div
class=
"empty-data"
style=
"margin-top:80px;"
>
您还没有会员!
</div>
<?php
}
?>
\ No newline at end of file
src/frontend/views/teacher-manager/index.php
View file @
9e34a849
...
...
@@ -14,8 +14,8 @@ AppAsset::addScript($this, '@web/assets/teacher_manager.js');
<img
src=
"
<?=
\common\models\User
::
getAvatarUrl
(
$row
[
'avatar'
])
?>
"
>
<h3>
<?=
$row
[
'name'
]
?>
</h3>
<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
href=
"javascript:;"
class=
"delete"
><i
class=
"icon-trash"
></i></a>
<a
class=
"edit"
href=
"
<?=
\yii\helpers\Url
::
to
([
'teacher-manager/edit'
,
'id'
=>
$row
[
'id'
]])
?>
"
title=
"编辑讲师信息"
><i
class=
"icon-mode_edit"
></i></a>
<a
href=
"javascript:;"
class=
"delete"
title=
"删除该讲师"
><i
class=
"icon-trash"
></i></a>
</div>
</div>
<?php
}
?>
...
...
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