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
0a74c6f9
Commit
0a74c6f9
authored
Nov 01, 2016
by
xiabin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
收藏记录显示问题
parent
1e8209de
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
13 deletions
+21
-13
Favorite.php
src/common/models/Favorite.php
+1
-1
favorite.php
src/frontend/views/user-center/favorite.php
+20
-12
No files found.
src/common/models/Favorite.php
View file @
0a74c6f9
...
...
@@ -108,6 +108,6 @@ class Favorite extends \yii\db\ActiveRecord
*/
public
function
getCourse
()
{
return
$this
->
hasOne
(
Course
::
className
(),
[
'id'
=>
'course_id'
])
->
with
(
'teachers'
)
->
with
(
'user'
)
->
select
(
'id,user_id,name,price,preview_pic'
);
return
$this
->
hasOne
(
Course
::
className
(),
[
'id'
=>
'course_id'
])
->
with
(
'teachers'
)
->
with
(
'user'
)
->
select
(
'id,user_id,name,price,preview_pic
,favorite_count
'
);
}
}
src/frontend/views/user-center/favorite.php
View file @
0a74c6f9
...
...
@@ -10,34 +10,42 @@ use yii\widgets\LinkPager;
$baseUrl
=
\yii\helpers\Url
::
base
();
$this
->
title
=
'收藏记录'
;
\frontend\assets\AppAsset
::
addScript
(
$this
,
'@web/assets/user_favorite.js'
)
\frontend\assets\AppAsset
::
addScript
(
$this
,
'@web/assets/user_favorite.js'
);
?>
<?php
if
(
$favorite
[
'count'
]
>
0
)
:
?>
<?php
if
(
$favorite
[
'count'
]
>
0
)
:
?>
<div
class=
"cls-list-box clearfix"
>
<?php
foreach
(
$favorite
[
'data'
]
as
$key
=>
$value
)
:
?>
<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
[
'course'
][
'preview_pic'
]
.
'-m.preview'
)
?>
">
<img
src=
"
<?=
Yii
::
$app
->
qiniu
->
getUrl
(
'public'
,
$value
[
'course'
][
'preview_pic'
]
.
'-m.preview'
)
?>
"
>
<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"
>
讲师:
<?php
foreach
(
$value
[
'course'
][
'teachers'
]
as
$teaKey
=>
$teaValue
)
:
?>
<?php
if
(
$teaKey
>
0
)
:
?>
,
<?=
$teaValue
[
'name'
]
?>
,
<?=
$teaValue
[
'name'
]
?>
<?php
else
:
?>
<?=
$teaValue
[
'name'
]
?>
<?=
$teaValue
[
'name'
]
?>
<?php
endif
?>
<?php
endforeach
;
?>
</div>
<div
class=
"teacher"
>
售价:¥
<?=
$value
[
'course'
][
'price'
]
?>
</div>
<div
class=
"teacher"
><b>
<?=
$value
[
'course'
][
'user'
][
'username'
]
?>
收藏了该内容
</b></div>
<div
class=
"teacher"
>
售价:¥
<?=
$value
[
'course'
][
'price'
]
?>
</div>
<?php
if
(
$value
[
'course'
][
'favorite_count'
]
==
1
)
:
?>
<div
class=
"teacher"
><b>
独具慧眼,仅有你收藏了该内容
</b></div>
<?php
else
:
?>
<div
class=
"teacher"
><b>
还有
<?php
echo
$value
[
'course'
][
'favorite_count'
]
?>
人和您品味相投
</b>
</div>
<?php
endif
;
?>
</div>
<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>
...
...
@@ -53,8 +61,8 @@ $this->title = '收藏记录';
'pagination'
=>
$favorite
[
'pagination'
],
]);
?>
</div>
<?php
else
:?>
<?php
else
:
?>
<div
class=
"empty-data"
>
您没有任何收藏记录!
</div>
<?php endif;?>
<?php
endif
;
?>
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