Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHO-ACTIVITY-PHP
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
hf
9 years ago
Commit
2bc75780033a41c34a59a99ccad92307965459b9
1 parent
01e3b32d
fixes bug to product detail page comments
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
42 deletions
library/LibModels/Wap/Product/DetailData.php
template/m.yohobuy.com/actions/product/detail/consults.phtml
yohobuy/m.yohobuy.com/application/models/Product/Detail.php
yohobuy/m.yohobuy.com/application/modules/Product/controllers/Detail.php
library/LibModels/Wap/Product/DetailData.php
View file @
2bc7578
...
...
@@ -20,6 +20,7 @@ class DetailData
const
PRODUCT_BASE_INFO
=
'product/queryProductDetailByProductId'
;
const
PRODUCT_SIZE_INFO
=
'product/queryProductIntroBySkn'
;
const
PRODUCT_CONSULT_LIST
=
'consult/queryConsults'
;
const
PRODUCT_COMMENT_LIST
=
'sns/comments/commentList'
;
/**
* 商品基本信息
...
...
@@ -63,6 +64,23 @@ class DetailData
)
);
}
/**
* 评论内容列表
*
* @param int $productId 产品ID
* @param int $pageNum 页码数
* @param int $pageSize 每页显示个数
* @return array
*/
public
static
function
commentList
(
$productId
,
$pageNum
,
$pageSize
)
{
return
Yohobuy
::
jsonPost
(
Yohobuy
::
API_URL_PRODUCTDETAIL
.
self
::
PRODUCT_COMMENT_LIST
,
array
(
'productId'
=>
intval
(
$productId
),
'pageNum'
=>
intval
(
$pageNum
),
'pageSize'
=>
intval
(
$pageSize
),
)
);
}
/**
* 为你优选的商品列表
*
...
...
template/m.yohobuy.com/actions/product/detail/consults.phtml
View file @
2bc7578
...
...
@@ -3,7 +3,7 @@
<div
class=
"goto-consult"
>
<i
class=
"iconfont consult-logo"
>
639
;</i>
<span>我要咨询</span>
<a
href=
"
/consultform
"
class=
"iconfont enter-consult-page"
>
604
;</a>
<a
href=
"
{{consultUrl}}
"
class=
"iconfont enter-consult-page"
>
604
;</a>
</div>
{
{#
consults
}
}
<div
class=
"goods-consults"
id=
"goods-consults"
>
...
...
yohobuy/m.yohobuy.com/application/models/Product/Detail.php
View file @
2bc7578
...
...
@@ -361,9 +361,25 @@ class DetailModel
/**
* 获取评价列表
*/
public
static
function
getComments
()
public
static
function
getComments
(
$productId
,
$pageNum
=
1
,
$pageSize
=
100
)
{
$result
=
array
();
if
(
is_numeric
(
$productId
)
&&
is_numeric
(
$pageNum
)
&&
is_numeric
(
$pageSize
))
{
$commentList
=
DetailData
::
commentList
(
$productId
,
$pageNum
,
$pageSize
);
if
(
!
empty
(
$commentList
))
{
$build
=
array
();
foreach
(
$commentList
as
$value
)
{
$build
[
'userName'
]
=
''
;
$build
[
'desc'
]
=
''
;
$build
[
'content'
]
=
''
;
$build
[
'time'
]
=
''
;
$result
[]
=
$build
;
}
}
}
return
$result
;
}
/**
...
...
@@ -406,7 +422,7 @@ class DetailModel
$result
=
array
();
if
(
is_numeric
(
$productSkn
))
{
$preference
=
DetailData
::
preference
(
$productSkn
);
var_dump
(
$preference
);
exit
;
$preference
=
DetailData
::
preference
(
$productSkn
);
if
(
!
empty
(
$preference
[
'data'
]))
{
foreach
(
$preference
[
'data'
]
as
$value
)
{
$result
[
'recommendList'
][]
=
Helpers
::
formatProduct
(
$value
,
false
,
true
,
true
,
299
,
388
,
false
,
false
);
...
...
yohobuy/m.yohobuy.com/application/modules/Product/controllers/Detail.php
View file @
2bc7578
<?php
use
Action\AbstractAction
;
use
Plugin\Helpers
;
/**
* 商品详情的控制器
...
...
@@ -66,6 +67,7 @@ class DetailController extends AbstractAction
*/
public
function
commentsAction
()
{
$productId
=
$this
->
get
(
'product_id'
,
0
);
$total
=
$this
->
get
(
'total'
);
if
(
!
is_numeric
(
$total
))
{
$total
=
0
;
...
...
@@ -81,29 +83,7 @@ class DetailController extends AbstractAction
'goodsCommentsPage'
=>
true
,
'pageFooter'
=>
true
,
'comments'
=>
array
(
'list'
=>
array
(
array
(
'userName'
=>
'Lynnic'
,
'desc'
=>
'购买了白色Mate7'
,
'content'
=>
'活动时买的,挺超值。上身效果也不错。质量
很好,买送人的,很满意。而且物流相当给...'
,
'time'
=>
'2014-08-12 10:24:26'
),
array
(
'userName'
=>
'Lynnic'
,
'desc'
=>
'购买了白色Mate7'
,
'content'
=>
'活动时买的,挺超值。上身效果也不错。质量
很好,买送人的,很满意。而且物流相当给...'
,
'time'
=>
'2014-08-12 10:24:26'
),
array
(
'userName'
=>
'Lynnic'
,
'desc'
=>
'购买了白色Mate7'
,
'content'
=>
'活动时买的,挺超值。上身效果也不错。质量
很好,买送人的,很满意。而且物流相当给...'
,
'time'
=>
'2014-08-12 10:24:26'
)
)
'list'
=>
\Product\DetailModel
::
getConsults
(
$productId
),
),
);
...
...
@@ -136,7 +116,8 @@ class DetailController extends AbstractAction
'pageFooter'
=>
true
,
'consults'
=>
array
(
'list'
=>
\Product\DetailModel
::
getConsults
(
$productId
),
)
),
'consultUrl'
=>
Helpers
::
url
(
'/product/detail/consultform'
),
);
// 渲染模板
...
...
@@ -148,19 +129,11 @@ class DetailController extends AbstractAction
*/
public
function
consultformAction
()
{
$data
=
array
(
'consultform'
=>
true
,
'pageHeader'
=>
array
(
'navBack'
=>
'sss '
,
// 'navHome' => 'sss ',
'navTitle'
=>
'我要咨询'
)
);
$this
->
setTitle
(
'我要咨询'
);
$this
->
setNavHeader
(
'我要咨询'
);
$this
->
_view
->
assign
(
'title'
,
'我要咨询'
);
//$this->_view->display('brand', compact('brands'));
// 渲染模板
$this
->
_view
->
display
(
'consultform'
,
$data
);
$this
->
_view
->
display
(
'consultform'
,
array
(
'consultform'
=>
true
)
);
}
/**
...
...
@@ -173,10 +146,10 @@ class DetailController extends AbstractAction
{
$result
=
array
();
//if ($this->isAjax()) {
$productSkn
=
$this
->
get
(
'productSkn'
,
50000058
);
$result
=
\Product\DetailModel
::
getPreference
(
$productSkn
);
var_dump
(
$result
);
//}
if
(
$this
->
isAjax
())
{
$productSkn
=
$this
->
get
(
'productSkn'
);
// 50000058
$result
=
\Product\DetailModel
::
getPreference
(
$productSkn
);
}
if
(
empty
(
$result
))
{
echo
' '
;
...
...
Please
register
or
login
to post a comment