Authored by hf

code review by hf: merge zhangzhen code to fixes home floor bugs

... ... @@ -32,7 +32,7 @@ class DetailModel
if (is_numeric($productId) && is_numeric($goodsId)) {
// 调用服务
$baseInfo = DetailData::baseInfo($productId, $uid);
// 判断商品是否在架
if (empty($baseInfo['status'])) {
return $result;
... ... @@ -41,7 +41,7 @@ class DetailModel
// 商品名称
if (isset($baseInfo['productName'])) {
$result['goodsName'] = $baseInfo['productName'];
}
}
// 商品标签
if (!empty($baseInfo['productTagBoList'])) {
... ... @@ -87,11 +87,11 @@ class DetailModel
}
}
// 上市期
if (isset($baseInfo['expectArrivalTime']) && !empty($baseInfo['expectArrivalTime'])) {
$result['periodOfMarket'] = date('n', $baseInfo['expectArrivalTime']) . '月';
}
// 上市期
if (isset($baseInfo['expectArrivalTime']) && !empty($baseInfo['expectArrivalTime'])) {
$result['periodOfMarket'] = date('n', $baseInfo['expectArrivalTime']) . '月';
}
// 促销信息
if (isset($baseInfo['promotionBoList'])) {
$build = array();
... ... @@ -103,7 +103,7 @@ class DetailModel
}
$result['feedbacks'] = array();
// 商品咨询
$result['feedbacks']['consultsNum'] = 0;
if (!empty($baseInfo['consultBoWrapper'])) {
... ... @@ -117,12 +117,12 @@ class DetailModel
$result['feedbacks']['consults'][] = $build;
}
$result['feedbacks']['link'] = Helpers::url('/product/detail/consults', array('product_id' => $productId, 'total' => $result['feedbacks']['consultsNum']));
}
}
// 暂无咨询
else {
$result['feedbacks']['link'] = Helpers::url('/product/detail/consultform', array('product_id' => $productId));
}
// 商品评价
$result['feedbacks']['commentsNum'] = 0;
if (!empty($baseInfo['commentBoWrapper'])) {
... ... @@ -159,7 +159,7 @@ class DetailModel
$colorId = intval($value['colorId']);
// 商品按颜色进行分类分组
foreach ($value['goodsImagesList'] as $goods) {
$goodsList[ $goods['goodsId'] ] = $colorId;
$goodsList[$goods['goodsId']] = $colorId;
$goodsGroup[$colorId][] = array(
'goodsId' => $goods['goodsId'],
'img' => $goods['imageUrl'],
... ... @@ -172,14 +172,14 @@ class DetailModel
}
// 商品的尺码列表
foreach ($value['goodsSizeBoList'] as $size) {
$sizeGroup[ $colorId ] = array(
$sizeGroup[$colorId] = array(
'sizeName' => $size['sizeName'],
'sizeSku' => $size['goodsSizeSkuId'],
'sizeStorage' => $size['goodsSizeStorageNum'],
);
}
}
// 商品图
$goodsId = intval($goodsId);
if (isset($goodsList[$goodsId])) {
... ... @@ -207,13 +207,13 @@ class DetailModel
'numInCart' => 0,
'goodsInstore' => $baseInfo['storage'],
);
// 是否收藏
$result['isCollect'] = false;
if (isset($baseInfo['isCollect']) && $baseInfo['isCollect'] === 'Y') {
$result['isCollect'] = true;
}
// 底部简介的URL链接
$result['introUrl'] = Helpers::url('/product/intro_' . $baseInfo['erpProductId'] . '/' . $baseInfo['cnAlphabet'] . '.html');
$result['id'] = $productId;
... ... @@ -231,11 +231,11 @@ class DetailModel
public static function getSizeInfo($productSkn)
{
$result = array();
if (is_numeric($productSkn)) {
// 调用服务
$sizeInfo = DetailData::sizeInfo($productSkn);
// 商品信息
if (isset($sizeInfo['productDescBo']['erpProductId'])) {
$sex = '通用';
... ... @@ -249,7 +249,7 @@ class DetailModel
}
$result['goodsDescription'] = array(
'title' => '商品信息',
'enTitle' => 'DESCRIPTION',
'enTitle' => 'DESCRIPTION',
'detail' => array(
'list' => array(
array('param' => '编号:' . $sizeInfo['productDescBo']['erpProductId']),
... ... @@ -267,7 +267,7 @@ class DetailModel
if (isset($sizeInfo['phrase'])) {
$result['goodsDescription']['desc'] = $sizeInfo['phrase'];
}
// 尺码信息
if (!empty($sizeInfo['sizeInfoBo'])) {
$result['sizeInfo'] = array(
... ... @@ -275,25 +275,25 @@ class DetailModel
'enTitle' => 'SIZE INFO',
'detail' => array('list' => array()),
);
$sizeNameList = array(0 => array('param' => '吊牌尺码')) ; // 尺码名称
$sizeNameList = array(0 => array('param' => '吊牌尺码')); // 尺码名称
$sizeBoGroup = array(); // 尺码按ID分组
foreach ($sizeInfo['sizeInfoBo']['sizeAttributeBos'] as $attr) {
$sizeBoGroup[ $attr['id'] ][0] = array('param' => $attr['attributeName']);
$sizeBoGroup[$attr['id']][0] = array('param' => $attr['attributeName']);
}
foreach ($sizeInfo['sizeInfoBo']['sizeBoList'] as $value) {
$sizeNameList[] = array('param' => $value['sizeName']);
foreach ($value['sortAttributes'] as $attr) {
$sizeBoGroup[ $attr['id'] ][] = array('param' => $attr['sizeValue']);
$sizeBoGroup[$attr['id']][] = array('param' => $attr['sizeValue']);
}
}
// 根据模板页面的显示,按表格一列一列来显示
$result['sizeInfo']['detail']['list'][0]['params'] = $sizeNameList;
foreach ($sizeBoGroup as $value) {
$result['sizeInfo']['detail']['list'][]['params'] = $value;
}
}
// 测量方式
if (!empty($sizeInfo['sizeImage'])) {
$result['measurementMethod'] = array(
... ... @@ -302,7 +302,7 @@ class DetailModel
'img' => $sizeInfo['sizeImage'],
);
}
// 模特试穿, 竖着输出排列显示
if (!empty($sizeInfo['modelBos'])) {
$result['reference'] = array(
... ... @@ -310,11 +310,11 @@ class DetailModel
'enTitle' => 'REFERENCE',
'detail' => array('list' => array()),
);
// 控制是否显示备注
$showRemark = false;
$remarkList = array(0 => array('param' => '备注'));
$result['reference']['detail']['list'][0]['params'] = array(0 => array('param' => '')); // 头像列表
$result['reference']['detail']['list'][1]['params'] = array(0 => array('param' => '模特')); // 模特名字列表
$result['reference']['detail']['list'][2]['params'] = array(0 => array('param' => '身高')); // 身高列表
... ... @@ -322,7 +322,7 @@ class DetailModel
$result['reference']['detail']['list'][4]['params'] = array(0 => array('param' => '三围')); // 三围列表
$result['reference']['detail']['list'][5]['params'] = array(0 => array('param' => '吊牌尺码')); // 吊牌尺码
$result['reference']['detail']['list'][6]['params'] = array(0 => array('param' => '试穿描述')); // 试穿描述
foreach ($sizeInfo['modelBos'] as $value) {
$result['reference']['detail']['list'][0]['params'][] = array('param' => $value['avatar']);
$result['reference']['detail']['list'][1]['params'][] = array('param' => $value['modelName']);
... ... @@ -338,13 +338,13 @@ class DetailModel
$remarkList[] = array('param' => '');
}
}
// 显示模特备注
if ($showRemark) {
$result['reference']['detail']['list'][7]['params'] = $remarkList;
}
}
// 商品材质
if (!empty($sizeInfo['productMaterialList'])) {
$result['materials'] = array(
... ... @@ -359,7 +359,7 @@ class DetailModel
);
}
}
// 洗涤提示
if (!empty($sizeInfo['washTipsBoList'])) {
$result['washTips']['list'] = array();
... ... @@ -384,7 +384,6 @@ class DetailModel
);
}
}
}
return $result;
... ... @@ -396,7 +395,7 @@ class DetailModel
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)) {
... ... @@ -410,10 +409,10 @@ class DetailModel
}
}
}
return $result;
}
/**
* 获取咨询列表
*
... ... @@ -425,7 +424,7 @@ class DetailModel
public static function getConsults($productId, $pageNum = 1, $pageSize = 100)
{
$result = array();
if (is_numeric($productId) && is_numeric($pageNum) && is_numeric($pageSize)) {
$consultList = DetailData::consultList($productId, $pageNum, $pageSize);
if (!empty($consultList)) {
... ... @@ -439,10 +438,10 @@ class DetailModel
}
$consultList = array();
}
return $result;
}
/**
* 获取为你优选的商品
*
... ... @@ -452,7 +451,7 @@ class DetailModel
public static function getPreference($productSkn)
{
$result = array();
if (is_numeric($productSkn)) {
$preference = DetailData::preference($productSkn);
if (!empty($preference['data'])) {
... ... @@ -461,8 +460,8 @@ class DetailModel
}
}
}
return $result;
}
}
... ...