Authored by 郝肖肖

新品到着接口返回的href http 替换

@@ -59,7 +59,7 @@ class Process @@ -59,7 +59,7 @@ class Process
59 foreach ($data['navs']['list'] as $val) { 59 foreach ($data['navs']['list'] as $val) {
60 $temp['navs'][] = array( 60 $temp['navs'][] = array(
61 'id' => '', 61 'id' => '',
62 - 'href' => $val['url'], 62 + 'href' => Helpers::getUrlSafe($val['url']),
63 'name' => $val['name'] 63 'name' => $val['name']
64 ); 64 );
65 } 65 }
@@ -71,7 +71,7 @@ class Process @@ -71,7 +71,7 @@ class Process
71 $val['img'] = Images::getImageUrl($val['img'], 185, 76, 1); 71 $val['img'] = Images::getImageUrl($val['img'], 185, 76, 1);
72 $val['url'] = Helpers::transUrl($val['url'], $type); 72 $val['url'] = Helpers::transUrl($val['url'], $type);
73 $temp['tplrecommend']['keyword'][] = array( 73 $temp['tplrecommend']['keyword'][] = array(
74 - 'href' => $val['url'], 74 + 'href' => Helpers::getUrlSafe($val['url']),
75 'name' => $val['title'], 75 'name' => $val['title'],
76 'img' => $val['img'] 76 'img' => $val['img']
77 ); 77 );
@@ -84,7 +84,7 @@ class Process @@ -84,7 +84,7 @@ class Process
84 $val['url'] = Helpers::transUrl($val['url'], $type); 84 $val['url'] = Helpers::transUrl($val['url'], $type);
85 $temp['tplrecommend']['category'][] = array( 85 $temp['tplrecommend']['category'][] = array(
86 'name' => $val['name'], 86 'name' => $val['name'],
87 - 'href' => $val['url'] 87 + 'href' => Helpers::getUrlSafe($val['url'])
88 ); 88 );
89 } 89 }
90 90
@@ -93,7 +93,7 @@ class Process @@ -93,7 +93,7 @@ class Process
93 if ($key == 0) { 93 if ($key == 0) {
94 $val['img'] = Images::getImageUrl($val['img'], 377, 504, 1); // 大图 94 $val['img'] = Images::getImageUrl($val['img'], 377, 504, 1); // 大图
95 $temp['tplrecommend']['brands'][] = array( 95 $temp['tplrecommend']['brands'][] = array(
96 - 'href' => $val['url'], 96 + 'href' => Helpers::getUrlSafe($val['url']),
97 'name' => $val['title'], 97 'name' => $val['title'],
98 'img' => $val['img'] 98 'img' => $val['img']
99 ); 99 );
@@ -101,7 +101,7 @@ class Process @@ -101,7 +101,7 @@ class Process
101 else { 101 else {
102 $val['img'] = Images::getImageUrl($val['img'], 185, 504, 1); // 小图 102 $val['img'] = Images::getImageUrl($val['img'], 185, 504, 1); // 小图
103 $temp['tplrecommend']['types'][] = array( 103 $temp['tplrecommend']['types'][] = array(
104 - 'href' => $val['url'], 104 + 'href' => Helpers::getUrlSafe($val['url']),
105 'name' => $val['title'], 105 'name' => $val['title'],
106 'img' => $val['img'] 106 'img' => $val['img']
107 ); 107 );
@@ -195,7 +195,7 @@ class Process @@ -195,7 +195,7 @@ class Process
195 if (isset($data['data'][0])) { 195 if (isset($data['data'][0])) {
196 $val = $data['data'][0]; 196 $val = $data['data'][0];
197 $temp['img'] = Images::getImageUrl($val['src'], 1150, 129, 1); 197 $temp['img'] = Images::getImageUrl($val['src'], 1150, 129, 1);
198 - $temp['href'] = $val['url']; 198 + $temp['href'] = Helpers::getUrlSafe($val['url']);
199 $temp['name'] = $val['title']; 199 $temp['name'] = $val['title'];
200 $result['adbanner'] = $temp; 200 $result['adbanner'] = $temp;
201 } 201 }
@@ -220,26 +220,23 @@ class Process @@ -220,26 +220,23 @@ class Process
220 ) 220 )
221 ); 221 );
222 foreach ($data['left'] as $val) { 222 foreach ($data['left'] as $val) {
223 - $val['img'] = Images::getImageUrl($val['img'], 280, 265, 1);  
224 $result['debrisSlider']['left'][] = array( 223 $result['debrisSlider']['left'][] = array(
225 - 'img' => $val['img'],  
226 - 'href' => $val['url'], 224 + 'img' => Images::getImageUrl($val['img'], 280, 265, 1),
  225 + 'href' => Helpers::getUrlSafe($val['url']),
227 'name' => $val['title'] 226 'name' => $val['title']
228 ); 227 );
229 } 228 }
230 foreach ($data['center'] as $val) { 229 foreach ($data['center'] as $val) {
231 - $val['img'] = Images::getImageUrl($val['img'], 570, 633, 1);  
232 $result['debrisSlider']['center'][] = array( 230 $result['debrisSlider']['center'][] = array(
233 - 'img' => $val['img'],  
234 - 'href' => $val['url'], 231 + 'img' => Images::getImageUrl($val['img'], 570, 633, 1),
  232 + 'href' => Helpers::getUrlSafe($val['url']),
235 'name' => $val['title'] 233 'name' => $val['title']
236 ); 234 );
237 } 235 }
238 foreach ($data['right'] as $val) { 236 foreach ($data['right'] as $val) {
239 - $val['img'] = Images::getImageUrl($val['img'], 280, 449, 1);  
240 $result['debrisSlider']['right'][] = array( 237 $result['debrisSlider']['right'][] = array(
241 - 'img' => $val['img'],  
242 - 'href' => $val['url'], 238 + 'img' => Images::getImageUrl($val['img'], 280, 449, 1),
  239 + 'href' => Helpers::getUrlSafe($val['url']),
243 'name' => $val['title'] 240 'name' => $val['title']
244 ); 241 );
245 } 242 }
@@ -393,7 +390,7 @@ class Process @@ -393,7 +390,7 @@ class Process
393 } 390 }
394 391
395 $result['singlehot']['imgHot'][] = array( 392 $result['singlehot']['imgHot'][] = array(
396 - 'href' => $val['url'], 393 + 'href' => Helpers::getUrlSafe($val['url']),
397 'img' => $val['src'], 394 'img' => $val['src'],
398 'name' => $val['alt'] 395 'name' => $val['alt']
399 ); 396 );
@@ -581,14 +578,14 @@ class Process @@ -581,14 +578,14 @@ class Process
581 if ($listKey == 0 || $listKey == 7) { 578 if ($listKey == 0 || $listKey == 7) {
582 $val['src'] = Images::getImageUrl($val['src'], 377, 504, 1); 579 $val['src'] = Images::getImageUrl($val['src'], 377, 504, 1);
583 $result['newReport']['list'][] = array( 580 $result['newReport']['list'][] = array(
584 - 'href' => $val['url'], 581 + 'href' => Helpers::getUrlSafe($val['url']),
585 'img' => $val['src'] 582 'img' => $val['src']
586 ); 583 );
587 } 584 }
588 else { 585 else {
589 $val['src'] = Images::getImageUrl($val['src'], 185, 248, 1); 586 $val['src'] = Images::getImageUrl($val['src'], 185, 248, 1);
590 $result['newReport']['list'][] = array( 587 $result['newReport']['list'][] = array(
591 - 'href' => $val['url'], 588 + 'href' => Helpers::getUrlSafe($val['url']),
592 'img' => $val['src'] 589 'img' => $val['src']
593 ); 590 );
594 } 591 }
@@ -686,7 +683,7 @@ class Process @@ -686,7 +683,7 @@ class Process
686 if ($key2 == 0 || $key2 == 4) { // 两个大图 683 if ($key2 == 0 || $key2 == 4) { // 两个大图
687 $val['img'] = Images::getImageUrl($val['img'], 378, 248, 1); // 大图 684 $val['img'] = Images::getImageUrl($val['img'], 378, 248, 1); // 大图
688 $result['tplrecommend']['brands'][] = array( 685 $result['tplrecommend']['brands'][] = array(
689 - 'href' => $val['url'], 686 + 'href' => Helpers::getUrlSafe($val['url']),
690 'name' => $val['title'], 687 'name' => $val['title'],
691 'img' => $val['img'] 688 'img' => $val['img']
692 ); 689 );
@@ -694,7 +691,7 @@ class Process @@ -694,7 +691,7 @@ class Process
694 else { 691 else {
695 $val['img'] = Images::getImageUrl($val['img'], 185, 248, 1); // 小图 692 $val['img'] = Images::getImageUrl($val['img'], 185, 248, 1); // 小图
696 $result['tplrecommend']['types'][] = array( 693 $result['tplrecommend']['types'][] = array(
697 - 'href' => $val['url'], 694 + 'href' => Helpers::getUrlSafe($val['url']),
698 'name' => $val['title'], 695 'name' => $val['title'],
699 'img' => $val['img'] 696 'img' => $val['img']
700 ); 697 );
@@ -705,7 +702,7 @@ class Process @@ -705,7 +702,7 @@ class Process
705 foreach ($data[$key + 1]['data'] as $val) { 702 foreach ($data[$key + 1]['data'] as $val) {
706 $val['src'] = Images::getImageUrl($val['src'], 222, 298, 1); // 小图 703 $val['src'] = Images::getImageUrl($val['src'], 222, 298, 1); // 小图
707 $result['tplrecommend']['products'][] = array( 704 $result['tplrecommend']['products'][] = array(
708 - 'href' => $val['url'], 705 + 'href' => Helpers::getUrlSafe($val['url']),
709 'name' => $val['title'], 706 'name' => $val['title'],
710 'img' => $val['src'] 707 'img' => $val['src']
711 ); 708 );
@@ -735,7 +732,7 @@ class Process @@ -735,7 +732,7 @@ class Process
735 continue; 732 continue;
736 } 733 }
737 $result[] = array( 734 $result[] = array(
738 - 'href' => $val['url'], 735 + 'href' => Helpers::getUrlSafe($val['url']),
739 'name' => $val['name'] 736 'name' => $val['name']
740 ); 737 );
741 } 738 }
@@ -1185,7 +1185,7 @@ class HelperSearch @@ -1185,7 +1185,7 @@ class HelperSearch
1185 if (empty($params)) { 1185 if (empty($params)) {
1186 return self::current(); 1186 return self::current();
1187 } 1187 }
1188 - $queryPath = explode('?', $_SERVER['REQUEST_URI']); 1188 + $queryPath = explode('?', Helpers::getUrlSafe($_SERVER['REQUEST_URI']));
1189 $params_arr = array(); 1189 $params_arr = array();
1190 //店铺装修,添加额外参数 1190 //店铺装修,添加额外参数
1191 if (empty($params['shopId']) && isset($_REQUEST['shopId'])) { 1191 if (empty($params['shopId']) && isset($_REQUEST['shopId'])) {
@@ -1336,7 +1336,7 @@ class HelperSearch @@ -1336,7 +1336,7 @@ class HelperSearch
1336 if (!empty($urlParam)) { 1336 if (!empty($urlParam)) {
1337 $url[0] .= '?' . http_build_query($urlParam); 1337 $url[0] .= '?' . http_build_query($urlParam);
1338 } 1338 }
1339 - return $url[0]; 1339 + return Helpers::getUrlSafe($url[0]);
1340 } 1340 }
1341 1341
1342 /** 1342 /**
@@ -581,7 +581,7 @@ class Helpers @@ -581,7 +581,7 @@ class Helpers
581 if(!empty($url) && stripos($url, '?') !== false){ 581 if(!empty($url) && stripos($url, '?') !== false){
582 $extra = '&channel='.$channel; 582 $extra = '&channel='.$channel;
583 } 583 }
584 - return $url . $extra; 584 + return self::getUrlSafe($url . $extra);
585 } 585 }
586 586
587 587
@@ -84,7 +84,7 @@ class IndexModel @@ -84,7 +84,7 @@ class IndexModel
84 84
85 $banner = BrandData::getByNodeContent($code); 85 $banner = BrandData::getByNodeContent($code);
86 if (isset($banner['code']) && !empty($banner['data'])) { 86 if (isset($banner['code']) && !empty($banner['data'])) {
87 - return $banner['data']; 87 + return strtr($banner['data'], array('http://' => '//'));
88 } 88 }
89 } 89 }
90 } 90 }