...
|
...
|
@@ -3,6 +3,7 @@ |
|
|
namespace Product;
|
|
|
|
|
|
use LibModels\Wap\Product\DetailData;
|
|
|
use Plugin\DataProcess\CouponFloorProcess;
|
|
|
use Plugin\Helpers;
|
|
|
use Plugin\Images;
|
|
|
|
...
|
...
|
@@ -36,8 +37,7 @@ class DetailModel |
|
|
// 通过ID获取
|
|
|
if (is_numeric($productId) && is_numeric($goodsId)) {
|
|
|
$baseInfo = DetailData::baseInfo($productId, $uid);
|
|
|
}
|
|
|
// 通过SKN获取
|
|
|
} // 通过SKN获取
|
|
|
elseif (is_numeric($productSkn)) {
|
|
|
$baseInfo = DetailData::baseInfo(null, $uid, $productSkn);
|
|
|
}
|
...
|
...
|
@@ -50,7 +50,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')));
|
|
|
}
|
|
|
|
|
|
// 商品促销短语
|
...
|
...
|
@@ -137,8 +137,7 @@ class DetailModel |
|
|
$result['feedbacks']['consults'][] = $build;
|
|
|
}
|
|
|
$result['feedbacks']['consultsUrl'] = Helpers::url('/product/detail/consults', array('product_id' => $productId, 'total' => $result['feedbacks']['consultsNum']));
|
|
|
}
|
|
|
// 暂无咨询
|
|
|
} // 暂无咨询
|
|
|
else {
|
|
|
$result['feedbacks']['consultsUrl'] = Helpers::url('/product/detail/consultform', array('product_id' => $productId));
|
|
|
}
|
...
|
...
|
@@ -161,16 +160,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'])
|
|
|
);
|
|
|
// foreach ($baseInfo['brand'] as $key => $brand) {
|
|
|
// $result['enterStore'][$key]['img'] = Helpers::getImageUrl($brand['brandIco'], 47, 47);
|
|
|
// $result['enterStore'][$key]['storeName'] = $brand['brandName'];
|
|
|
// $result['enterStore'][$key]['url'] = Helpers::url('', array(), $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 +211,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'],
|
...
|
...
|
@@ -225,10 +227,10 @@ class DetailModel |
|
|
|
|
|
// 所有尺码列表,赋值用于前端展示默认尺码的时候 判断出没有库存则显示灰色
|
|
|
$allSizeList[$sizeName] = empty($allSizeList[$sizeName]['storage'])
|
|
|
? array('storage' => $size['goodsSizeStorageNum'], 'id' => $size['id'])
|
|
|
: $allSizeList[$sizeName];
|
|
|
? 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']);
|
|
|
}
|
|
|
|
|
|
// 颜色分组
|
...
|
...
|
@@ -260,23 +262,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;
|
|
|
}
|
|
|
|
|
|
// 商品图: 多个
|
...
|
...
|
@@ -286,8 +288,7 @@ class DetailModel |
|
|
'img' => Helpers::getImageUrl($value['img'], 450, 600)
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
// 商品图: 单个
|
|
|
} // 商品图: 单个
|
|
|
elseif (isset($goodsGroup[0])) {
|
|
|
$result['bannerTop'] = array(
|
|
|
'img' => Helpers::getImageUrl($goodsGroup[0]['img'], 450, 600)
|
...
|
...
|
@@ -336,12 +337,10 @@ class DetailModel |
|
|
} else {
|
|
|
$result['cartInfo']['addToCartUrl'] = Helpers::url('/product/buy_' . $productId . '_' . $goodsId . '.html');
|
|
|
}
|
|
|
}
|
|
|
// 非卖品
|
|
|
} // 非卖品
|
|
|
elseif ($notForSale) {
|
|
|
$result['cartInfo']['notForSale'] = true;
|
|
|
}
|
|
|
// 已售磬
|
|
|
} // 已售磬
|
|
|
elseif ($soldOut) {
|
|
|
$result['cartInfo']['soldOut'] = true;
|
|
|
}
|
...
|
...
|
@@ -436,7 +435,7 @@ class DetailModel |
|
|
|
|
|
$referenceList = array();
|
|
|
// 判断是否显示参考尺码
|
|
|
$showReference = ($boyReference && !empty($sizeInfo['sizeInfoBo']['sizeBoList'][0]['boyReferSize'])) || ($girlReference && !empty($sizeInfo['sizeInfoBo']['sizeBoList'][0]['girlReferSize']) );
|
|
|
$showReference = ($boyReference && !empty($sizeInfo['sizeInfoBo']['sizeBoList'][0]['boyReferSize'])) || ($girlReference && !empty($sizeInfo['sizeInfoBo']['sizeBoList'][0]['girlReferSize']));
|
|
|
if ($showReference) {
|
|
|
$referenceList[0] = array('param' => $referenceName);
|
|
|
}
|
...
|
...
|
@@ -794,7 +793,7 @@ 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);
|
...
|
...
|
@@ -812,7 +811,7 @@ class DetailModel |
|
|
{
|
|
|
$result = array();
|
|
|
|
|
|
switch(intval($attachment['attachType'])) {
|
|
|
switch (intval($attachment['attachType'])) {
|
|
|
case 1: // 大图文字
|
|
|
$result['img'] = array(
|
|
|
'attachUrl' => Helpers::getImageUrl($attachment['attachUrl'], 750, ''),
|
...
|
...
|
@@ -850,7 +849,7 @@ class DetailModel |
|
|
*/
|
|
|
private static function procShowStatus(&$data, $showStatus, $isBeginSale)
|
|
|
{
|
|
|
switch($showStatus) {
|
|
|
switch ($showStatus) {
|
|
|
case 1: // 开售前/后,立即分享获得限购码(用户未领取限购码)
|
|
|
// 显示获取限购码按钮
|
|
|
$data['canGetLimitCode'] = true;
|
...
|
...
|
|