Authored by zhangxiaoru

店铺

@@ -37,8 +37,7 @@ class DetailModel @@ -37,8 +37,7 @@ class DetailModel
37 // 通过ID获取 37 // 通过ID获取
38 if (is_numeric($productId) && is_numeric($goodsId)) { 38 if (is_numeric($productId) && is_numeric($goodsId)) {
39 $baseInfo = DetailData::baseInfo($productId, $uid); 39 $baseInfo = DetailData::baseInfo($productId, $uid);
40 - }  
41 - // 通过SKN获取 40 + } // 通过SKN获取
42 elseif (is_numeric($productSkn)) { 41 elseif (is_numeric($productSkn)) {
43 $baseInfo = DetailData::baseInfo(null, $uid, $productSkn); 42 $baseInfo = DetailData::baseInfo(null, $uid, $productSkn);
44 } 43 }
@@ -52,7 +51,7 @@ class DetailModel @@ -52,7 +51,7 @@ class DetailModel
52 51
53 // 用户未登录时 52 // 用户未登录时
54 if (empty($uid)) { 53 if (empty($uid)) {
55 - $result['loginUrl'] = Helpers::url('/signin.html', array('refer' => Helpers::url('/product/show_' . $baseInfo['erpProductId']. '.html'))); 54 + $result['loginUrl'] = Helpers::url('/signin.html', array('refer' => Helpers::url('/product/show_' . $baseInfo['erpProductId'] . '.html')));
56 } 55 }
57 56
58 // 商品促销短语 57 // 商品促销短语
@@ -143,8 +142,7 @@ class DetailModel @@ -143,8 +142,7 @@ class DetailModel
143 $result['feedbacks']['consults'][] = $build; 142 $result['feedbacks']['consults'][] = $build;
144 } 143 }
145 $result['feedbacks']['consultsUrl'] = Helpers::url('/product/detail/consults', array('product_id' => $productId, 'total' => $result['feedbacks']['consultsNum'])); 144 $result['feedbacks']['consultsUrl'] = Helpers::url('/product/detail/consults', array('product_id' => $productId, 'total' => $result['feedbacks']['consultsNum']));
146 - }  
147 - // 暂无咨询 145 + } // 暂无咨询
148 else { 146 else {
149 $result['feedbacks']['consultsUrl'] = Helpers::url('/product/detail/consultform', array('product_id' => $productId)); 147 $result['feedbacks']['consultsUrl'] = Helpers::url('/product/detail/consultform', array('product_id' => $productId));
150 } 148 }
@@ -177,7 +175,11 @@ class DetailModel @@ -177,7 +175,11 @@ class DetailModel
177 foreach ($shops['data'] as $key => $shop) { 175 foreach ($shops['data'] as $key => $shop) {
178 $result['enterStore'][$key]['img'] = Helpers::getImageUrl($shop['brand_ico'], 47, 47); 176 $result['enterStore'][$key]['img'] = Helpers::getImageUrl($shop['brand_ico'], 47, 47);
179 $result['enterStore'][$key]['storeName'] = $shop['brand_name']; 177 $result['enterStore'][$key]['storeName'] = $shop['brand_name'];
180 - $result['enterStore'][$key]['url'] = Helpers::url('/product/index/brand', array('shop_id' => $shop['shop_id'])); 178 + if (isset($shop['shop_id'])) {
  179 + $result['enterStore'][$key]['url'] = Helpers::url('/product/index/brand', array('shop_id' => $shop['shop_id']));
  180 + } else {
  181 + $result['enterStore'][$key]['url'] = Helpers::url('', array(), $shop['brand_domain']);
  182 + }
181 } 183 }
182 } 184 }
183 // 为你优选的链接 185 // 为你优选的链接
@@ -218,11 +220,11 @@ class DetailModel @@ -218,11 +220,11 @@ class DetailModel
218 } 220 }
219 221
220 // 商品的尺码列表 222 // 商品的尺码列表
221 - $colorStorageGroup[ $value['productSkc'] ] = array(); 223 + $colorStorageGroup[$value['productSkc']] = array();
222 if (isset($value['goodsSizeBoList']) && !empty($value['goodsSizeBoList'])) { 224 if (isset($value['goodsSizeBoList']) && !empty($value['goodsSizeBoList'])) {
223 $sizeName = ''; 225 $sizeName = '';
224 foreach ($value['goodsSizeBoList'] as $size) { 226 foreach ($value['goodsSizeBoList'] as $size) {
225 - $sizeList[ $value['productSkc'] ][] = array( 227 + $sizeList[$value['productSkc']][] = array(
226 'id' => $size['id'], 228 'id' => $size['id'],
227 'skuId' => $size['goodsSizeSkuId'], 229 'skuId' => $size['goodsSizeSkuId'],
228 'goodsId' => $size['goodsId'], 230 'goodsId' => $size['goodsId'],
@@ -234,10 +236,10 @@ class DetailModel @@ -234,10 +236,10 @@ class DetailModel
234 236
235 // 所有尺码列表,赋值用于前端展示默认尺码的时候 判断出没有库存则显示灰色 237 // 所有尺码列表,赋值用于前端展示默认尺码的时候 判断出没有库存则显示灰色
236 $allSizeList[$sizeName] = empty($allSizeList[$sizeName]['storage']) 238 $allSizeList[$sizeName] = empty($allSizeList[$sizeName]['storage'])
237 - ? array('storage' => $size['goodsSizeStorageNum'], 'id' => $size['id'])  
238 - : $allSizeList[$sizeName]; 239 + ? array('storage' => $size['goodsSizeStorageNum'], 'id' => $size['id'])
  240 + : $allSizeList[$sizeName];
239 $colorStorageNum += intval($size['goodsSizeStorageNum']); 241 $colorStorageNum += intval($size['goodsSizeStorageNum']);
240 - $colorStorageGroup[ $value['productSkc'] ][$sizeName] = intval($size['goodsSizeStorageNum']); 242 + $colorStorageGroup[$value['productSkc']][$sizeName] = intval($size['goodsSizeStorageNum']);
241 } 243 }
242 244
243 // 颜色分组 245 // 颜色分组
@@ -269,23 +271,23 @@ class DetailModel @@ -269,23 +271,23 @@ class DetailModel
269 271
270 // 各个颜色的尺码, 每行显示一个尺码对应的颜色 272 // 各个颜色的尺码, 每行显示一个尺码对应的颜色
271 foreach ($colorList as $colorArr) { 273 foreach ($colorList as $colorArr) {
272 - $colorArr['colorNum'] = isset($colorStorageGroup[ $colorArr['skcId'] ][$sizeName]) ? $colorStorageGroup[ $colorArr['skcId'] ][$sizeName] : 0; 274 + $colorArr['colorNum'] = isset($colorStorageGroup[$colorArr['skcId']][$sizeName]) ? $colorStorageGroup[$colorArr['skcId']][$sizeName] : 0;
273 $colorGroup[$i]['color'][] = $colorArr; 275 $colorGroup[$i]['color'][] = $colorArr;
274 } 276 }
275 $colorGroup[$i]['id'] = $value['id']; 277 $colorGroup[$i]['id'] = $value['id'];
276 278
277 - ++ $i; 279 + ++$i;
278 } 280 }
279 // 遍历所有颜色, 构建尺码显示数据 281 // 遍历所有颜色, 构建尺码显示数据
280 $i = 1; 282 $i = 1;
281 foreach ($colorList as $value) { 283 foreach ($colorList as $value) {
282 // 各个尺码的颜色,每行显示一个颜色的对应尺码 284 // 各个尺码的颜色,每行显示一个颜色的对应尺码
283 - $sizeGroup[$i]['size'] = $sizeList[ $value['skcId'] ]; 285 + $sizeGroup[$i]['size'] = $sizeList[$value['skcId']];
284 $sizeGroup[$i]['colorId'] = $value['skcId']; 286 $sizeGroup[$i]['colorId'] = $value['skcId'];
285 // 默认颜色 287 // 默认颜色
286 $colorGroup[0]['color'][] = $value; 288 $colorGroup[0]['color'][] = $value;
287 289
288 - ++ $i; 290 + ++$i;
289 } 291 }
290 292
291 // 商品图: 多个 293 // 商品图: 多个
@@ -295,8 +297,7 @@ class DetailModel @@ -295,8 +297,7 @@ class DetailModel
295 'img' => Helpers::getImageUrl($value['img'], 450, 600) 297 'img' => Helpers::getImageUrl($value['img'], 450, 600)
296 ); 298 );
297 } 299 }
298 - }  
299 - // 商品图: 单个 300 + } // 商品图: 单个
300 elseif (isset($goodsGroup[0])) { 301 elseif (isset($goodsGroup[0])) {
301 $result['bannerTop'] = array( 302 $result['bannerTop'] = array(
302 'img' => Helpers::getImageUrl($goodsGroup[0]['img'], 450, 600) 303 'img' => Helpers::getImageUrl($goodsGroup[0]['img'], 450, 600)
@@ -345,12 +346,10 @@ class DetailModel @@ -345,12 +346,10 @@ class DetailModel
345 } else { 346 } else {
346 $result['cartInfo']['addToCartUrl'] = Helpers::url('/product/buy_' . $productId . '_' . $goodsId . '.html'); 347 $result['cartInfo']['addToCartUrl'] = Helpers::url('/product/buy_' . $productId . '_' . $goodsId . '.html');
347 } 348 }
348 - }  
349 - // 非卖品 349 + } // 非卖品
350 elseif ($notForSale) { 350 elseif ($notForSale) {
351 $result['cartInfo']['notForSale'] = true; 351 $result['cartInfo']['notForSale'] = true;
352 - }  
353 - // 已售磬 352 + } // 已售磬
354 elseif ($soldOut) { 353 elseif ($soldOut) {
355 $result['cartInfo']['soldOut'] = true; 354 $result['cartInfo']['soldOut'] = true;
356 } 355 }
@@ -445,7 +444,7 @@ class DetailModel @@ -445,7 +444,7 @@ class DetailModel
445 444
446 $referenceList = array(); 445 $referenceList = array();
447 // 判断是否显示参考尺码 446 // 判断是否显示参考尺码
448 - $showReference = ($boyReference && !empty($sizeInfo['sizeInfoBo']['sizeBoList'][0]['boyReferSize'])) || ($girlReference && !empty($sizeInfo['sizeInfoBo']['sizeBoList'][0]['girlReferSize']) ); 447 + $showReference = ($boyReference && !empty($sizeInfo['sizeInfoBo']['sizeBoList'][0]['boyReferSize'])) || ($girlReference && !empty($sizeInfo['sizeInfoBo']['sizeBoList'][0]['girlReferSize']));
449 if ($showReference) { 448 if ($showReference) {
450 $referenceList[0] = array('param' => $referenceName); 449 $referenceList[0] = array('param' => $referenceName);
451 } 450 }
@@ -803,7 +802,7 @@ class DetailModel @@ -803,7 +802,7 @@ class DetailModel
803 $result['attaches'][] = self::procLimitProductAttach($item); 802 $result['attaches'][] = self::procLimitProductAttach($item);
804 } 803 }
805 804
806 - if(count($result['attaches']) > 1) { 805 + if (count($result['attaches']) > 1) {
807 Helpers::sortArrByField($result['attaches'], 'orderBy', true); 806 Helpers::sortArrByField($result['attaches'], 'orderBy', true);
808 } 807 }
809 } while (false); 808 } while (false);
@@ -821,7 +820,7 @@ class DetailModel @@ -821,7 +820,7 @@ class DetailModel
821 { 820 {
822 $result = array(); 821 $result = array();
823 822
824 - switch(intval($attachment['attachType'])) { 823 + switch (intval($attachment['attachType'])) {
825 case 1: // 大图文字 824 case 1: // 大图文字
826 $result['img'] = array( 825 $result['img'] = array(
827 'attachUrl' => Helpers::getImageUrl($attachment['attachUrl'], 750, ''), 826 'attachUrl' => Helpers::getImageUrl($attachment['attachUrl'], 750, ''),
@@ -859,7 +858,7 @@ class DetailModel @@ -859,7 +858,7 @@ class DetailModel
859 */ 858 */
860 private static function procShowStatus(&$data, $showStatus, $isBeginSale) 859 private static function procShowStatus(&$data, $showStatus, $isBeginSale)
861 { 860 {
862 - switch($showStatus) { 861 + switch ($showStatus) {
863 case 1: // 开售前/后,立即分享获得限购码(用户未领取限购码) 862 case 1: // 开售前/后,立即分享获得限购码(用户未领取限购码)
864 // 显示获取限购码按钮 863 // 显示获取限购码按钮
865 $data['canGetLimitCode'] = true; 864 $data['canGetLimitCode'] = true;