...
|
...
|
@@ -18,10 +18,10 @@ class ItemModel |
|
|
* @var array
|
|
|
*/
|
|
|
private static $multiResources = array();
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取商品信息
|
|
|
*
|
|
|
*
|
|
|
* @param string $productId
|
|
|
* @param string $goodsId
|
|
|
* @param string $uid
|
...
|
...
|
@@ -29,7 +29,7 @@ class ItemModel |
|
|
* @param string $productSkn
|
|
|
* @return array
|
|
|
*/
|
|
|
public static function getProductInfo($productId, $goodsId, $uid, $vipLevel = 0, $productSkn = null)
|
|
|
public static function getProductInfo($productId, $goodsId, $uid, $vipLevel = 0, $productSkn = null)
|
|
|
{
|
|
|
$goodsInfo = array();
|
|
|
$statGoodsInfo = array();
|
...
|
...
|
@@ -58,7 +58,7 @@ class ItemModel |
|
|
|
|
|
// 商品标签
|
|
|
$goodsInfo['tags'] = self::getTagsDataByProductInfo($baseInfo);
|
|
|
|
|
|
|
|
|
// 商品促销短语
|
|
|
if (!empty($baseInfo['salesPhrase'])) {
|
|
|
$goodsInfo['saleTip'] = $baseInfo['salesPhrase'];
|
...
|
...
|
@@ -79,12 +79,12 @@ class ItemModel |
|
|
$goodsInfo['hasOtherPrice'] = false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
//VIP数据
|
|
|
$goodsInfo['vipPrice'] = self::getVipDataByProductBaseInfo($baseInfo, $vipLevel, $uid);
|
|
|
//促销活动banner
|
|
|
$goodsInfo['activity'] = self::getActivityDataByProductBaseInfo($baseInfo);
|
|
|
|
|
|
|
|
|
if (isset($baseInfo['productPriceBo']['yohoCoinNum']) && $baseInfo['productPriceBo']['yohoCoinNum'] !== 0) {
|
|
|
array_push($goodsInfo['activity'],
|
|
|
array('type' => '返YOHO币', 'des' => '每件返 ' . $baseInfo['productPriceBo']['yohoCoinNum'] . '个 YOHO币')
|
...
|
...
|
@@ -98,7 +98,7 @@ class ItemModel |
|
|
unset($goodsInfo['salePrice']);
|
|
|
$goodsInfo['hasOtherPrice'] = false;
|
|
|
}
|
|
|
|
|
|
|
|
|
//商品咨询和评论数据
|
|
|
$consultComment = self::getConsultCommentDataByProductInfo($baseInfo);
|
|
|
// 品牌信息
|
...
|
...
|
@@ -111,13 +111,13 @@ class ItemModel |
|
|
$banner['isCollect'] = $favoriteData['brand'];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
//sku商品信息
|
|
|
$skuData = self::getSkuDataByProductBaseInfo($baseInfo);
|
|
|
$goodsInfo['img'] = $skuData['defaultImage'];
|
|
|
$goodsInfo['colors'] = $skuData['skuGoods'];
|
|
|
$totalStorageNum = $skuData['totalStorageNum'];
|
|
|
|
|
|
|
|
|
// 是否收藏
|
|
|
$goodsInfo['isCollect'] = $favoriteData['product'];
|
|
|
// 限购商品
|
...
|
...
|
@@ -129,7 +129,7 @@ class ItemModel |
|
|
if (isset($baseInfo['showStatus'])) {
|
|
|
$showStatus = intval($baseInfo['showStatus']);
|
|
|
}
|
|
|
|
|
|
|
|
|
$fashTopGoods = self::getFashionTopGoodsStatus($uid, $showStatus, $isBeginSale);
|
|
|
//潮流尖货状态
|
|
|
$goodsInfo['fashionTopGoods'] = array(
|
...
|
...
|
@@ -147,7 +147,7 @@ class ItemModel |
|
|
$goodsInfo['buyNow'] = $fashTopGoods['buyNow'];//是否立即购买
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
$soldOut = $baseInfo['status'] == 0 || $totalStorageNum === 0;
|
|
|
$notForSale = $baseInfo['attribute'] == 2;//非卖品
|
|
|
$virtualGoods = $baseInfo['attribute'] == 3;//虚拟商品
|
...
|
...
|
@@ -182,13 +182,13 @@ class ItemModel |
|
|
if(isset($goodsInfo['tags']['isFew'])) {
|
|
|
unset($goodsInfo['tags']['isFew']);//去掉即将售罄
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//分享相关
|
|
|
$goodsInfo['weixinUrl'] = Helpers::url($_SERVER['REQUEST_URI'], array(),'item');
|
|
|
$goodsInfo['sharedTitle'] = $goodsInfo['name'];
|
|
|
$goodsInfo['shareImg'] = $goodsInfo['img'];
|
|
|
$goodsInfo['shareDesc'] = $baseInfo['phrase'];
|
|
|
|
|
|
|
|
|
//统计需要的商品信息
|
|
|
$statGoodsInfo['uid'] = $uid;
|
|
|
$statGoodsInfo['skn'] = $baseInfo['erpProductId'];
|
...
|
...
|
@@ -206,11 +206,11 @@ class ItemModel |
|
|
$domainBrand = BrandsModel::getBrandByDomain($banner['brandDomain']);
|
|
|
if (!empty($domainBrand['type'])) {
|
|
|
switch (intval($domainBrand['type'])) {
|
|
|
case 1:
|
|
|
case 1:
|
|
|
//多品店不显示
|
|
|
$banner = array();
|
|
|
break;
|
|
|
case 2:
|
|
|
case 2:
|
|
|
if (empty($domainBrand['shopId'])) {
|
|
|
break;
|
|
|
}
|
...
|
...
|
@@ -229,22 +229,22 @@ class ItemModel |
|
|
$statGoodsInfo['soldOut'] = intval($soldOut);
|
|
|
return array('goodsInfo'=> $goodsInfo,'consultComment' => $consultComment, 'banner'=> $banner,'statGoodsInfo' => $statGoodsInfo);
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 商品尺码信息
|
|
|
*
|
|
|
*
|
|
|
* @param string $productSkn
|
|
|
* @param int $maxSortId
|
|
|
* @return array
|
|
|
*/
|
|
|
public static function getSizeInfo($productSkn, $maxSortId)
|
|
|
public static function getSizeInfo($productSkn, $maxSortId)
|
|
|
{
|
|
|
if (is_numeric($productSkn)) {
|
|
|
//并发资源中是否存在数据
|
|
|
$sizeInfo = self::getMultiDataByResourceName('ItemData::sizeInfo');
|
|
|
if(empty($sizeInfo)) {
|
|
|
//获取尺码
|
|
|
$sizeInfo = ItemData::sizeInfo($productSkn);
|
|
|
$sizeInfo = ItemData::sizeInfo($productSkn);
|
|
|
}
|
|
|
if(empty($sizeInfo)) {
|
|
|
return array();
|
...
|
...
|
@@ -270,25 +270,25 @@ class ItemModel |
|
|
//根据最大分类ID获取尺寸属性
|
|
|
$sizeAttr = self::getSizeAttrByMaxSortId($maxSortId, $sizeInfo['sizeInfoBo']);
|
|
|
}
|
|
|
return array('material'=> $material, 'size'=> $size, 'reference'=> $reference,
|
|
|
return array('material'=> $material, 'size'=> $size, 'reference'=> $reference,
|
|
|
'modelCards'=> $modelCards,'details'=> $details,'fittingReport' =>$fittingReport,
|
|
|
'description'=> $description,'sizeTitleJson' => json_encode($sizeAttr));
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
return array();
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取购物车商品信息
|
|
|
*
|
|
|
*
|
|
|
* @param int $productId
|
|
|
* @param int $uid
|
|
|
* @param int $vipLevel
|
|
|
* @return array
|
|
|
*/
|
|
|
public static function getCartProductInfo($productId, $uid, $vipLevel)
|
|
|
public static function getCartProductInfo($productId, $uid, $vipLevel)
|
|
|
{
|
|
|
$goodsInfo = array();
|
|
|
$size = array();
|
...
|
...
|
@@ -304,7 +304,7 @@ class ItemModel |
|
|
if (!empty($baseInfo['salesPhrase'])) {
|
|
|
$goodsInfo['saleTip'] = $baseInfo['salesPhrase'];
|
|
|
}
|
|
|
|
|
|
|
|
|
// 商品价格
|
|
|
if (isset($baseInfo['productPriceBo'])) {
|
|
|
$goodsInfo['marketPrice'] = Helpers::transPrice($baseInfo['productPriceBo']['marketPrice']);
|
...
|
...
|
@@ -315,7 +315,7 @@ class ItemModel |
|
|
$goodsInfo['hasOtherPrice'] = false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
// 上市期
|
|
|
if (isset($baseInfo['expectArrivalTime']) && !empty($baseInfo['expectArrivalTime'])) {
|
|
|
$goodsInfo['arrivalDate'] = $baseInfo['expectArrivalTime'] . '月';
|
...
|
...
|
@@ -323,13 +323,13 @@ class ItemModel |
|
|
unset($goodsInfo['salePrice']);
|
|
|
$goodsInfo['hasOtherPrice'] = false;
|
|
|
}
|
|
|
|
|
|
|
|
|
//VIP数据
|
|
|
$goodsInfo['vipPrice'] = self::getVipDataByProductBaseInfo($baseInfo, $vipLevel);
|
|
|
//sku商品信息
|
|
|
$skuData = self::getSkuDataByProductBaseInfo($baseInfo);
|
|
|
$totalStorageNum = $skuData['totalStorageNum'];
|
|
|
|
|
|
|
|
|
$goodsInfo['img'] = $skuData['defaultImage'];
|
|
|
$goodsInfo['colors'] = $skuData['skuGoods'];
|
|
|
$favoriteData = FavoriteData::getUidProductFav($uid, $productId);
|
...
|
...
|
@@ -339,7 +339,7 @@ class ItemModel |
|
|
$size = self::getSizeDataBySizeInfo($sizeInfo);
|
|
|
$goodsInfo['size'] = $size;
|
|
|
}
|
|
|
|
|
|
|
|
|
// 限购商品
|
|
|
if ($baseInfo['isLimitBuy'] === 'Y') {
|
|
|
// 是否开售
|
...
|
...
|
@@ -349,7 +349,7 @@ class ItemModel |
|
|
if (isset($baseInfo['showStatus'])) {
|
|
|
$showStatus = intval($baseInfo['showStatus']);
|
|
|
}
|
|
|
|
|
|
|
|
|
$fashTopGoods = self::getFashionTopGoodsStatus($uid, $showStatus, $isBeginSale);
|
|
|
//潮流尖货状态
|
|
|
$goodsInfo['fashionTopGoods'] = array(
|
...
|
...
|
@@ -367,7 +367,7 @@ class ItemModel |
|
|
$goodsInfo['buyNow'] = $fashTopGoods['buyNow'];//是否立即购买
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
//商品状态
|
|
|
$soldOut = $baseInfo['status'] == 0 || $totalStorageNum === 0;
|
|
|
$notForSale = $baseInfo['attribute'] == 2;//非卖品
|
...
|
...
|
@@ -397,18 +397,18 @@ class ItemModel |
|
|
unset($goodsInfo['salePrice']);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
return $goodsInfo;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取分类导航列表
|
|
|
*
|
|
|
*
|
|
|
* @param string $smallSortId
|
|
|
* @return array
|
|
|
*/
|
|
|
public static function getSortNav($smallSortId)
|
|
|
public static function getSortNav($smallSortId)
|
|
|
{
|
|
|
$key = WebCacheConfig::KEY_WEB_ITEM_SORT_DATA.'_'.$smallSortId;
|
|
|
$navs = Cache::get($key);
|
...
|
...
|
@@ -432,17 +432,17 @@ class ItemModel |
|
|
}
|
|
|
return $navs;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取咨询列表
|
|
|
*
|
|
|
*
|
|
|
* @param int $uid
|
|
|
* @param int $productId
|
|
|
* @param int $pageNum
|
|
|
* @param int $pageSize
|
|
|
* @return array
|
|
|
*/
|
|
|
public static function getConsults($uid, $productId, $pageNum = 1, $pageSize = 30)
|
|
|
public static function getConsults($uid, $productId, $pageNum = 1, $pageSize = 30)
|
|
|
{
|
|
|
$result = array();
|
|
|
if (is_numeric($productId) && is_numeric($pageNum) && is_numeric($pageSize)) {
|
...
|
...
|
@@ -466,16 +466,16 @@ class ItemModel |
|
|
}
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取评论
|
|
|
*
|
|
|
*
|
|
|
* @param int $productId
|
|
|
* @param int $pageNum
|
|
|
* @param int $pageSize
|
|
|
* @return array
|
|
|
* @return array
|
|
|
*/
|
|
|
public static function getComments($productId, $pageNum = 1, $pageSize = 10)
|
|
|
public static function getComments($productId, $pageNum = 1, $pageSize = 10)
|
|
|
{
|
|
|
$result = array();
|
|
|
if (is_numeric($productId) && is_numeric($pageNum) && is_numeric($pageSize)) {
|
...
|
...
|
@@ -503,10 +503,10 @@ class ItemModel |
|
|
}
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取商品活动banner
|
|
|
*
|
|
|
*
|
|
|
* @param int $productId
|
|
|
* @return array
|
|
|
*/
|
...
|
...
|
@@ -524,14 +524,14 @@ class ItemModel |
|
|
}
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取商品热区
|
|
|
*
|
|
|
*
|
|
|
* @param string $productId
|
|
|
* @return array
|
|
|
*/
|
|
|
public static function getProductHotArea($productId)
|
|
|
public static function getProductHotArea($productId)
|
|
|
{
|
|
|
$result = array();
|
|
|
$data = ItemData::getProductHotArea($productId);
|
...
|
...
|
@@ -560,6 +560,7 @@ class ItemModel |
|
|
'href' => Helpers::getUrlBySkc($goods['goodsImagesList'][0]['productId'],
|
|
|
$goods['goodsImagesList'][0]['goodsId'], $val['product']['cnAlphabet']),
|
|
|
);
|
|
|
$point['href'] = $point['product']['href'];
|
|
|
}
|
|
|
}
|
|
|
if(!empty($point)) {
|
...
|
...
|
@@ -567,17 +568,17 @@ class ItemModel |
|
|
}
|
|
|
}
|
|
|
if(!empty($temp)) {
|
|
|
$result[] = $temp;
|
|
|
$result[] = $temp;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取商品模特卡
|
|
|
*
|
|
|
*
|
|
|
* @param string $productId
|
|
|
* @return array
|
|
|
*/
|
...
|
...
|
@@ -599,7 +600,7 @@ class ItemModel |
|
|
}
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 添加咨询
|
|
|
*
|
...
|
...
|
@@ -612,10 +613,10 @@ class ItemModel |
|
|
{
|
|
|
return ItemData::addConsult($uid, $productId, $content);
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取商品的舒适度
|
|
|
*
|
|
|
*
|
|
|
* @param int $productId
|
|
|
* @return array
|
|
|
*/
|
...
|
...
|
@@ -651,7 +652,7 @@ class ItemModel |
|
|
}
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取商品的喜欢
|
|
|
* @param int $uid
|
...
|
...
|
@@ -677,10 +678,10 @@ class ItemModel |
|
|
}
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 根据商品信息设置并发请求
|
|
|
*
|
|
|
*
|
|
|
* @param array $productInfo
|
|
|
*/
|
|
|
private static function setMultiResourceByProductBaseInfo(&$baseInfo)
|
...
|
...
|
@@ -703,10 +704,10 @@ class ItemModel |
|
|
}
|
|
|
self::$multiResources = Yohobuy::getMulti($multiResourcesUrl, array(), false, 5, true);
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 根据资源名称获取并发数据
|
|
|
*
|
|
|
*
|
|
|
* @param string $resourceName
|
|
|
* @return array
|
|
|
*/
|
...
|
...
|
@@ -718,13 +719,13 @@ class ItemModel |
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 根据最大分类ID获取尺寸属性
|
|
|
*
|
|
|
*
|
|
|
* @param string $maxSortId
|
|
|
* @param array $sizeList
|
|
|
* @return array
|
|
|
* @return array
|
|
|
*/
|
|
|
private static function getSizeAttrByMaxSortId($maxSortId, array $sizeList)
|
|
|
{
|
...
|
...
|
@@ -746,7 +747,7 @@ class ItemModel |
|
|
foreach($sizeList['sizeAttributeBos'] as $size) {
|
|
|
$attributeNames[$size['id']] = $size['attributeName'];
|
|
|
}
|
|
|
|
|
|
|
|
|
foreach($sizeList['sizeBoList'] as $size) {
|
|
|
$sizeValues = array();
|
|
|
foreach($size['sortAttributes'] as $sort) {
|
...
|
...
|
@@ -763,14 +764,14 @@ class ItemModel |
|
|
}
|
|
|
return $sizeInfos;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取尺寸信息
|
|
|
*
|
|
|
*
|
|
|
* @param array $sizeInfo
|
|
|
* @return array
|
|
|
* @return array
|
|
|
*/
|
|
|
private static function getSizeDataBySizeInfo(array &$sizeInfo)
|
|
|
private static function getSizeDataBySizeInfo(array &$sizeInfo)
|
|
|
{
|
|
|
$size = array();
|
|
|
// 尺码信息
|
...
|
...
|
@@ -791,7 +792,7 @@ class ItemModel |
|
|
// 判断是否显示参考尺码
|
|
|
$showReference = ($boyReference && !empty($sizeInfo['sizeInfoBo']['sizeBoList'][0]['boyReferSize'])) ||
|
|
|
($girlReference && !empty($sizeInfo['sizeInfoBo']['sizeBoList'][0]['girlReferSize']) );
|
|
|
|
|
|
|
|
|
if (!empty($sizeInfo['sizeInfoBo']['sizeAttributeBos'])) {
|
|
|
//尺码信息头部
|
|
|
$size['thead'] = array(0 => array('name' => '吊牌尺码', 'id' => ''));
|
...
|
...
|
@@ -814,7 +815,7 @@ class ItemModel |
|
|
} else {
|
|
|
if(isset($size['thead'][1]) && $showReference) {
|
|
|
$size['thead'][1] = array();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//其他尺码信息
|
|
|
foreach ($value['sortAttributes'] as $attr) {
|
...
|
...
|
@@ -830,14 +831,14 @@ class ItemModel |
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
// 测量方式
|
|
|
if (!empty($sizeInfo['sizeImage'])) {
|
|
|
$size['sizeImg'] = $sizeInfo['sizeImage'];
|
|
|
}
|
|
|
return $size;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 使sizeBoList id以 sizeAttributeBos id顺序一样
|
|
|
* @param type array $sizeInfoBo
|
...
|
...
|
@@ -848,7 +849,7 @@ class ItemModel |
|
|
if (empty($sizeInfoBo['sizeBoList']) || empty($sizeInfoBo['sizeAttributeBos'])) {
|
|
|
return array();
|
|
|
}
|
|
|
|
|
|
|
|
|
foreach ($sizeInfoBo['sizeBoList'] as $sizek => $sizeBoList) {
|
|
|
$sortArr = array();
|
|
|
foreach ($sizeBoList['sortAttributes'] as $sortAttributes) {
|
...
|
...
|
@@ -856,7 +857,7 @@ class ItemModel |
|
|
}
|
|
|
$sizeInfoBo['sizeBoList'][$sizek]['sortAttributes'] = $sortArr;
|
|
|
}
|
|
|
|
|
|
|
|
|
foreach ($sizeInfoBo['sizeBoList'] as $sizek => $sizeBoList) {
|
|
|
$sortArr = array();
|
|
|
foreach ($sizeInfoBo['sizeAttributeBos'] as $val) {
|
...
|
...
|
@@ -864,17 +865,17 @@ class ItemModel |
|
|
}
|
|
|
$sizeInfoBo['sizeBoList'][$sizek]['sortAttributes'] = $sortArr;
|
|
|
}
|
|
|
|
|
|
|
|
|
return $sizeInfoBo;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取模特数据
|
|
|
*
|
|
|
*
|
|
|
* @param array $sizeInfo
|
|
|
* @return array
|
|
|
* @return array
|
|
|
*/
|
|
|
private static function getReferenceDataBySizeInfo(array &$sizeInfo)
|
|
|
private static function getReferenceDataBySizeInfo(array &$sizeInfo)
|
|
|
{
|
|
|
$reference = array();
|
|
|
if (!empty($sizeInfo['modelBos'])) {
|
...
|
...
|
@@ -903,14 +904,14 @@ class ItemModel |
|
|
}
|
|
|
return $reference;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取洗涤材质
|
|
|
*
|
|
|
*
|
|
|
* @param array $sizeInfo
|
|
|
* @return array
|
|
|
*/
|
|
|
private static function getMaterialDataBySizeInfo(array &$sizeInfo)
|
|
|
private static function getMaterialDataBySizeInfo(array &$sizeInfo)
|
|
|
{
|
|
|
$material = array();
|
|
|
//洗涤提示
|
...
|
...
|
@@ -920,7 +921,7 @@ class ItemModel |
|
|
$material['wash'][] = array('name' => $value['caption'],'img' => $value['img']);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
if (!empty($sizeInfo['productMaterialList'])) {
|
|
|
//商品材质[洗涤说明]
|
|
|
$material['materialDetail'] = array();
|
...
|
...
|
@@ -935,14 +936,14 @@ class ItemModel |
|
|
}
|
|
|
return $material;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取描述数据
|
|
|
*
|
|
|
*
|
|
|
* @param array $sizeInfo
|
|
|
* @return array
|
|
|
*/
|
|
|
private static function getDescriptionDataBySizeInfo(array &$sizeInfo)
|
|
|
private static function getDescriptionDataBySizeInfo(array &$sizeInfo)
|
|
|
{
|
|
|
$description = array();
|
|
|
// 商品信息
|
...
|
...
|
@@ -968,14 +969,14 @@ class ItemModel |
|
|
}
|
|
|
return $description;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取商品详情页介绍
|
|
|
*
|
|
|
*
|
|
|
* @param array $sizeInfo
|
|
|
* @return string
|
|
|
*/
|
|
|
private static function getDetailDataBySizeInfo(array &$sizeInfo)
|
|
|
private static function getDetailDataBySizeInfo(array &$sizeInfo)
|
|
|
{
|
|
|
$details = '';
|
|
|
// 详情配图
|
...
|
...
|
@@ -992,14 +993,14 @@ class ItemModel |
|
|
}
|
|
|
return $details;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取sku商品数据
|
|
|
*
|
|
|
*
|
|
|
* @param array $baseInfo
|
|
|
* @return array
|
|
|
* @return array
|
|
|
*/
|
|
|
private static function getSkuDataByProductBaseInfo(array &$baseInfo)
|
|
|
private static function getSkuDataByProductBaseInfo(array &$baseInfo)
|
|
|
{
|
|
|
$totalStorageNum = 0;
|
|
|
$skuGoods = array();//sku商品
|
...
|
...
|
@@ -1008,8 +1009,8 @@ class ItemModel |
|
|
if (!empty($baseInfo['goodsList'])) {
|
|
|
$goodsGroup = array();
|
|
|
foreach ($baseInfo['goodsList'] as $pos => $value) {
|
|
|
|
|
|
// 如果status为0,即skc下架时就跳过该商品$value['status'] === 0
|
|
|
|
|
|
// 如果status为0,即skc下架时就跳过该商品$value['status'] === 0
|
|
|
if (empty($value['colorImage']) ) {
|
|
|
continue;
|
|
|
}
|
...
|
...
|
@@ -1025,7 +1026,7 @@ class ItemModel |
|
|
'thumbs' => array(),
|
|
|
'size' => array(),
|
|
|
);
|
|
|
|
|
|
|
|
|
foreach ($value['goodsImagesList'] as $goods) {
|
|
|
if(!empty($goods['imageUrl'])) {
|
|
|
$goodsGroup['thumbs'][] = array(
|
...
|
...
|
@@ -1034,17 +1035,17 @@ class ItemModel |
|
|
);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
//缩略图空,不显示
|
|
|
if(empty($goodsGroup['thumbs'])) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
|
|
|
//默认第一张图片
|
|
|
if($pos == 0) {
|
|
|
$defaultImage = Images::getImageUrl($value['colorImage'], 420, 560);
|
|
|
}
|
|
|
|
|
|
|
|
|
//商品的尺码列表
|
|
|
foreach ($value['goodsSizeBoList'] as $size) {
|
|
|
if($baseInfo['attribute'] == 3 ) { //虚拟商品,增加为一件
|
...
|
...
|
@@ -1062,7 +1063,7 @@ class ItemModel |
|
|
);
|
|
|
//单个sku商品的总数
|
|
|
$goodsGroup['total'] += intval($size['goodsSizeStorageNum']);
|
|
|
|
|
|
|
|
|
if($goodsGroup['total']> 0 && !$chooseSkuFlag) { //默认选中该sku商品
|
|
|
$goodsGroup['focus'] = true;
|
|
|
$chooseSkuFlag = true;//选中sku商品
|
...
|
...
|
@@ -1079,14 +1080,14 @@ class ItemModel |
|
|
return array('skuGoods' => $skuGoods,'totalStorageNum' => $totalStorageNum,
|
|
|
'defaultImage' => $defaultImage);
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取品牌数据
|
|
|
*
|
|
|
*
|
|
|
* @param array $baseInfo
|
|
|
* @return array
|
|
|
*/
|
|
|
private static function getBrandDataByProductBaseInfo(array &$baseInfo)
|
|
|
private static function getBrandDataByProductBaseInfo(array &$baseInfo)
|
|
|
{
|
|
|
if(empty($baseInfo['brand'])) {
|
|
|
return array();
|
...
|
...
|
@@ -1107,12 +1108,12 @@ class ItemModel |
|
|
if(!empty($bannerInfo['bannerUrl'])) {
|
|
|
$bgImg = Images::getForceSourceUrl($bannerInfo['bannerUrl']);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//banner的logo
|
|
|
if(!empty($bannerInfo['logo']))
|
|
|
if(!empty($bannerInfo['logo']))
|
|
|
{
|
|
|
$logo = Images::getForceSourceUrl($bannerInfo['logo']);
|
|
|
}
|
|
|
}
|
|
|
$homeUrl = 'javascript:void(0)';
|
|
|
if(!empty($baseInfo['brand']['brandDomain'])){
|
|
|
$homeUrl = Helpers::url('', array(), $baseInfo['brand']['brandDomain']);
|
...
|
...
|
@@ -1130,16 +1131,16 @@ class ItemModel |
|
|
'isCollect'=> false
|
|
|
);
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取vip数据
|
|
|
*
|
|
|
*
|
|
|
* @param array $baseInfo
|
|
|
* @param int $vipLevel
|
|
|
* @param int $uid
|
|
|
* @return array
|
|
|
*/
|
|
|
private static function getVipDataByProductBaseInfo(array &$baseInfo, $vipLevel = 0, $uid = 0)
|
|
|
private static function getVipDataByProductBaseInfo(array &$baseInfo, $vipLevel = 0, $uid = 0)
|
|
|
{
|
|
|
$vipData = array();
|
|
|
if (!empty($baseInfo['productPriceBo']['vipPrices'])) {
|
...
|
...
|
@@ -1167,10 +1168,10 @@ class ItemModel |
|
|
}
|
|
|
return $vipData;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取活动数据(促销相关活动)
|
|
|
*
|
|
|
*
|
|
|
* @param array $baseInfo
|
|
|
* @return array
|
|
|
*/
|
...
|
...
|
@@ -1194,10 +1195,10 @@ class ItemModel |
|
|
}
|
|
|
return $activity;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取标签相关数据
|
|
|
*
|
|
|
*
|
|
|
* @param array $baseInfo
|
|
|
* @return array
|
|
|
*/
|
...
|
...
|
@@ -1236,12 +1237,12 @@ class ItemModel |
|
|
}
|
|
|
return $tags;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取模特试穿
|
|
|
*
|
|
|
*
|
|
|
* @param string $productSkn
|
|
|
* @return array
|
|
|
* @return array
|
|
|
*/
|
|
|
public static function getProductModelTry($productSkn)
|
|
|
{
|
...
|
...
|
@@ -1270,11 +1271,11 @@ class ItemModel |
|
|
}
|
|
|
return $modelTry;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 处理限购商品的有关按钮状态(或取现购买以及底部商品购买按钮)
|
|
|
*
|
|
|
* @param int $uid
|
|
|
* @param int $uid
|
|
|
* @param int $showStatus 限购商品的关联状态
|
|
|
* @param boolean $isBeginSale 限购商品是否已开售
|
|
|
*/
|
...
|
...
|
@@ -1287,8 +1288,8 @@ class ItemModel |
|
|
//openSoon//即将开售
|
|
|
//dis //失效
|
|
|
//buyNow //是否立即购买
|
|
|
$result = array('getLimitedCode' => false, 'hasLimitedCode' => false,
|
|
|
'limitedCodeSoldOut' => false, 'openSoon' => false, 'dis' => false,
|
|
|
$result = array('getLimitedCode' => false, 'hasLimitedCode' => false,
|
|
|
'limitedCodeSoldOut' => false, 'openSoon' => false, 'dis' => false,
|
|
|
'buyNow' => false, 'soldOut'=> false, 'getLimitedCodeDis'=> false);
|
|
|
// 显示获取限购码按钮
|
|
|
$result['getLimitedCode'] = true;
|
...
|
...
|
@@ -1326,14 +1327,14 @@ class ItemModel |
|
|
$result['hasLimitedCode'] = true;
|
|
|
$result['limitedCodeSoldOut'] = true;
|
|
|
$result['getLimitedCode'] = false;
|
|
|
|
|
|
|
|
|
break;
|
|
|
case 6: // 开售前,即将开售(用户已领取限购码)
|
|
|
$result['openSoon'] = true;
|
|
|
$result['hasLimitedCode'] = true;
|
|
|
if(!empty($uid)) {//限购码失效
|
|
|
$result['getLimitedCodeDis'] = true;
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case 7: // 开售后,用户已经用获得的限购码购买过商品
|
|
|
$result['buyNow'] = true;
|
...
|
...
|
@@ -1346,12 +1347,12 @@ class ItemModel |
|
|
break;
|
|
|
}
|
|
|
return $result;
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取商品咨询和评论数据
|
|
|
*
|
|
|
*
|
|
|
* @param array $baseInfo
|
|
|
* @return array
|
|
|
*/
|
...
|
...
|
@@ -1373,5 +1374,5 @@ class ItemModel |
|
|
}
|
|
|
return $consultComment;
|
|
|
}
|
|
|
|
|
|
} |
|
|
\ No newline at end of file |
|
|
|
|
|
} |
...
|
...
|
|