Authored by 周少峰

product detail url

@@ -269,9 +269,7 @@ class Helpers @@ -269,9 +269,7 @@ class Helpers
269 $result['salePrice'] && $result['salePrice'] .= '.00'; 269 $result['salePrice'] && $result['salePrice'] .= '.00';
270 } 270 }
271 $result['is_soon_sold_out'] = ($productData['is_soon_sold_out'] === 'Y'); 271 $result['is_soon_sold_out'] = ($productData['is_soon_sold_out'] === 'Y');
272 - $result['url'] = self::url('/product/pro_' . $productData['product_id'] . '_'  
273 - . $productData['goods_list'][0]['goods_id']  
274 - . '/' . $productData['cn_alphabet'] . '.html', array(), 'item'); 272 + $result['url'] = self::getUrlBySkc($productData['product_id'], $productData['goods_list'][0]['goods_id'], $productData['cn_alphabet']);
275 // APP访问需要加附加的参数 273 // APP访问需要加附加的参数
276 // 备注:如果以后APP的接口太多,可以把这边参数提取出来,变成一个公共的方法来生成,便于以后管理维护 274 // 备注:如果以后APP的接口太多,可以把这边参数提取出来,变成一个公共的方法来生成,便于以后管理维护
277 if ($isApp) { 275 if ($isApp) {
@@ -790,7 +788,7 @@ class Helpers @@ -790,7 +788,7 @@ class Helpers
790 788
791 // 商品链接 789 // 商品链接
792 $cnAlphaBet = isset($value['cn_alphabet']) ? $value['cn_alphabet'] : md5($value['product_name']); 790 $cnAlphaBet = isset($value['cn_alphabet']) ? $value['cn_alphabet'] : md5($value['product_name']);
793 - $oneGoods['link'] = self::url('/product/pro_' . $value['product_id'] . '_' . $value['goods_id'] . '/' . $cnAlphaBet . '.html', null, 'item'); 791 + $oneGoods['link'] = self::getUrlBySkc($value['product_id'], $value['goods_id'], $cnAlphaBet);
794 792
795 $result[] = $oneGoods; 793 $result[] = $oneGoods;
796 } 794 }
@@ -839,7 +837,7 @@ class Helpers @@ -839,7 +837,7 @@ class Helpers
839 // 商品链接 837 // 商品链接
840 if (isset($single['goods_id'])) { 838 if (isset($single['goods_id'])) {
841 $cnAlphaBet = isset($single['cn_alphabet']) ? $single['cn_alphabet'] : md5($single['product_name']); 839 $cnAlphaBet = isset($single['cn_alphabet']) ? $single['cn_alphabet'] : md5($single['product_name']);
842 - $oneGoods['subjoinLink'] = self::url('/product/pro_' . $single['product_id'] . '_' . $single['goods_id'] . '/' . $cnAlphaBet . '.html', null, 'item'); 840 + $oneGoods['subjoinLink'] = self::getUrlBySkc($single['product_id'], $single['goods_id'], $cnAlphaBet);
843 } else { 841 } else {
844 $oneGoods['subjoinLink'] = self::url('/product/show_' . $single['product_id'] . '_' . $single['product_skn'] . '/' . Helpers::makeToken($single['product_skn']) . '.html', null, 'item'); 842 $oneGoods['subjoinLink'] = self::url('/product/show_' . $single['product_id'] . '_' . $single['product_skn'] . '/' . Helpers::makeToken($single['product_skn']) . '.html', null, 'item');
845 } 843 }
@@ -1004,10 +1002,7 @@ class Helpers @@ -1004,10 +1002,7 @@ class Helpers
1004 */ 1002 */
1005 public static function getUrlBySkc($product_id, $goods_id, $cn_alphabet='') 1003 public static function getUrlBySkc($product_id, $goods_id, $cn_alphabet='')
1006 { 1004 {
1007 - if (empty($cn_alphabet)) {  
1008 - $cn_alphabet = 'goods.html';  
1009 - }  
1010 - return '//item.yohobuy.com/product/pro_' . $product_id . '_' . $goods_id . '/' . $cn_alphabet. '.html'; 1005 + return '//item.yohobuy.com/p' . $product_id .'.html';
1011 } 1006 }
1012 1007
1013 /** 1008 /**
@@ -1064,14 +1059,7 @@ class Helpers @@ -1064,14 +1059,7 @@ class Helpers
1064 */ 1059 */
1065 public static function getProductUrl($productId, $productSkn, $productName = '', $cnAlphaBet = '') 1060 public static function getProductUrl($productId, $productSkn, $productName = '', $cnAlphaBet = '')
1066 { 1061 {
1067 - $cnAlphaBet = empty($cnAlphaBet) ? $cnAlphaBet : md5($productName);  
1068 -  
1069 - return self::url(  
1070 - '/product/pro_' . $productId . '_' .  
1071 - $productSkn . '/' . $cnAlphaBet . '.html',  
1072 - null,  
1073 - 'item'  
1074 - ); 1062 + return self::getUrlBySkc($productId ,$productSkn, $cnAlphaBet);
1075 } 1063 }
1076 1064
1077 /** 1065 /**
@@ -662,7 +662,7 @@ class CartModel @@ -662,7 +662,7 @@ class CartModel
662 break; 662 break;
663 } 663 }
664 $build['img'] .= '?imageMogr2/thumbnail/100x100/extent/100x100/background/d2hpdGU=/position/center/quality/90'; 664 $build['img'] .= '?imageMogr2/thumbnail/100x100/extent/100x100/background/d2hpdGU=/position/center/quality/90';
665 - $build['href'] = Helpers::url('/product/pro_' . $value['product_id'] . '_' . $goodsId . '/' . $value['cn_alphabet'] . '.html', null, 'item'); 665 + $build['href'] = Helpers::getUrlBySkc($value['product_id'], $goodsId, $value['cn_alphabet']);
666 666
667 $result['data']['item'][] = $build; 667 $result['data']['item'][] = $build;
668 668