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
bd054262
Commit
bd054262
authored
Oct 17, 2016
by
汪波
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
dc0f2a6a
dd36f3f9
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
379 additions
and
359 deletions
+379
-359
main.php
src/common/config/main.php
+0
-48
params.php
src/common/config/params.php
+0
-37
BrowseRecord.php
src/common/models/BrowseRecord.php
+40
-7
Course.php
src/common/models/Course.php
+1
-1
Favorite.php
src/common/models/Favorite.php
+2
-2
Income.php
src/common/models/Income.php
+10
-6
Orders.php
src/common/models/Orders.php
+17
-4
index-test.php
src/environments/dev/backend/web/index-test.php
+6
-0
index.php
src/environments/dev/backend/web/index.php
+6
-0
main-local.php
src/environments/dev/common/config/main-local.php
+52
-17
params-local.php
src/environments/dev/common/config/params-local.php
+36
-0
main-local.php
src/environments/dev/frontend/config/main-local.php
+10
-0
index-test.php
src/environments/dev/frontend/web/index-test.php
+6
-0
index.php
src/environments/dev/frontend/web/index.php
+6
-0
main.php
src/frontend/config/main.php
+0
-10
HomeController.php
src/frontend/controllers/HomeController.php
+49
-9
UserCenterController.php
src/frontend/controllers/UserCenterController.php
+12
-10
userCenter.php
src/frontend/views/layouts/userCenter.php
+1
-1
browseRecord.php
src/frontend/views/user-center/browseRecord.php
+42
-81
favorite.php
src/frontend/views/user-center/favorite.php
+31
-25
purchasedCourse.php
src/frontend/views/user-center/purchasedCourse.php
+41
-101
video.js
src/frontend/web/js/home/video.js
+11
-0
No files found.
src/common/config/main.php
View file @
bd054262
...
@@ -5,35 +5,6 @@ return [
...
@@ -5,35 +5,6 @@ return [
'vendorPath'
=>
dirname
(
dirname
(
__DIR__
))
.
'/vendor'
,
'vendorPath'
=>
dirname
(
dirname
(
__DIR__
))
.
'/vendor'
,
'bootstrap'
=>
[
'log'
],
'bootstrap'
=>
[
'log'
],
'components'
=>
[
'components'
=>
[
'cache'
=>
[
'class'
=>
'yii\redis\Cache'
,
'redis'
=>
[
'hostname'
=>
'192.168.1.185'
,
'port'
=>
6379
,
'database'
=>
0
,
]
],
'db'
=>
[
'class'
=>
'yii\db\Connection'
,
'dsn'
=>
'mysql:host=192.168.1.185;dbname=zuiketang'
,
'username'
=>
'root'
,
'password'
=>
'mysql123'
,
'charset'
=>
'utf8'
,
],
'redis'
=>
[
'class'
=>
'yii\redis\Connection'
,
'hostname'
=>
'192.168.1.185'
,
'port'
=>
6379
,
'database'
=>
0
,
],
'mailer'
=>
[
'class'
=>
'yii\swiftmailer\Mailer'
,
'viewPath'
=>
'@common/mail'
,
// send all mails to a file by default. You have to set
// 'useFileTransport' to false and configure a transport
// for the mailer to send real emails.
'useFileTransport'
=>
TRUE
,
],
'authManager'
=>
[
'authManager'
=>
[
'class'
=>
'yii\rbac\PhpManager'
,
'class'
=>
'yii\rbac\PhpManager'
,
'defaultRoles'
=>
[
'normal'
,
'teacher'
],
'defaultRoles'
=>
[
'normal'
,
'teacher'
],
...
@@ -48,24 +19,5 @@ return [
...
@@ -48,24 +19,5 @@ return [
'<controller:[\w\-]+>/<action:[\w\-]+>/<id:\d+>'
=>
'<controller>/<action>'
,
'<controller:[\w\-]+>/<action:[\w\-]+>/<id:\d+>'
=>
'<controller>/<action>'
,
],
],
],
],
'qiniu'
=>
[
'class'
=>
'common\components\Qiniu'
,
'accessKey'
=>
'n85SCPB9uO2v32az-3TRFsZCXwJu7YddyzLRYXg-'
,
'secretKey'
=>
'KDl3b7aLpj7n9YZ07lHGivVY4c_Q-0QSM0TZ_-XS'
,
'storages'
=>
[
'public'
=>
[
'bucket'
=>
'pp-classroom'
,
'fsizeLimit'
=>
pow
(
1024
,
2
)
*
5
,
//5MB
'mimeLimit'
=>
'image/jpeg;image/png;image/gif'
,
'url'
=>
'http://dev.qdn.pp.cc/'
],
'video'
=>
[
'bucket'
=>
'pp-classroom-private'
,
'fsizeLimit'
=>
pow
(
1024
,
3
)
*
2
,
//2GB
'mimeLimit'
=>
'video/*;flv-application/octet-stream'
,
'url'
=>
'http://oe9d6dr84.bkt.clouddn.com/'
]
]
]
],
],
];
];
src/common/config/params.php
View file @
bd054262
<?php
<?php
return
[
return
[
'adminEmail'
=>
'admin@example.com'
,
'supportEmail'
=>
'support@example.com'
,
'user.passwordResetTokenExpire'
=>
3600
,
'captchaId'
=>
'4d6ad870bf63a30be3d22c92925b04ca'
,
'privateKey'
=>
'a2ca5e5139d1f43ac4e1cd248f3e52e4'
,
'msg.host'
=>
'http://114.55.132.75:7893/sms.aspx'
,
'msg.userid'
=>
'78'
,
'msg.account'
=>
'276147613x'
,
'msg.password'
=>
'276147613'
,
'msg.signature'
=>
'【最课堂】'
,
'alipay'
=>
[
'partner'
=>
'2088701843067550'
,
'seller_id'
=>
'2088701843067550'
,
'key'
=>
'12vr33u4g314hytde3g81oao9dfdarm6'
,
'notify_url'
=>
'http://商户网址/create_direct_pay_by_user-PHP-UTF-8/notify_url.php'
,
'return_url'
=>
'http://商户网址/create_direct_pay_by_user-PHP-UTF-8/return_url.php'
,
'sign_type'
=>
strtoupper
(
'MD5'
),
'input_charset'
=>
strtolower
(
'utf-8'
),
'cacert'
=>
getcwd
()
.
'\\cacert.pem'
,
'transport'
=>
'http'
,
'payment_type'
=>
'1'
,
'service'
=>
'create_direct_pay_by_user'
,
],
// 'weixinpay'=>[
// 'appid'=>'wx180521eb22e9d7af',
// 'mchid'=>'1295461001',
// 'key'=>'ejg0l9phOAkp021qB54shz0Q8Tiscwzy',
// 'appsecret'=>'f20293c9548c469fb8b855fc98c4ef3c',
//
// ]
'weixinpay'
=>
[
'appid'
=>
'wx5714a24a60083b2a'
,
'mchid'
=>
'1399794002'
,
'key'
=>
'8934e7d15453e97507ef794cf7b0519d'
,
'appsecret'
=>
'7c18222c6ec31efa65d21606a629585d'
,
]
];
];
src/common/models/BrowseRecord.php
View file @
bd054262
...
@@ -4,6 +4,7 @@ namespace common\models;
...
@@ -4,6 +4,7 @@ namespace common\models;
use
Yii
;
use
Yii
;
use
yii\behaviors\TimestampBehavior
;
use
yii\behaviors\TimestampBehavior
;
use
yii\data\Pagination
;
use
yii\redis\ActiveRecord
;
use
yii\redis\ActiveRecord
;
/**
/**
...
@@ -46,8 +47,8 @@ class BrowseRecord extends \yii\db\ActiveRecord
...
@@ -46,8 +47,8 @@ class BrowseRecord extends \yii\db\ActiveRecord
public
function
rules
()
public
function
rules
()
{
{
return
[
return
[
[[
'user_id'
,
'course_id'
,],
'required'
],
[[
'user_id'
,
'course_id'
,
'courseware_id'
],
'required'
],
[[
'user_id'
,
'course_id'
,
'time'
],
'integer'
],
[[
'user_id'
,
'course_id'
,
'
courseware_id'
,
'
time'
],
'integer'
],
];
];
}
}
...
@@ -60,6 +61,7 @@ class BrowseRecord extends \yii\db\ActiveRecord
...
@@ -60,6 +61,7 @@ class BrowseRecord extends \yii\db\ActiveRecord
'id'
=>
'ID'
,
'id'
=>
'ID'
,
'user_id'
=>
'User ID'
,
'user_id'
=>
'User ID'
,
'course_id'
=>
'Course ID'
,
'course_id'
=>
'Course ID'
,
'courseware_id'
=>
'courseware Id'
,
'time'
=>
'Time'
,
'time'
=>
'Time'
,
];
];
}
}
...
@@ -69,14 +71,45 @@ class BrowseRecord extends \yii\db\ActiveRecord
...
@@ -69,14 +71,45 @@ class BrowseRecord extends \yii\db\ActiveRecord
* @param $userId
* @param $userId
* @return mixed
* @return mixed
*/
*/
public
static
function
getByUserId
(
$userId
)
public
static
function
findByUserId
(
$userId
,
$page
,
$num
)
{
{
$tableA
=
self
::
tableName
();
$tableA
=
self
::
tableName
();
$tableB
=
Course
::
tableName
();
$tableB
=
Course
::
tableName
();
$condition
=
"
$tableA
.user_id=:user_id"
;
$params
=
[
':user_id'
=>
$userId
];
//获取总数
$count
=
self
::
find
()
->
where
(
$condition
,
$params
)
->
count
();
$start
=
$page
*
$num
;
$pagination
=
new
Pagination
([
'totalCount'
=>
$count
,
'pageSize'
=>
$num
,
'forcePageParam'
=>
FALSE
]);
$data
=
self
::
find
()
->
where
(
$condition
,
$params
)
->
limit
(
$num
)
->
offset
(
$start
)
->
orderBy
(
"
$tableA
.time DESC"
)
->
joinWith
(
'course'
)
->
asArray
()
->
all
();
return
[
'count'
=>
$count
,
'data'
=>
$data
,
'pagination'
=>
$pagination
];
}
/**
* 获取该课程是被记录浏览记录
* @param $userId
* @param $coursewareId
* @return mixed
*/
public
static
function
findByUserIdAndCoursewareId
(
$userId
,
$coursewareId
)
{
return
self
::
find
()
return
self
::
find
()
->
select
(
"course_id,time,
$tableB
.name,
$tableB
.avatar,
$tableB
.price,
$tableB
.free_time,
$tableB
.intro,
$tableB
.preview_pic,
$tableB
.created_at"
)
->
where
(
"user_id=:user_id and courseware_id=:courseware_id"
,
[
':user_id'
=>
$userId
,
':courseware_id'
=>
$coursewareId
])
->
where
(
"
$tableA
.user_id = :user_id"
,
[
->
one
();
':user_id'
=>
$userId
}
])
->
join
(
'left join'
,
$tableB
,
"
$tableA
.user_id=
$tableB
.id"
)
->
asArray
()
->
all
();
/**
* @return $this
*/
public
function
getCourse
()
{
return
$this
->
hasOne
(
Course
::
className
(),
[
'id'
=>
'course_id'
])
->
select
(
'id,user_id,name,price,preview_pic'
)
->
with
(
'teachers'
);
}
}
}
}
src/common/models/Course.php
View file @
bd054262
...
@@ -187,6 +187,6 @@ class Course extends \yii\db\ActiveRecord
...
@@ -187,6 +187,6 @@ class Course extends \yii\db\ActiveRecord
*/
*/
public
function
getUser
()
public
function
getUser
()
{
{
return
$this
->
hasOne
(
User
::
className
(),
[
'id'
=>
'user_id'
]);
return
$this
->
hasOne
(
User
::
className
(),
[
'id'
=>
'user_id'
])
->
select
(
'id,username,role,avatar'
);
;
}
}
}
}
src/common/models/Favorite.php
View file @
bd054262
...
@@ -96,7 +96,7 @@ class Favorite extends \yii\db\ActiveRecord
...
@@ -96,7 +96,7 @@ class Favorite extends \yii\db\ActiveRecord
* @param $coursewareId
* @param $coursewareId
* @return array|null|ActiveRecord
* @return array|null|ActiveRecord
*/
*/
public
static
function
findByUserIdAndCourseId
(
$userId
,
$coursewareId
)
public
static
function
findByUserIdAndCourse
ware
Id
(
$userId
,
$coursewareId
)
{
{
return
self
::
find
()
->
select
(
'id,user_id,courseware_id,created_at'
)
return
self
::
find
()
->
select
(
'id,user_id,courseware_id,created_at'
)
->
where
(
"user_id=:user_id and courseware_id=:courseware_id"
,
[
':user_id'
=>
$userId
,
':courseware_id'
=>
$coursewareId
])
->
where
(
"user_id=:user_id and courseware_id=:courseware_id"
,
[
':user_id'
=>
$userId
,
':courseware_id'
=>
$coursewareId
])
...
@@ -109,6 +109,6 @@ class Favorite extends \yii\db\ActiveRecord
...
@@ -109,6 +109,6 @@ class Favorite extends \yii\db\ActiveRecord
*/
*/
public
function
getCourse
()
public
function
getCourse
()
{
{
return
$this
->
hasOne
(
Course
::
className
(),
[
'id'
=>
'course_id'
])
->
with
(
'teachers'
)
->
with
(
'user'
);
return
$this
->
hasOne
(
Course
::
className
(),
[
'id'
=>
'course_id'
])
->
with
(
'teachers'
)
->
with
(
'user'
)
->
select
(
'id,user_id,name,price,preview_pic'
)
;
}
}
}
}
src/common/models/Income.php
View file @
bd054262
...
@@ -74,17 +74,21 @@ class Income extends \yii\db\ActiveRecord
...
@@ -74,17 +74,21 @@ class Income extends \yii\db\ActiveRecord
];
];
}
}
/**
* @return $this
*/
public
function
getOrder
()
public
function
getOrder
()
{
{
return
$this
->
hasOne
(
Orders
::
className
(),
[
'id'
=>
'orders_id'
])
->
with
(
'user'
)
->
with
(
'course'
);
return
$this
->
hasOne
(
Orders
::
className
(),
[
'id'
=>
'orders_id'
])
->
with
(
'user'
)
->
with
(
'course'
);
}
}
//public function getUser()
/**
//{
* @param $userId
// return $this->hasOne(User::className(), ['id'=>'user_id'])->viaTable(Orders::tableName(), ['id'=>'orders_id'])
* @param int $page
// ->select('id,username,role,avatar');
* @param int $num
//}
* @param int $status
* @return array
*/
public
static
function
getIncomeListByUserId
(
$userId
,
$page
=
0
,
$num
=
10
,
$status
=
self
::
STATUS_NOT_SETTLED
)
public
static
function
getIncomeListByUserId
(
$userId
,
$page
=
0
,
$num
=
10
,
$status
=
self
::
STATUS_NOT_SETTLED
)
{
{
$where
=
[
'user_id'
=>
$userId
];
$where
=
[
'user_id'
=>
$userId
];
...
...
src/common/models/Orders.php
View file @
bd054262
...
@@ -4,6 +4,7 @@ namespace common\models;
...
@@ -4,6 +4,7 @@ namespace common\models;
use
Yii
;
use
Yii
;
use
yii\behaviors\TimestampBehavior
;
use
yii\behaviors\TimestampBehavior
;
use
yii\data\Pagination
;
use
yii\redis\ActiveRecord
;
use
yii\redis\ActiveRecord
;
/**
/**
...
@@ -98,11 +99,14 @@ class Orders extends \yii\db\ActiveRecord
...
@@ -98,11 +99,14 @@ class Orders extends \yii\db\ActiveRecord
//获取总数
//获取总数
$count
=
self
::
find
()
->
where
(
$condition
,
$params
)
->
count
();
$count
=
self
::
find
()
->
where
(
$condition
,
$params
)
->
count
();
$start
=
$page
*
$num
;
$start
=
$page
*
$num
;
$data
=
self
::
find
()
->
select
(
"
$tableA
.course_id,
$tableA
.created_at as purchased_time,
$tableB
.name,
$tableB
.price,
$tableB
.free_time,
$tableB
.intro,
$tableB
.preview_pic,
$tableB
.created_at"
)
$pagination
=
new
Pagination
([
'totalCount'
=>
$count
,
'pageSize'
=>
$num
,
'forcePageParam'
=>
FALSE
]);
->
where
(
$condition
,
$params
)
->
limit
(
$num
)
->
offset
(
$start
)
->
orderBy
(
"
$tableA
.created_at DESC"
)
->
join
(
'left join '
,
$tableB
,
"
$tableA
.course_id =
$tableB
.id"
)
->
asArray
()
->
all
();
$data
=
self
::
find
()
->
where
(
$condition
,
$params
)
->
limit
(
$num
)
->
offset
(
$start
)
->
orderBy
(
"
$tableA
.created_at DESC"
)
->
joinWith
(
'courseWithTeachers'
)
->
asArray
()
->
all
();
return
[
return
[
'count'
=>
$count
,
'count'
=>
$count
,
'data'
=>
$data
'data'
=>
$data
,
'pagination'
=>
$pagination
];
];
}
}
...
@@ -119,17 +123,26 @@ class Orders extends \yii\db\ActiveRecord
...
@@ -119,17 +123,26 @@ class Orders extends \yii\db\ActiveRecord
':course_id'
=>
$courseId
':course_id'
=>
$courseId
])
->
one
();
])
->
one
();
}
}
/**
* @return $this
*/
public
function
getUser
()
public
function
getUser
()
{
{
return
$this
->
hasOne
(
User
::
className
(),
[
'id'
=>
'user_id'
])
->
select
(
'id,username,telephone,role,avatar'
);
return
$this
->
hasOne
(
User
::
className
(),
[
'id'
=>
'user_id'
])
->
select
(
'id,username,telephone,role,avatar'
);
}
}
/**
* @return $this
*/
public
function
getCourse
()
public
function
getCourse
()
{
{
return
$this
->
hasOne
(
Course
::
className
(),
[
'id'
=>
'course_id'
])
->
select
(
'id,user_id,name,price,preview_pic'
);
return
$this
->
hasOne
(
Course
::
className
(),
[
'id'
=>
'course_id'
])
->
select
(
'id,user_id,name,price,preview_pic'
);
}
}
/**
* @return $this
*/
public
function
getCourseWithTeachers
()
public
function
getCourseWithTeachers
()
{
{
return
$this
->
hasOne
(
Course
::
className
(),
[
'id'
=>
'course_id'
])
->
select
(
'id,user_id,name,price,preview_pic'
)
->
with
(
'teachers'
);
return
$this
->
hasOne
(
Course
::
className
(),
[
'id'
=>
'course_id'
])
->
select
(
'id,user_id,name,price,preview_pic'
)
->
with
(
'teachers'
);
...
...
src/environments/dev/backend/web/index-test.php
View file @
bd054262
...
@@ -4,7 +4,13 @@
...
@@ -4,7 +4,13 @@
if
(
!
in_array
(
@
$_SERVER
[
'REMOTE_ADDR'
],
[
'127.0.0.1'
,
'::1'
]))
{
if
(
!
in_array
(
@
$_SERVER
[
'REMOTE_ADDR'
],
[
'127.0.0.1'
,
'::1'
]))
{
die
(
'You are not allowed to access this file.'
);
die
(
'You are not allowed to access this file.'
);
}
}
if
(
!
function_exists
(
'fnmatch'
))
{
function
fnmatch
(
$pattern
,
$string
)
{
return
preg_match
(
"#^"
.
strtr
(
preg_quote
(
$pattern
,
'#'
),
array
(
'\*'
=>
'.*'
,
'\?'
=>
'.'
))
.
"$#i"
,
$string
);
}
// end
}
// end if
defined
(
'YII_DEBUG'
)
or
define
(
'YII_DEBUG'
,
true
);
defined
(
'YII_DEBUG'
)
or
define
(
'YII_DEBUG'
,
true
);
defined
(
'YII_ENV'
)
or
define
(
'YII_ENV'
,
'test'
);
defined
(
'YII_ENV'
)
or
define
(
'YII_ENV'
,
'test'
);
...
...
src/environments/dev/backend/web/index.php
View file @
bd054262
<?php
<?php
defined
(
'YII_DEBUG'
)
or
define
(
'YII_DEBUG'
,
true
);
defined
(
'YII_DEBUG'
)
or
define
(
'YII_DEBUG'
,
true
);
defined
(
'YII_ENV'
)
or
define
(
'YII_ENV'
,
'dev'
);
defined
(
'YII_ENV'
)
or
define
(
'YII_ENV'
,
'dev'
);
if
(
!
function_exists
(
'fnmatch'
))
{
function
fnmatch
(
$pattern
,
$string
)
{
return
preg_match
(
"#^"
.
strtr
(
preg_quote
(
$pattern
,
'#'
),
array
(
'\*'
=>
'.*'
,
'\?'
=>
'.'
))
.
"$#i"
,
$string
);
}
// end
}
// end if
require
(
__DIR__
.
'/../../vendor/autoload.php'
);
require
(
__DIR__
.
'/../../vendor/autoload.php'
);
require
(
__DIR__
.
'/../../vendor/yiisoft/yii2/Yii.php'
);
require
(
__DIR__
.
'/../../vendor/yiisoft/yii2/Yii.php'
);
require
(
__DIR__
.
'/../../common/config/bootstrap.php'
);
require
(
__DIR__
.
'/../../common/config/bootstrap.php'
);
...
...
src/environments/dev/common/config/main-local.php
View file @
bd054262
<?php
<?php
return
[
return
[
// 'components' => [
'components'
=>
[
// 'db' => [
'cache'
=>
[
// 'class' => 'yii\db\Connection',
'class'
=>
'yii\redis\Cache'
,
// 'dsn' => 'mysql:host=localhost;dbname=yii2advanced',
'redis'
=>
[
// 'username' => 'root',
'hostname'
=>
'192.168.1.185'
,
// 'password' => '',
'port'
=>
6379
,
// 'charset' => 'utf8',
'database'
=>
0
,
// ],
]
// 'mailer' => [
],
// 'class' => 'yii\swiftmailer\Mailer',
'db'
=>
[
// 'viewPath' => '@common/mail',
'class'
=>
'yii\db\Connection'
,
// // send all mails to a file by default. You have to set
'dsn'
=>
'mysql:host=192.168.1.185;dbname=zuiketang'
,
// // 'useFileTransport' to false and configure a transport
'username'
=>
'root'
,
// // for the mailer to send real emails.
'password'
=>
'mysql123'
,
// 'useFileTransport' => true,
'charset'
=>
'utf8'
,
// ],
],
// ],
'redis'
=>
[
'class'
=>
'yii\redis\Connection'
,
'hostname'
=>
'192.168.1.185'
,
'port'
=>
6379
,
'database'
=>
0
,
],
'mailer'
=>
[
'class'
=>
'yii\swiftmailer\Mailer'
,
'viewPath'
=>
'@common/mail'
,
// send all mails to a file by default. You have to set
// 'useFileTransport' to false and configure a transport
// for the mailer to send real emails.
'useFileTransport'
=>
TRUE
,
],
'qiniu'
=>
[
'class'
=>
'common\components\Qiniu'
,
'accessKey'
=>
'n85SCPB9uO2v32az-3TRFsZCXwJu7YddyzLRYXg-'
,
'secretKey'
=>
'KDl3b7aLpj7n9YZ07lHGivVY4c_Q-0QSM0TZ_-XS'
,
'storages'
=>
[
'public'
=>
[
'bucket'
=>
'pp-classroom'
,
'fsizeLimit'
=>
pow
(
1024
,
2
)
*
5
,
//5MB
'mimeLimit'
=>
'image/jpeg;image/png;image/gif'
,
'url'
=>
'http://dev.qdn.pp.cc/'
],
'video'
=>
[
'bucket'
=>
'pp-classroom-private'
,
'fsizeLimit'
=>
pow
(
1024
,
3
)
*
2
,
//2GB
'mimeLimit'
=>
'video/*;flv-application/octet-stream'
,
'url'
=>
'http://oe9d6dr84.bkt.clouddn.com/'
]
]
]
],
];
];
src/environments/dev/common/config/params-local.php
View file @
bd054262
<?php
<?php
return
[
return
[
'adminEmail'
=>
'admin@example.com'
,
'supportEmail'
=>
'support@example.com'
,
'user.passwordResetTokenExpire'
=>
3600
,
'captchaId'
=>
'4d6ad870bf63a30be3d22c92925b04ca'
,
'privateKey'
=>
'a2ca5e5139d1f43ac4e1cd248f3e52e4'
,
'msg.host'
=>
'http://114.55.132.75:7893/sms.aspx'
,
'msg.userid'
=>
'78'
,
'msg.account'
=>
'276147613x'
,
'msg.password'
=>
'276147613'
,
'msg.signature'
=>
'【最课堂】'
,
'alipay'
=>
[
'partner'
=>
'2088701843067550'
,
'seller_id'
=>
'2088701843067550'
,
'key'
=>
'12vr33u4g314hytde3g81oao9dfdarm6'
,
'notify_url'
=>
'http://商户网址/create_direct_pay_by_user-PHP-UTF-8/notify_url.php'
,
'return_url'
=>
'http://商户网址/create_direct_pay_by_user-PHP-UTF-8/return_url.php'
,
'sign_type'
=>
strtoupper
(
'MD5'
),
'input_charset'
=>
strtolower
(
'utf-8'
),
'cacert'
=>
getcwd
()
.
'\\cacert.pem'
,
'transport'
=>
'http'
,
'payment_type'
=>
'1'
,
'service'
=>
'create_direct_pay_by_user'
,
],
// 'weixinpay'=>[
// 'appid'=>'wx180521eb22e9d7af',
// 'mchid'=>'1295461001',
// 'key'=>'ejg0l9phOAkp021qB54shz0Q8Tiscwzy',
// 'appsecret'=>'f20293c9548c469fb8b855fc98c4ef3c',
//
// ]
'weixinpay'
=>
[
'appid'
=>
'wx5714a24a60083b2a'
,
'mchid'
=>
'1399794002'
,
'key'
=>
'8934e7d15453e97507ef794cf7b0519d'
,
'appsecret'
=>
'7c18222c6ec31efa65d21606a629585d'
,
]
];
];
src/environments/dev/frontend/config/main-local.php
View file @
bd054262
...
@@ -6,6 +6,16 @@ $config = [
...
@@ -6,6 +6,16 @@ $config = [
// !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
// !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
'cookieValidationKey'
=>
'1o1zEUf8jdBvsnZy_JygPUO5_sZ7zBci'
,
'cookieValidationKey'
=>
'1o1zEUf8jdBvsnZy_JygPUO5_sZ7zBci'
,
],
],
'session'
=>
[
'timeout'
=>
3600
,
'name'
=>
'zuiektang-frontend'
,
'class'
=>
'yii\redis\Session'
,
'redis'
=>
[
'hostname'
=>
'192.168.1.185'
,
'port'
=>
6379
,
'database'
=>
0
,
]
],
],
],
];
];
...
...
src/environments/dev/frontend/web/index-test.php
View file @
bd054262
...
@@ -4,7 +4,13 @@
...
@@ -4,7 +4,13 @@
if
(
!
in_array
(
@
$_SERVER
[
'REMOTE_ADDR'
],
[
'127.0.0.1'
,
'::1'
]))
{
if
(
!
in_array
(
@
$_SERVER
[
'REMOTE_ADDR'
],
[
'127.0.0.1'
,
'::1'
]))
{
die
(
'You are not allowed to access this file.'
);
die
(
'You are not allowed to access this file.'
);
}
}
if
(
!
function_exists
(
'fnmatch'
))
{
function
fnmatch
(
$pattern
,
$string
)
{
return
preg_match
(
"#^"
.
strtr
(
preg_quote
(
$pattern
,
'#'
),
array
(
'\*'
=>
'.*'
,
'\?'
=>
'.'
))
.
"$#i"
,
$string
);
}
// end
}
// end if
defined
(
'YII_DEBUG'
)
or
define
(
'YII_DEBUG'
,
true
);
defined
(
'YII_DEBUG'
)
or
define
(
'YII_DEBUG'
,
true
);
defined
(
'YII_ENV'
)
or
define
(
'YII_ENV'
,
'test'
);
defined
(
'YII_ENV'
)
or
define
(
'YII_ENV'
,
'test'
);
...
...
src/environments/dev/frontend/web/index.php
View file @
bd054262
<?php
<?php
defined
(
'YII_DEBUG'
)
or
define
(
'YII_DEBUG'
,
true
);
defined
(
'YII_DEBUG'
)
or
define
(
'YII_DEBUG'
,
true
);
defined
(
'YII_ENV'
)
or
define
(
'YII_ENV'
,
'dev'
);
defined
(
'YII_ENV'
)
or
define
(
'YII_ENV'
,
'dev'
);
if
(
!
function_exists
(
'fnmatch'
))
{
function
fnmatch
(
$pattern
,
$string
)
{
return
preg_match
(
"#^"
.
strtr
(
preg_quote
(
$pattern
,
'#'
),
array
(
'\*'
=>
'.*'
,
'\?'
=>
'.'
))
.
"$#i"
,
$string
);
}
// end
}
// end if
require
(
__DIR__
.
'/../../vendor/autoload.php'
);
require
(
__DIR__
.
'/../../vendor/autoload.php'
);
require
(
__DIR__
.
'/../../vendor/yiisoft/yii2/Yii.php'
);
require
(
__DIR__
.
'/../../vendor/yiisoft/yii2/Yii.php'
);
require
(
__DIR__
.
'/../../common/config/bootstrap.php'
);
require
(
__DIR__
.
'/../../common/config/bootstrap.php'
);
...
...
src/frontend/config/main.php
View file @
bd054262
...
@@ -23,16 +23,6 @@ return [
...
@@ -23,16 +23,6 @@ return [
'yii\web\JqueryAsset'
=>
false
,
'yii\web\JqueryAsset'
=>
false
,
]
]
],
],
'session'
=>
[
'timeout'
=>
3600
,
'name'
=>
'zuiektang-frontend'
,
'class'
=>
'yii\redis\Session'
,
'redis'
=>
[
'hostname'
=>
'192.168.1.185'
,
'port'
=>
6379
,
'database'
=>
0
,
]
],
'user'
=>
[
'user'
=>
[
'identityClass'
=>
'common\models\User'
,
'identityClass'
=>
'common\models\User'
,
'enableAutoLogin'
=>
TRUE
,
'enableAutoLogin'
=>
TRUE
,
...
...
src/frontend/controllers/HomeController.php
View file @
bd054262
...
@@ -4,6 +4,7 @@ namespace frontend\controllers;
...
@@ -4,6 +4,7 @@ namespace frontend\controllers;
use
common\libs\alipay\AliPay
;
use
common\libs\alipay\AliPay
;
use
common\libs\WeixinPay
;
use
common\libs\WeixinPay
;
use
common\models\BrowseRecord
;
use
common\models\Classes
;
use
common\models\Classes
;
use
common\models\Comments
;
use
common\models\Comments
;
use
common\models\Course
;
use
common\models\Course
;
...
@@ -122,7 +123,7 @@ class HomeController extends \yii\web\Controller
...
@@ -122,7 +123,7 @@ class HomeController extends \yii\web\Controller
*/
*/
public
function
actionVideo
(
$courseId
)
public
function
actionVideo
(
$courseId
)
{
{
$coursewareInfo
=
Courseware
::
findOne
([
'id'
=>
$courseId
,
'status'
=>
Courseware
::
STATUS_OK
]);
$coursewareInfo
=
Courseware
::
findOne
([
'
course_
id'
=>
$courseId
,
'status'
=>
Courseware
::
STATUS_OK
]);
$course
=
Course
::
findOne
([
'id'
=>
$courseId
]);
$course
=
Course
::
findOne
([
'id'
=>
$courseId
]);
$teachers
=
$course
->
teachers
;
$teachers
=
$course
->
teachers
;
$userId
=
Yii
::
$app
->
user
->
id
;
$userId
=
Yii
::
$app
->
user
->
id
;
...
@@ -132,17 +133,18 @@ class HomeController extends \yii\web\Controller
...
@@ -132,17 +133,18 @@ class HomeController extends \yii\web\Controller
$coursewareInfo
=
$coursewareInfo
->
toArray
();
$coursewareInfo
=
$coursewareInfo
->
toArray
();
$coursewareInfo
[
'previewUrl'
]
=
Yii
::
$app
->
qiniu
->
getUrl
(
'public'
,
$course
->
preview_pic
);
$coursewareInfo
[
'previewUrl'
]
=
Yii
::
$app
->
qiniu
->
getUrl
(
'public'
,
$course
->
preview_pic
);
$coursewareInfo
[
'intro'
]
=
$course
->
intro
;
$coursewareInfo
[
'intro'
]
=
$course
->
intro
;
$coursewareInfo
[
'courseName'
]
=
$course
->
name
;
$coursewareInfo
[
'teachers'
]
=
ArrayHelper
::
toArray
(
$teachers
);
$coursewareInfo
[
'courseName'
]
=
$course
->
name
;
$coursewareInfo
[
'teachers'
]
=
ArrayHelper
::
toArray
(
$teachers
);
$coursewareInfo
[
'videoUrl'
]
=
Yii
::
$app
->
qiniu
->
getUrl
(
'video'
,
$coursewareInfo
[
'name'
]);
$coursewareInfo
[
'videoUrl'
]
=
Yii
::
$app
->
qiniu
->
getUrl
(
'video'
,
$coursewareInfo
[
'name'
]);
$coursewareInfo
[
'isGuest'
]
=
Yii
::
$app
->
user
->
isGuest
;
$coursewareInfo
[
'isGuest'
]
=
Yii
::
$app
->
user
->
isGuest
;
$coursewareInfo
[
'isSupport'
]
=
(
Support
::
findByUserIdAndCoursewareId
(
$userId
,
$course
Id
)
===
NULL
?
FALSE
:
TRUE
);
$coursewareInfo
[
'isSupport'
]
=
(
Support
::
findByUserIdAndCoursewareId
(
$userId
,
$course
wareInfo
[
'id'
]
)
===
NULL
?
FALSE
:
TRUE
);
$coursewareInfo
[
'isFavorite'
]
=
(
Favorite
::
findByUserIdAndCourse
Id
(
$userId
,
$courseId
)
===
NULL
?
FALSE
:
TRUE
);
$coursewareInfo
[
'isFavorite'
]
=
(
Favorite
::
findByUserIdAndCourse
wareId
(
$userId
,
$coursewareInfo
[
'id'
]
)
===
NULL
?
FALSE
:
TRUE
);
if
(
!
Yii
::
$app
->
user
->
isGuest
)
{
if
(
!
Yii
::
$app
->
user
->
isGuest
)
{
$coursewareInfo
[
'userAvatar'
]
=
User
::
getAvatarUrl
(
Yii
::
$app
->
user
->
identity
->
avatar
);
$coursewareInfo
[
'userAvatar'
]
=
User
::
getAvatarUrl
(
Yii
::
$app
->
user
->
identity
->
avatar
);
}
}
$coursewareInfo
[
'classId'
]
=
$course
->
class_id
;
$coursewareInfo
[
'classId'
]
=
$course
->
class_id
;
$coursewareInfo
[
'className'
]
=
Classes
::
findOne
([
'id'
=>
$course
->
class_id
])
->
name
;
$coursewareInfo
[
'className'
]
=
Classes
::
findOne
([
'id'
=>
$course
->
class_id
])
->
name
;
return
$this
->
render
(
'video'
,
[
return
$this
->
render
(
'video'
,
[
'coursewareInfo'
=>
$coursewareInfo
'coursewareInfo'
=>
$coursewareInfo
]);
]);
...
@@ -223,7 +225,7 @@ class HomeController extends \yii\web\Controller
...
@@ -223,7 +225,7 @@ class HomeController extends \yii\web\Controller
$courseware
=
Courseware
::
findOne
([
'id'
=>
$coursewareId
]);
$courseware
=
Courseware
::
findOne
([
'id'
=>
$coursewareId
]);
//数据不存在则异常
//数据不存在则异常
if
(
$courseware
!==
NULL
)
{
if
(
$courseware
!==
NULL
)
{
$favorite
=
Favorite
::
findByUserIdAndCourseId
(
$userId
,
$coursewareId
);
$favorite
=
Favorite
::
findByUserIdAndCourse
ware
Id
(
$userId
,
$coursewareId
);
if
(
$favorite
===
NULL
)
{
if
(
$favorite
===
NULL
)
{
$favorite
=
new
Favorite
();
$favorite
=
new
Favorite
();
$favorite
->
user_id
=
$userId
;
$favorite
->
user_id
=
$userId
;
...
@@ -295,9 +297,9 @@ class HomeController extends \yii\web\Controller
...
@@ -295,9 +297,9 @@ class HomeController extends \yii\web\Controller
$retData
=
[
$retData
=
[
'id'
=>
$comments
->
id
,
'id'
=>
$comments
->
id
,
'content'
=>
$content
,
'content'
=>
$content
,
'created_at'
=>
$comments
->
created_at
,
'created_at'
=>
$comments
->
created_at
,
'user_id'
=>
$userId
,
'user_id'
=>
$userId
,
'username'
=>
Yii
::
$app
->
user
->
identity
->
username
,
'username'
=>
Yii
::
$app
->
user
->
identity
->
username
,
'avatar'
=>
Yii
::
$app
->
user
->
identity
->
avatar
,
'avatar'
=>
Yii
::
$app
->
user
->
identity
->
avatar
,
];
];
}
else
{
}
else
{
...
@@ -321,6 +323,44 @@ class HomeController extends \yii\web\Controller
...
@@ -321,6 +323,44 @@ class HomeController extends \yii\web\Controller
}
}
}
}
/**
* 记录浏览记录
* @param $coursewareId
* @throws ForbiddenHttpException
*/
public
function
actionBrowseRecord
(
$coursewareId
)
{
if
(
Yii
::
$app
->
request
->
isAjax
)
{
$userId
=
Yii
::
$app
->
user
->
identity
->
getId
();
$courseware
=
Courseware
::
findOne
([
'id'
=>
$coursewareId
]);
if
(
$courseware
!==
NULL
)
{
$browseRecord
=
BrowseRecord
::
findByUserIdAndCoursewareId
(
$userId
,
$coursewareId
);
if
(
$browseRecord
===
NULL
)
{
$browseRecord
=
new
BrowseRecord
();
$browseRecord
->
user_id
=
$userId
;
$browseRecord
->
course_id
=
$courseware
->
course_id
;
$browseRecord
->
courseware_id
=
$courseware
->
id
;
$browseRecord
->
time
=
time
();
$result
=
$browseRecord
->
save
();
//统计数据
$courseware
->
play_count
++
;
$courseware
->
update
();
$course
=
Course
::
findOne
([
'id'
=>
$courseware
->
course_id
]);
$course
->
play_count
++
;
$course
->
update
();
}
else
{
$browseRecord
->
time
=
time
();
$result
=
$browseRecord
->
update
();
}
}
else
{
throw
new
InvalidParamException
(
'参数错误'
);
}
Utils
::
ajaxResponse
(
$result
);
}
else
{
throw
new
\yii\web\ForbiddenHttpException
(
'非法请求'
);
}
}
/**
/**
* 支付宝支付请求
* 支付宝支付请求
* @throws InvalidParamException
* @throws InvalidParamException
...
...
src/frontend/controllers/UserCenterController.php
View file @
bd054262
...
@@ -49,11 +49,6 @@ class UserCenterController extends Controller
...
@@ -49,11 +49,6 @@ class UserCenterController extends Controller
];
];
}
}
public
function
actionTest
()
{
$user
=
Yii
::
$app
->
user
->
identity
;
var_dump
(
$user
->
getBrowseRecords
());
}
/**
/**
* 个人信息页面
* 个人信息页面
...
@@ -77,10 +72,12 @@ class UserCenterController extends Controller
...
@@ -77,10 +72,12 @@ class UserCenterController extends Controller
public
function
actionPurchasedCourse
()
public
function
actionPurchasedCourse
()
{
{
$page
=
Yii
::
$app
->
request
->
get
(
'page'
,
0
);
$page
=
Yii
::
$app
->
request
->
get
(
'page'
,
0
);
$page
--
;
$num
=
Yii
::
$app
->
request
->
get
(
'num'
,
10
);
$num
=
Yii
::
$app
->
request
->
get
(
'num'
,
10
);
$purchasedCourse
=
Orders
::
findPurchasedCourseByUserId
(
Yii
::
$app
->
user
->
getId
(),
$page
,
$num
);
$purchasedCourse
=
Orders
::
findPurchasedCourseByUserId
(
Yii
::
$app
->
user
->
getId
(),
$page
,
$num
);
var_dump
(
$purchasedCourse
);
return
$this
->
render
(
'purchasedCourse'
,
[
return
$this
->
render
(
'purchasedCourse'
);
'purchasedCourse'
=>
$purchasedCourse
]);
}
}
/**
/**
...
@@ -94,7 +91,6 @@ class UserCenterController extends Controller
...
@@ -94,7 +91,6 @@ class UserCenterController extends Controller
$page
--
;
$page
--
;
$num
=
Yii
::
$app
->
request
->
get
(
'per-page'
,
10
);
$num
=
Yii
::
$app
->
request
->
get
(
'per-page'
,
10
);
$favorite
=
Favorite
::
findByUserId
(
Yii
::
$app
->
user
->
getId
(),
$page
,
$num
);
$favorite
=
Favorite
::
findByUserId
(
Yii
::
$app
->
user
->
getId
(),
$page
,
$num
);
// var_dump($favorite);exit;
return
$this
->
render
(
'favorite'
,
[
return
$this
->
render
(
'favorite'
,
[
'favorite'
=>
$favorite
'favorite'
=>
$favorite
]);
]);
...
@@ -106,8 +102,14 @@ class UserCenterController extends Controller
...
@@ -106,8 +102,14 @@ class UserCenterController extends Controller
*/
*/
public
function
actionBrowseRecord
()
public
function
actionBrowseRecord
()
{
{
$browseRecord
=
BrowseRecord
::
getByUserId
(
Yii
::
$app
->
user
->
getId
());
$page
=
Yii
::
$app
->
request
->
get
(
'page'
,
0
);
return
$this
->
render
(
'browseRecord'
);
$page
--
;
$num
=
Yii
::
$app
->
request
->
get
(
'per-page'
,
10
);
$browseRecord
=
BrowseRecord
::
findByUserId
(
Yii
::
$app
->
user
->
getId
(),
$page
,
$num
);
return
$this
->
render
(
'browseRecord'
,
[
'browseRecord'
=>
$browseRecord
]);
}
}
...
...
src/frontend/views/layouts/userCenter.php
View file @
bd054262
...
@@ -32,7 +32,7 @@ $this->beginContent('@app/views/layouts/center.php');
...
@@ -32,7 +32,7 @@ $this->beginContent('@app/views/layouts/center.php');
<li
<?=
(
Yii
::
$app
->
controller
->
id
===
'user-center'
and
Yii
::
$app
->
controller
->
action
->
id
===
'browse-record'
)
?
'class = "active"'
:
''
?>
>
<li
<?=
(
Yii
::
$app
->
controller
->
id
===
'user-center'
and
Yii
::
$app
->
controller
->
action
->
id
===
'browse-record'
)
?
'class = "active"'
:
''
?>
>
<a
href=
"
<?=
$baseUrl
.
'/user-center/browse-record'
?>
"
><i
class=
"glyphicon glyphicon-eye-open"
></i>
浏览记录
</a>
<a
href=
"
<?=
$baseUrl
.
'/user-center/browse-record'
?>
"
><i
class=
"glyphicon glyphicon-eye-open"
></i>
浏览记录
</a>
</li>
</li>
<li><a
href=
"
javascript:;
"
><i
class=
"glyphicon glyphicon-play-circle"
></i>
我的课堂
</a></li>
<li><a
href=
"
<?=
$baseUrl
.
'/my-course'
?>
"
><i
class=
"glyphicon glyphicon-play-circle"
></i>
我的课堂
</a></li>
<li><a
href=
"
<?=
$baseUrl
.
'/site/logout'
?>
"
><i
class=
"glyphicon glyphicon-off"
></i>
退出登录
</a></li>
<li><a
href=
"
<?=
$baseUrl
.
'/site/logout'
?>
"
><i
class=
"glyphicon glyphicon-off"
></i>
退出登录
</a></li>
</ul>
</ul>
...
...
src/frontend/views/user-center/browseRecord.php
View file @
bd054262
...
@@ -6,101 +6,62 @@
...
@@ -6,101 +6,62 @@
* Time: 上午9:59
* Time: 上午9:59
*/
*/
use
\frontend\assets\AppAsset
;
use
\frontend\assets\AppAsset
;
use
yii\widgets\LinkPager
;
$baseUrl
=
\yii\helpers\Url
::
base
();
$this
->
title
=
'浏览记录'
;
$this
->
title
=
'浏览记录'
;
\frontend\assets\AppAsset
::
addScript
(
$this
,
'@web/assets/user_center_browse_record.js'
)
\frontend\assets\AppAsset
::
addScript
(
$this
,
'@web/assets/user_center_browse_record.js'
)
?>
?>
<div
class=
"empty-data"
>
<?php
if
(
$browseRecord
[
'count'
]
>
0
)
:
?>
您还没购买任何课程!
<div
class=
"cls-list-box clearfix"
>
</div>
<?php
foreach
(
$browseRecord
[
'data'
]
as
$key
=>
$value
)
:
?>
<div
class=
"cls-list-box hide"
>
<div
class=
"col-md-4"
>
<div
class=
"col-md-4"
>
<div
class=
"cls-box-main sm-box"
>
<div
class=
"cls-box-main sm-box"
>
<div
class=
"video-img-box"
>
<div
class=
"video-img-box"
>
<img
src=
"
<?=
AppAsset
::
getStaticUrl
(
'img/videoimg.jpg'
)
?>
"
>
<img
src=
"
<?=
Yii
::
$app
->
qiniu
->
getUrl
(
'public'
,
$value
[
'course'
][
'preview_pic'
])
?>
"
>
<div
class=
"video-list-cnt"
>
<div
class=
"video-list-cnt"
>
<div
class=
"tit"
><a
href=
"#"
>
英国为什么比中国先进入工业时代?
</a></div>
<div
class=
"tit"
><a
href=
"
<?php
echo
$baseUrl
.
'/home/video?courseId='
.
$value
[
'course'
][
'id'
];
?>
"
>
<?=
$value
[
'course'
][
'name'
]
?>
</a></div>
<div
class=
"price"
>
¥182.97
</div>
<div
class=
"price"
>
<?=
$value
[
'course'
][
'price'
]
?>
</div>
</div>
<div
class=
"teacher"
>
<div
class=
"outline"
>
讲师:
<?php
foreach
(
$value
[
'course'
][
'teachers'
]
as
$teaKey
=>
$teaValue
)
:
?>
<span>
购买日期:2016年9月12日 16:02
</span>
<?php
if
(
$teaKey
>
0
)
:
?>
</div>
,
<?=
$teaValue
[
'name'
]
?>
<?php
else
:
?>
<?=
$teaValue
[
'name'
]
?>
<?php
endif
?>
<?php
endforeach
;
?>
</div>
</div>
<div
class=
"outline"
>
<span>
<?=
date
(
"Y-m-d H:i:s"
,
$value
[
'time'
])
?>
</span>
</div>
<div
class=
"play-mask"
>
<a
href=
"
<?php
echo
$baseUrl
.
'/home/video?courseId='
.
$value
[
'course'
][
'id'
];
?>
"
><i
class=
"glyphicon glyphicon-play"
></i></a>
</div>
<div
class=
"avatar"
><img
src=
"
<?=
AppAsset
::
getStaticUrl
(
'img/avatar2.jpg'
)
?>
"
></div>
<div
class=
"play-mask"
>
<a
href=
"#"
><i
class=
"glyphicon glyphicon-play"
></i></a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
endforeach
;
?>
<div
class=
"col-md-4"
>
<div
class=
"cls-box-main sm-box"
>
<div
class=
"video-img-box"
>
<img
src=
"
<?=
AppAsset
::
getStaticUrl
(
'img/videoimg.jpg'
)
?>
"
>
<div
class=
"video-list-cnt"
>
<div
class=
"tit"
><a
href=
"#"
>
英国为什么比中国先进入工业时代?
</a></div>
<div
class=
"price"
>
¥182.97
</div>
</div>
<div
class=
"outline"
>
<span>
购买日期:2016年9月12日 16:02
</span>
</div>
<div
class=
"avatar"
><img
src=
"
<?=
AppAsset
::
getStaticUrl
(
'img/avatar2.jpg'
)
?>
"
></div>
<div
class=
"play-mask"
>
<a
href=
"#"
><i
class=
"glyphicon glyphicon-play"
></i></a>
</div>
</div>
</div>
</div>
</div>
<div
class=
"col-md-4"
>
<div
class=
"container text-center"
>
<div
class=
"cls-box-main sm-box"
>
<?php
echo
LinkPager
::
widget
([
<div
class=
"video-img-box"
>
'pagination'
=>
$browseRecord
[
'pagination'
],
<img
src=
"
<?=
AppAsset
::
getStaticUrl
(
'img/videoimg.jpg'
)
?>
"
>
]);
?>
<div
class=
"video-list-cnt"
>
<div
class=
"tit"
><a
href=
"#"
>
英国为什么比中国先进入工业时代?
</a></div>
<div
class=
"price"
>
¥182.97
</div>
</div>
<div
class=
"outline"
>
<span>
购买日期:2016年9月12日 16:02
</span>
</div>
<div
class=
"avatar"
><img
src=
"
<?=
AppAsset
::
getStaticUrl
(
'img/avatar2.jpg'
)
?>
"
></div>
<div
class=
"play-mask"
>
<a
href=
"#"
><i
class=
"glyphicon glyphicon-play"
></i></a>
</div>
</div>
</div>
</div>
</div>
<?php
else
:
?>
<div
class=
"col-md-4"
>
<div
class=
"empty-data"
>
<div
class=
"cls-box-main sm-box"
>
您还没购买浏览课程!
<div
class=
"video-img-box"
>
<img
src=
"
<?=
AppAsset
::
getStaticUrl
(
'img/videoimg.jpg'
)
?>
"
>
<div
class=
"video-list-cnt"
>
<div
class=
"tit"
><a
href=
"#"
>
英国为什么比中国先进入工业时代?
</a></div>
<div
class=
"price"
>
¥182.97
</div>
</div>
<div
class=
"outline"
>
<span>
购买日期:2016年9月12日 16:02
</span>
</div>
<div
class=
"avatar"
><img
src=
"
<?=
AppAsset
::
getStaticUrl
(
'img/avatar2.jpg'
)
?>
"
></div>
<div
class=
"play-mask"
>
<a
href=
"#"
><i
class=
"glyphicon glyphicon-play"
></i></a>
</div>
</div>
</div>
</div>
</div>
<?php
endif
;
?>
<div
class=
"cls-list-box hide"
>
<div
class=
"col-md-4"
>
<div
class=
"col-md-4"
>
<div
class=
"cls-box-main sm-box"
>
<div
class=
"cls-box-main sm-box"
>
<div
class=
"video-img-box"
>
<div
class=
"video-img-box"
>
...
...
src/frontend/views/user-center/favorite.php
View file @
bd054262
...
@@ -14,15 +14,15 @@ $this->title = '收藏记录';
...
@@ -14,15 +14,15 @@ $this->title = '收藏记录';
?>
?>
<?php
if
(
$favorite
[
'count'
]
>
0
)
:?>
<div
class=
"cls-list-box clearfix"
>
<
div
class
="
cls
-
list
-
box
clearfix
">
<?php
foreach
(
$favorite
[
'data'
]
as
$key
=>
$value
)
:
?>
<?php foreach (
$favorite['data']
as
$key
=>
$value
): ?>
<div
class=
"col-md-4"
>
<div class="
col
-
md
-
4
">
<div
class=
"cls-box-main sm-box"
>
<div class="
cls
-
box
-
main
sm
-
box
">
<div
class=
"video-img-box"
>
<div class="
video
-
img
-
box
">
<img
src=
"
<?=
Yii
::
$app
->
qiniu
->
getUrl
(
'public'
,
$value
[
'course'
][
'preview_pic'
])
?>
"
>
<img src="
<?=
Yii
::
$app
->
qiniu
->
getUrl
(
'public'
,
$value
[
'course'
][
'preview_pic'
])
?>
">
<div
class=
"video-list-cnt"
>
<div
class=
"video-list-cnt"
>
<div
class=
"tit"
><a
href=
"
<?php
echo
$baseUrl
.
'/home/video?courseId='
.
$value
[
'course'
][
'id'
];
?>
"
>
<?=
$value
[
'course'
][
'name'
]
?>
</a></div>
<div
class=
"tit"
><a
href=
"
<?php
echo
$baseUrl
.
'/home/video?courseId='
.
$value
[
'course'
][
'id'
];
?>
"
>
<?=
$value
[
'course'
][
'name'
]
?>
</a></div>
<div
class=
"teacher"
>
<div
class=
"teacher"
>
讲师:
<?php
foreach
(
$value
[
'course'
][
'teachers'
]
as
$teaKey
=>
$teaValue
)
:
?>
讲师:
<?php
foreach
(
$value
[
'course'
][
'teachers'
]
as
$teaKey
=>
$teaValue
)
:
?>
<?php
if
(
$teaKey
>
0
)
:
?>
<?php
if
(
$teaKey
>
0
)
:
?>
...
@@ -32,27 +32,33 @@ $this->title = '收藏记录';
...
@@ -32,27 +32,33 @@ $this->title = '收藏记录';
<?php
endif
?>
<?php
endif
?>
<?php
endforeach
;
?>
<?php
endforeach
;
?>
</div>
</div>
<div
class=
"price"
>
<?=
$value
[
'course'
][
'price'
]
?>
</div>
<div
class=
"price"
>
<?=
$value
[
'course'
][
'price'
]
?>
</div>
</div>
</div>
<div
class=
"outline"
>
<div
class=
"outline"
>
<span>
<?=
$value
[
'course'
][
'user'
][
'username'
]
?>
收藏了该内容
</span>
<span>
<?=
$value
[
'course'
][
'user'
][
'username'
]
?>
收藏了该内容
</span>
</div>
</div>
<div
class=
"play-mask"
>
<div
class=
"play-mask"
>
<a
href=
"
<?php
echo
$baseUrl
.
'/home/video?courseId='
.
$value
[
'course'
][
'id'
];
?>
"
><i
class=
"glyphicon glyphicon-play"
></i></a>
<a
href=
"
<?php
echo
$baseUrl
.
'/home/video?courseId='
.
$value
[
'course'
][
'id'
];
?>
"
><i
class=
"glyphicon glyphicon-play"
></i></a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
endforeach
;
?>
<?php
endforeach
;
?>
</div>
</div>
<div
class=
"container text-center"
>
<?php
echo
LinkPager
::
widget
([
'pagination'
=>
$favorite
[
'pagination'
],
]);
?>
</div>
<?php
else
:?>
<
div
class
="
empty
-
data
">
您没有任何收藏记录!
</div>
<?php endif;?>
<div
class=
"container text-center"
>
<?php
echo
LinkPager
::
widget
([
'pagination'
=>
$favorite
[
'pagination'
],
]);
?>
</div>
src/frontend/views/user-center/purchasedCourse.php
View file @
bd054262
...
@@ -5,118 +5,58 @@
...
@@ -5,118 +5,58 @@
* Date: 2016/9/29
* Date: 2016/9/29
* Time: 上午9:59
* Time: 上午9:59
*/
*/
use
\frontend\assets\AppAsset
;
use
yii\widgets\LinkPager
;
$baseUrl
=
\yii\helpers\Url
::
base
();
$this
->
title
=
'已购课程'
;
$this
->
title
=
'已购课程'
;
\frontend\assets\AppAsset
::
addScript
(
$this
,
'@web/assets/user_center_purchased_course.js'
)
\frontend\assets\AppAsset
::
addScript
(
$this
,
'@web/assets/user_center_purchased_course.js'
)
?>
?>
<div
class=
"cls-list-box"
>
<div
class=
"col-md-4"
>
<div
class=
"cls-box-main sm-box"
>
<div
class=
"video-img-box"
>
<img
src=
"
<?=
AppAsset
::
getStaticUrl
(
'img/videoimg.jpg'
)
?>
"
>
<div
class=
"video-list-cnt"
>
<div
class=
"tit"
><a
href=
"#"
>
英国为什么比中国先进入工业时代?
</a></div>
<div
class=
"price"
>
¥182.97
</div>
</div>
<div
class=
"outline"
>
<span>
购买日期:2016年9月12日 16:02
</span>
</div>
<div
class=
"avatar"
><img
src=
"
<?=
AppAsset
::
getStaticUrl
(
'img/avatar2.jpg'
)
?>
"
></div>
<?php
if
(
$purchasedCourse
[
'count'
]
>
0
)
:?>
<
div
class
="
cls
-
list
-
box
clearfix
">
<div
class=
"play-mask"
>
<?php foreach (
$purchasedCourse['data']
as
$key
=>
$value
): ?>
<a
href=
"#"
><i
class=
"glyphicon glyphicon-play"
></i></a>
<div class="
col
-
md
-
4
">
<div class="
cls
-
box
-
main
sm
-
box
">
<div class="
video
-
img
-
box
">
<img src="
<?=
Yii
::
$app
->
qiniu
->
getUrl
(
'public'
,
$value
[
'courseWithTeachers'
][
'preview_pic'
])
?>
">
<div
class=
"video-list-cnt"
>
<div
class=
"tit"
><a
href=
"
<?php
echo
$baseUrl
.
'/home/video?courseId='
.
$value
[
'courseWithTeachers'
][
'id'
];
?>
"
>
<?=
$value
[
'courseWithTeachers'
][
'name'
]
?>
</a></div>
<div
class=
"price"
>
<?=
$value
[
'courseWithTeachers'
][
'price'
]
?>
</div>
<div
class=
"teacher"
>
讲师:
<?php
foreach
(
$value
[
'courseWithTeachers'
][
'teachers'
]
as
$teaKey
=>
$teaValue
)
:
?>
<?php
if
(
$teaKey
>
0
)
:
?>
,
<?=
$teaValue
[
'name'
]
?>
<?php
else
:
?>
<?=
$teaValue
[
'name'
]
?>
<?php
endif
?>
<?php
endforeach
;
?>
</div>
</div>
<div
class=
"outline"
>
<span>
购买日期:
<?=
date
(
"Y-m-d H:i:s"
,
$value
[
'updated_at'
])
?>
</span>
</div>
<div
class=
"play-mask"
>
<a
href=
"
<?php
echo
$baseUrl
.
'/home/video?courseId='
.
$value
[
'courseWithTeachers'
][
'id'
];
?>
"
><i
class=
"glyphicon glyphicon-play"
></i></a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div
class=
"col-md-4"
>
<div
class=
"cls-box-main sm-box"
>
<div
class=
"video-img-box"
>
<img
src=
"
<?=
AppAsset
::
getStaticUrl
(
'img/videoimg.jpg'
)
?>
"
>
<div
class=
"video-list-cnt"
>
<div
class=
"tit"
><a
href=
"#"
>
英国为什么比中国先进入工业时代?
</a></div>
<div
class=
"price"
>
¥182.97
</div>
</div>
<div
class=
"outline"
>
<span>
购买日期:2016年9月12日 16:02
</span>
</div>
<div
class=
"avatar"
><img
src=
"
<?=
AppAsset
::
getStaticUrl
(
'img/avatar2.jpg'
)
?>
"
></div>
<div
class=
"play-mask"
>
<a
href=
"#"
><i
class=
"glyphicon glyphicon-play"
></i></a>
</div>
</div>
</div>
</div>
<div
class=
"col-md-4"
>
<div
class=
"cls-box-main sm-box"
>
<div
class=
"video-img-box"
>
<img
src=
"
<?=
AppAsset
::
getStaticUrl
(
'img/videoimg.jpg'
)
?>
"
>
<div
class=
"video-list-cnt"
>
<div
class=
"tit"
><a
href=
"#"
>
英国为什么比中国先进入工业时代?
</a></div>
<div
class=
"price"
>
¥182.97
</div>
</div>
<div
class=
"outline"
>
<span>
购买日期:2016年9月12日 16:02
</span>
</div>
<div
class=
"avatar"
><img
src=
"
<?=
AppAsset
::
getStaticUrl
(
'img/avatar2.jpg'
)
?>
"
></div>
<div
class=
"play-mask"
>
<?php
endforeach
;
?>
<a
href=
"#"
><i
class=
"glyphicon glyphicon-play"
></i></a>
</div>
</div>
</div>
</div>
</div>
<div
class=
"container text-center"
>
<div
class=
"col-md-4"
>
<?php
echo
LinkPager
::
widget
([
<div
class=
"cls-box-main sm-box"
>
'pagination'
=>
$purchasedCourse
[
'pagination'
],
<div
class=
"video-img-box"
>
]);
?>
<img
src=
"
<?=
AppAsset
::
getStaticUrl
(
'img/videoimg.jpg'
)
?>
"
>
<div
class=
"video-list-cnt"
>
<div
class=
"tit"
><a
href=
"#"
>
英国为什么比中国先进入工业时代?
</a></div>
<div
class=
"price"
>
¥182.97
</div>
</div>
<div
class=
"outline"
>
<span>
购买日期:2016年9月12日 16:02
</span>
</div>
<div
class=
"avatar"
><img
src=
"
<?=
AppAsset
::
getStaticUrl
(
'img/avatar2.jpg'
)
?>
"
></div>
<div
class=
"play-mask"
>
<a
href=
"#"
><i
class=
"glyphicon glyphicon-play"
></i></a>
</div>
</div>
</div>
</div>
</div>
<div
class=
"col-md-4"
>
<?php
else
:?>
<div
class=
"cls-box-main sm-box"
>
<
div
class
="
empty
-
data
">
<div
class=
"video-img-box"
>
您没有任何购买记录!
<img
src=
"
<?=
AppAsset
::
getStaticUrl
(
'img/videoimg.jpg'
)
?>
"
>
<div
class=
"video-list-cnt"
>
<div
class=
"tit"
><a
href=
"#"
>
英国为什么比中国先进入工业时代?
</a></div>
<div
class=
"price"
>
¥182.97
</div>
</div>
<div
class=
"outline"
>
<span>
购买日期:2016年9月12日 16:02
</span>
</div>
<div
class=
"avatar"
><img
src=
"
<?=
AppAsset
::
getStaticUrl
(
'img/avatar2.jpg'
)
?>
"
></div>
<div
class=
"play-mask"
>
<a
href=
"#"
><i
class=
"glyphicon glyphicon-play"
></i></a>
</div>
</div>
</div>
</div>
</div>
<
/div
>
<
?php endif;?
>
src/frontend/web/js/home/video.js
View file @
bd054262
...
@@ -23,6 +23,17 @@ $("#main-login").attr('href', 'javascript:;').click(function () {
...
@@ -23,6 +23,17 @@ $("#main-login").attr('href', 'javascript:;').click(function () {
});
});
//记录浏览记录
var
url
=
__BASE_URL__
+
'home/browse-record?coursewareId='
+
coursewareInfo
.
id
;
$
.
getJSON
(
url
,
function
(
response
)
{
if
(
response
.
status
===
false
)
{
layer
.
alert
(
'浏览记录添加逻辑错误'
,
{
'icon'
:
2
,
'title'
:
'提示'
})
}
}).
error
(
function
()
{
layer
.
alert
(
'添加浏览记录错误'
,
{
'icon'
:
2
,
'title'
:
'提示'
})
});
var
href
=
$
(
'#main-sign'
).
attr
(
"href"
);
var
href
=
$
(
'#main-sign'
).
attr
(
"href"
);
$
(
'#main-sign'
).
attr
(
'href'
,
href
+
'?from='
+
coursewareInfo
.
user_id
);
$
(
'#main-sign'
).
attr
(
'href'
,
href
+
'?from='
+
coursewareInfo
.
user_id
);
new
Vue
({
new
Vue
({
...
...
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