Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenDocCN
yii2_fecshop
提交
7fa5d0bf
Y
yii2_fecshop
项目概览
OpenDocCN
/
yii2_fecshop
通知
17
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
yii2_fecshop
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
7fa5d0bf
编写于
12月 13, 2017
作者:
T
Terry
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
后台计算产品评论总数的bug处理
上级
8201ca85
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
35 addition
and
30 deletion
+35
-30
app/apphtml5/modules/Catalog/block/reviewproduct/Lists.php
app/apphtml5/modules/Catalog/block/reviewproduct/Lists.php
+24
-21
app/apphtml5/theme/base/html5/catalog/reviewproduct/lists.php
...apphtml5/theme/base/html5/catalog/reviewproduct/lists.php
+1
-1
app/appserver/modules/Catalog/block/reviewproduct/Lists.php
app/appserver/modules/Catalog/block/reviewproduct/Lists.php
+7
-7
services/product/Review.php
services/product/Review.php
+3
-1
未找到文件。
app/apphtml5/modules/Catalog/block/reviewproduct/Lists.php
浏览文件 @
7fa5d0bf
...
...
@@ -48,16 +48,16 @@ class Lists
protected
function
getProductPage
(
$countTotal
)
{
if
(
$countTotal
<=
$this
->
numPerPage
)
{
echo
"
$countTotal
<=
$this->numPerPage
"
;
//
echo "$countTotal <= $this->numPerPage";
return
''
;
}
$config
=
[
'class'
=>
'fecshop\app\apphtml5\widgets\Page'
,
'view'
=>
'widgets/page.php'
,
'pageNum'
=>
$this
->
pageNum
,
'numPerPage'
=>
$this
->
numPerPage
,
'countTotal'
=>
$countTotal
,
'page'
=>
$this
->
_page
,
'class'
=>
'fecshop\app\apphtml5\widgets\Page'
,
'view'
=>
'widgets/page.php'
,
'pageNum'
=>
$this
->
pageNum
,
'numPerPage'
=>
$this
->
numPerPage
,
'countTotal'
=>
$countTotal
,
'page'
=>
$this
->
_page
,
];
return
Yii
::
$service
->
page
->
widget
->
renderContent
(
'category_product_page'
,
$config
);
...
...
@@ -106,17 +106,17 @@ class Lists
return
[
'_id'
=>
$this
->
product_id
,
'spu'
=>
$this
->
spu
,
'review_count'
=>
$review_count
,
'reviw_rate_star_average'
=>
$reviw_rate_star_average
,
'pageToolBar'
=>
$pageToolBar
,
'coll'
=>
$coll
,
'noActiveStatus'
=>
Yii
::
$service
->
product
->
review
->
noActiveStatus
(),
'addReviewUrl'
=>
$addReviewUrl
,
'name'
=>
$name
,
'price_info'
=>
$price_info
,
'main_img'
=>
$main_img
,
'editForm'
=>
$editForm
,
'url'
=>
Yii
::
$service
->
url
->
getUrl
(
$url_key
),
'review_count'
=>
$review_count
,
'reviw_rate_star_average'
=>
$reviw_rate_star_average
,
'pageToolBar'
=>
$pageToolBar
,
'coll'
=>
$coll
,
'noActiveStatus'
=>
Yii
::
$service
->
product
->
review
->
noActiveStatus
(),
'addReviewUrl'
=>
$addReviewUrl
,
'name'
=>
$name
,
'price_info'
=>
$price_info
,
'main_img'
=>
$main_img
,
'editForm'
=>
$editForm
,
'url'
=>
Yii
::
$service
->
url
->
getUrl
(
$url_key
),
];
}
}
...
...
@@ -127,21 +127,24 @@ class Lists
public
function
getReviewsBySpu
(
$spu
)
{
$currentIp
=
\
fec\helpers\CFunc
::
get_real_ip
();
$lang_code
=
Yii
::
$service
->
store
->
currentLangCode
;
$filter
=
[
'numPerPage'
=>
$this
->
numPerPage
,
'pageNum'
=>
$this
->
pageNum
,
'numPerPage'
=>
$this
->
numPerPage
,
'pageNum'
=>
$this
->
pageNum
,
'orderBy'
=>
[
$this
->
filterOrderBy
=>
SORT_DESC
],
'where'
=>
[
'where'
=>
[
[
'$or'
=>
[
[
'status'
=>
Yii
::
$service
->
product
->
review
->
activeStatus
(),
'product_spu'
=>
$spu
,
'lang_code'
=>
$lang_code
],
[
'status'
=>
Yii
::
$service
->
product
->
review
->
noActiveStatus
(),
'product_spu'
=>
$spu
,
'ip'
=>
$currentIp
,
'lang_code'
=>
$lang_code
],
],
],
...
...
app/apphtml5/theme/base/html5/catalog/reviewproduct/lists.php
浏览文件 @
7fa5d0bf
...
...
@@ -51,7 +51,7 @@
<span
class=
"average_rating"
>
<?=
Yii
::
$service
->
page
->
translate
->
__
(
'Average rating :'
);
?>
</span>
<span
class=
"review_star review_star_
<?=
$reviw_rate_star_average
?>
"
style=
"font-weight:bold;"
itemprop=
"average"
></span>
<a
rel=
"nofollow"
href=
"
<?=
Yii
::
$service
->
url
->
getUrl
(
'catalog/reviewproduct/lists'
,[
'spu'
=>
$spu
,
'_id'
=>
$_id
]);
?>
"
>
<a
external
rel=
"nofollow"
href=
"
<?=
Yii
::
$service
->
url
->
getUrl
(
'catalog/reviewproduct/lists'
,[
'spu'
=>
$spu
,
'_id'
=>
$_id
]);
?>
"
>
(
<span
itemprop=
"count"
>
<?=
$review_count
?>
<?=
Yii
::
$service
->
page
->
translate
->
__
(
'reviews'
);
?>
</span>
)
</a>
</span>
...
...
app/appserver/modules/Catalog/block/reviewproduct/Lists.php
浏览文件 @
7fa5d0bf
...
...
@@ -26,7 +26,7 @@ class Lists
public
$numPerPage
=
20
;
public
$pageNum
;
/**
*
为了可以使用rewriteMap,use 引入的文件统一采用下面的方式,通过Yii::mapGet()得到className和O
bject
*
为了可以使用rewriteMap,use 引入的文件统一采用下面的方式,通过Yii::mapGet()得到className和Object
*/
protected
$_reviewHelperName
=
'\fecshop\app\apphtml5\modules\Catalog\helpers\Review'
;
protected
$_reviewHelper
;
...
...
@@ -34,16 +34,16 @@ class Lists
public
function
__construct
()
{
/**
*
通过Yii::mapGet() 得到重写后的class类名以及对象。Yii::mapGet是在文件@fecshop\yii\Yii.php中
*
通过Yii::mapGet() 得到重写后的class类名以及对象。Yii::mapGet是在文件@fecshop\yii\Yii.php中
*/
list
(
$this
->
_reviewHelperName
,
$this
->
_reviewHelper
)
=
Yii
::
mapGet
(
$this
->
_reviewHelperName
);
//
初始化服务
//
初始化服务
$reviewHelper
=
$this
->
_reviewHelper
;
$reviewHelper
::
initReviewConfig
();
}
/**
* @property $countTotal | Int
*
得到toolbar的分页部分
*
得到toolbar的分页部分
*/
protected
function
getProductPage
(
$countTotal
)
{
...
...
@@ -61,7 +61,7 @@ class Lists
return
Yii
::
$service
->
page
->
widget
->
renderContent
(
'category_product_page'
,
$config
);
}
//
初始化参数
//
初始化参数
public
function
initParam
()
{
$this
->
pageNum
=
Yii
::
$app
->
request
->
get
(
$this
->
_page
);
...
...
@@ -130,7 +130,7 @@ class Lists
}
/**
* @property $spu | String
*
通过spu得到产品评论
*
通过spu得到产品评论
*/
public
function
getReviewsBySpu
(
$spu
)
{
...
...
@@ -158,7 +158,7 @@ class Lists
return
Yii
::
$service
->
product
->
review
->
getListBySpu
(
$filter
);
}
//
产品价格信息
//
产品价格信息
protected
function
getProductPriceInfo
(
$product
)
{
$price
=
$product
[
'price'
];
...
...
services/product/Review.php
浏览文件 @
7fa5d0bf
...
...
@@ -360,7 +360,7 @@ class Review extends Service
}
}
}
/**
* @property $spu | String
* 当评论保存,更新评论的总数,平均评分信息到产品表的所有spu
...
...
@@ -369,6 +369,8 @@ class Review extends Service
{
$reviewModel
=
$this
->
_reviewModel
;
$filter
=
[
'numPerPage'
=>
10000
,
// mongodb 查询,numPerPage必须设置,如果不设置,默认为20
'pageNum'
=>
1
,
'where'
=>
[
[
'product_spu'
=>
$spu
],
[
'status'
=>
$reviewModel
->
getActiveStatus
()],
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录