...
|
...
|
@@ -3,6 +3,7 @@ |
|
|
namespace Product;
|
|
|
|
|
|
use LibModels\Wap\Product\DetailData;
|
|
|
use Plugin\DataProcess\CouponFloorProcess;
|
|
|
use Plugin\Helpers;
|
|
|
use Plugin\Images;
|
|
|
|
...
|
...
|
@@ -41,7 +42,7 @@ class DetailModel |
|
|
elseif (is_numeric($productSkn)) {
|
|
|
$baseInfo = DetailData::baseInfo(null, $uid, $productSkn);
|
|
|
}
|
|
|
// print_r($baseInfo);
|
|
|
// print_r($baseInfo);
|
|
|
// 商品名称
|
|
|
if (empty($baseInfo['productName'])) {
|
|
|
return $result;
|
...
|
...
|
@@ -51,7 +52,7 @@ class DetailModel |
|
|
|
|
|
// 用户未登录时
|
|
|
if (empty($uid)) {
|
|
|
$result['loginUrl'] = Helpers::url('/signin.html', array('refer' => Helpers::url('/product/show_' . $baseInfo['erpProductId'] . '.html')));
|
|
|
$result['loginUrl'] = Helpers::url('/signin.html', array('refer' => Helpers::url('/product/show_' . $baseInfo['erpProductId']. '.html')));
|
|
|
}
|
|
|
|
|
|
// 商品促销短语
|
...
|
...
|
@@ -166,11 +167,19 @@ class DetailModel |
|
|
|
|
|
// 品牌信息
|
|
|
if (!empty($baseInfo['brand'])) {
|
|
|
$result['enterStore'] = array(
|
|
|
'img' => Helpers::getImageUrl($baseInfo['brand']['brandIco'], 47, 47),
|
|
|
'storeName' => $baseInfo['brand']['brandName'],
|
|
|
'url' => Helpers::url('', array(), $baseInfo['brand']['brandDomain'])
|
|
|
);
|
|
|
// $result['enterStore'] = array(
|
|
|
// 'img' => Helpers::getImageUrl($baseInfo['brand']['brandIco'], 47, 47),
|
|
|
// 'storeName' => $baseInfo['brand']['brandName'],
|
|
|
// 'url' => Helpers::url('', array(), $baseInfo['brand']['brandDomain'])
|
|
|
// );
|
|
|
$shops = DetailData::queryShopsByBrandId($baseInfo['brand']['id']);
|
|
|
if ($shops['code'] === 200) {
|
|
|
foreach ($shops['data'] as $key => $shop) {
|
|
|
$result['enterStore'][$key]['img'] = Helpers::getImageUrl($shop['brand_ico'], 47, 47);
|
|
|
$result['enterStore'][$key]['storeName'] = $shop['brand_name'];
|
|
|
$result['enterStore'][$key]['url'] = Helpers::url('/product/index/brand', array('shop_id' => $shop['shop_id']));
|
|
|
}
|
|
|
}
|
|
|
// 为你优选的链接
|
|
|
$result['preferenceUrl'] = Helpers::url('/product/detail/preference', array('productSkn' => $baseInfo['erpProductId'], 'brandId' => $baseInfo['brand']['id']), '');
|
|
|
}
|
...
|
...
|
@@ -209,11 +218,11 @@ class DetailModel |
|
|
}
|
|
|
|
|
|
// 商品的尺码列表
|
|
|
$colorStorageGroup[$value['productSkc']] = array();
|
|
|
$colorStorageGroup[ $value['productSkc'] ] = array();
|
|
|
if (isset($value['goodsSizeBoList']) && !empty($value['goodsSizeBoList'])) {
|
|
|
$sizeName = '';
|
|
|
foreach ($value['goodsSizeBoList'] as $size) {
|
|
|
$sizeList[$value['productSkc']][] = array(
|
|
|
$sizeList[ $value['productSkc'] ][] = array(
|
|
|
'id' => $size['id'],
|
|
|
'skuId' => $size['goodsSizeSkuId'],
|
|
|
'goodsId' => $size['goodsId'],
|
...
|
...
|
@@ -224,9 +233,11 @@ class DetailModel |
|
|
$sizeName = $size['sizeName'];
|
|
|
|
|
|
// 所有尺码列表,赋值用于前端展示默认尺码的时候 判断出没有库存则显示灰色
|
|
|
$allSizeList[$sizeName] = empty($allSizeList[$sizeName]['storage']) ? array('storage' => $size['goodsSizeStorageNum'], 'id' => $size['id']) : $allSizeList[$sizeName];
|
|
|
$allSizeList[$sizeName] = empty($allSizeList[$sizeName]['storage'])
|
|
|
? array('storage' => $size['goodsSizeStorageNum'], 'id' => $size['id'])
|
|
|
: $allSizeList[$sizeName];
|
|
|
$colorStorageNum += intval($size['goodsSizeStorageNum']);
|
|
|
$colorStorageGroup[$value['productSkc']][$sizeName] = intval($size['goodsSizeStorageNum']);
|
|
|
$colorStorageGroup[ $value['productSkc'] ][$sizeName] = intval($size['goodsSizeStorageNum']);
|
|
|
}
|
|
|
|
|
|
// 颜色分组
|
...
|
...
|
@@ -258,23 +269,23 @@ class DetailModel |
|
|
|
|
|
// 各个颜色的尺码, 每行显示一个尺码对应的颜色
|
|
|
foreach ($colorList as $colorArr) {
|
|
|
$colorArr['colorNum'] = isset($colorStorageGroup[$colorArr['skcId']][$sizeName]) ? $colorStorageGroup[$colorArr['skcId']][$sizeName] : 0;
|
|
|
$colorArr['colorNum'] = isset($colorStorageGroup[ $colorArr['skcId'] ][$sizeName]) ? $colorStorageGroup[ $colorArr['skcId'] ][$sizeName] : 0;
|
|
|
$colorGroup[$i]['color'][] = $colorArr;
|
|
|
}
|
|
|
$colorGroup[$i]['id'] = $value['id'];
|
|
|
|
|
|
++$i;
|
|
|
++ $i;
|
|
|
}
|
|
|
// 遍历所有颜色, 构建尺码显示数据
|
|
|
$i = 1;
|
|
|
foreach ($colorList as $value) {
|
|
|
// 各个尺码的颜色,每行显示一个颜色的对应尺码
|
|
|
$sizeGroup[$i]['size'] = $sizeList[$value['skcId']];
|
|
|
$sizeGroup[$i]['size'] = $sizeList[ $value['skcId'] ];
|
|
|
$sizeGroup[$i]['colorId'] = $value['skcId'];
|
|
|
// 默认颜色
|
|
|
$colorGroup[0]['color'][] = $value;
|
|
|
|
|
|
++$i;
|
|
|
++ $i;
|
|
|
}
|
|
|
|
|
|
// 商品图: 多个
|
...
|
...
|
@@ -331,8 +342,7 @@ class DetailModel |
|
|
$result['cartInfo']['limitProductCode'] = $baseInfo['limitProductCode'];
|
|
|
$result['cartInfo']['limitCodeUrl'] = self::getLimitCodeUrl($baseInfo['limitProductCode'], $baseInfo['erpProductId']);
|
|
|
$result['cartInfo']['limitProductPay'] = Helpers::url('/cart/index/orderEnsure');
|
|
|
}
|
|
|
else {
|
|
|
} else {
|
|
|
$result['cartInfo']['addToCartUrl'] = Helpers::url('/product/buy_' . $productId . '_' . $goodsId . '.html');
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -427,11 +437,9 @@ class DetailModel |
|
|
$referenceName = '参考尺码';
|
|
|
if (($gender == 1 && $boyReference) || ($gender == 2 && $girlReference)) {
|
|
|
$referenceName = '参考尺码';
|
|
|
}
|
|
|
elseif ($gender == 3 && $boyReference) {
|
|
|
} elseif ($gender == 3 && $boyReference) {
|
|
|
$referenceName = '参考尺码(男)';
|
|
|
}
|
|
|
elseif ($gender == 3 && $girlReference) {
|
|
|
} elseif ($gender == 3 && $girlReference) {
|
|
|
$referenceName = '参考尺码(女)';
|
|
|
}
|
|
|
|
...
|
...
|
@@ -454,11 +462,9 @@ class DetailModel |
|
|
$sizeNameList[] = array('param' => $value['sizeName']);
|
|
|
if ($boyReference && ($gender == 1 || $gender == 3)) {
|
|
|
$referenceList[] = array('param' => empty($value['boyReferSize']['referenceName']) ? ' ' : $value['boyReferSize']['referenceName']);
|
|
|
}
|
|
|
elseif ($girlReference && ($gender == 2 || $gender == 3)) {
|
|
|
} elseif ($girlReference && ($gender == 2 || $gender == 3)) {
|
|
|
$referenceList[] = array('param' => empty($value['girlReferSize']['referenceName']) ? ' ' : $value['girlReferSize']['referenceName']);
|
|
|
}
|
|
|
else {
|
|
|
} else {
|
|
|
$showReference = false;
|
|
|
}
|
|
|
foreach ($value['sortAttributes'] as $attr) {
|
...
|
...
|
@@ -474,8 +480,7 @@ class DetailModel |
|
|
foreach ($sizeBoGroup as $value) {
|
|
|
$result['sizeInfo']['detail']['list'][]['params'] = $value;
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
} else {
|
|
|
$result['sizeInfo']['detail']['list'][0]['params'] = array(0 => array('param' => ''));
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -520,8 +525,7 @@ class DetailModel |
|
|
if (!empty($value['fitModelBo']['fit_remark'])) {
|
|
|
$showRemark = true;
|
|
|
$remarkList[] = array('param' => $value['fitModelBo']['fit_remark']);
|
|
|
}
|
|
|
else {
|
|
|
} else {
|
|
|
$remarkList[] = array('param' => '');
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -693,8 +697,7 @@ class DetailModel |
|
|
$result['code'] = $record['code'];
|
|
|
$result['message'] = $record['message'];
|
|
|
}
|
|
|
}
|
|
|
while (false);
|
|
|
} while (false);
|
|
|
|
|
|
return $result;
|
|
|
}
|
...
|
...
|
@@ -726,8 +729,7 @@ class DetailModel |
|
|
$result['code'] = $record['code'];
|
|
|
$result['message'] = $record['message'];
|
|
|
}
|
|
|
}
|
|
|
while (false);
|
|
|
} while (false);
|
|
|
|
|
|
return $result;
|
|
|
}
|
...
|
...
|
@@ -759,6 +761,7 @@ class DetailModel |
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取限购商品详情
|
|
|
*
|
...
|
...
|
@@ -800,11 +803,10 @@ class DetailModel |
|
|
$result['attaches'][] = self::procLimitProductAttach($item);
|
|
|
}
|
|
|
|
|
|
if (count($result['attaches']) > 1) {
|
|
|
if(count($result['attaches']) > 1) {
|
|
|
Helpers::sortArrByField($result['attaches'], 'orderBy', true);
|
|
|
}
|
|
|
}
|
|
|
while (false);
|
|
|
} while (false);
|
|
|
|
|
|
return $result;
|
|
|
}
|
...
|
...
|
@@ -819,7 +821,7 @@ class DetailModel |
|
|
{
|
|
|
$result = array();
|
|
|
|
|
|
switch (intval($attachment['attachType'])) {
|
|
|
switch(intval($attachment['attachType'])) {
|
|
|
case 1: // 大图文字
|
|
|
$result['img'] = array(
|
|
|
'attachUrl' => Helpers::getImageUrl($attachment['attachUrl'], 750, ''),
|
...
|
...
|
@@ -857,15 +859,14 @@ class DetailModel |
|
|
*/
|
|
|
private static function procShowStatus(&$data, $showStatus, $isBeginSale)
|
|
|
{
|
|
|
switch ($showStatus) {
|
|
|
switch($showStatus) {
|
|
|
case 1: // 开售前/后,立即分享获得限购码(用户未领取限购码)
|
|
|
// 显示获取限购码按钮
|
|
|
$data['canGetLimitCode'] = true;
|
|
|
|
|
|
if ($isBeginSale) { // 开售后
|
|
|
$data['cartInfo']['noLimitCode'] = true;
|
|
|
}
|
|
|
else {
|
|
|
} else {
|
|
|
$data['cartInfo']['limitNotForSale'] = true;
|
|
|
}
|
|
|
break;
|
...
|
...
|
|