Authored by 刘传洋

guagn zhuanti

@@ -359,7 +359,7 @@ class Helpers @@ -359,7 +359,7 @@ class Helpers
359 $result['id'] = $articleData['id']; 359 $result['id'] = $articleData['id'];
360 $result['classification'] = $articleData['category_name']; 360 $result['classification'] = $articleData['category_name'];
361 $result['isReco'] = $articleData['is_recommended'] ? true : false; 361 $result['isReco'] = $articleData['is_recommended'] ? true : false;
362 - $result['url'] = $isApp ? $articleData['url'] : self::url('/'.$articleData['id'].'.html', array(), 'guang'); 362 + $result['url'] = self::getArticleUrl($articleData['url'], $articleData['id'], $isApp);
363 $result['img'] = self::getImageUrl($articleData['src'], $width, $height, 1); 363 $result['img'] = self::getImageUrl($articleData['src'], $width, $height, 1);
364 $result['isSquareImg'] = $isSquareImage; 364 $result['isSquareImg'] = $isSquareImage;
365 $result['title'] = $articleData['title']; 365 $result['title'] = $articleData['title'];
@@ -1146,4 +1146,34 @@ class Helpers @@ -1146,4 +1146,34 @@ class Helpers
1146 } 1146 }
1147 return 'http:'; 1147 return 'http:';
1148 } 1148 }
  1149 +
  1150 + /**
  1151 + * 获得文章 url
  1152 + * @param type string url 后台返回的url
  1153 + * @param type $productSkn 产品编号
  1154 + * @param type $productName 产品名称
  1155 + * @param type $cnAlphaBet
  1156 + * @return type url
  1157 + */
  1158 + public static function getArticleUrl($url, $id, $isApp = false)
  1159 + {
  1160 + $rurl;
  1161 +
  1162 + if(!empty($url)) {
  1163 +
  1164 + try {
  1165 + $jurl = json_decode($url);
  1166 +
  1167 + if(!empty($jurl) && !empty($jurl->url)) {
  1168 + $rurl = $jurl->url;
  1169 + }
  1170 + } catch(Exception $e){}
  1171 + }
  1172 +
  1173 + if(empty($rurl)) {
  1174 + $rurl = $isApp ? $url : self::url('/'.$id.'.html', array(), 'guang');
  1175 + }
  1176 +
  1177 + return $rurl;
  1178 + }
1149 } 1179 }
@@ -75,9 +75,9 @@ class IndexModel @@ -75,9 +75,9 @@ class IndexModel
75 $data = ListData::category(); 75 $data = ListData::category();
76 foreach($data['data'] as $category) 76 foreach($data['data'] as $category)
77 { 77 {
78 - if ($category['name'] == '专题') {  
79 - continue;  
80 - } 78 + // if ($category['name'] == '专题') {
  79 + // continue;
  80 + // }
81 81
82 $ret[] = array('typeId' => $category['id'],'type' => $category['name'], 82 $ret[] = array('typeId' => $category['id'],'type' => $category['name'],
83 'isActive' => $currentSortId == $category['id'] ? true :false, 83 'isActive' => $currentSortId == $category['id'] ? true :false,
@@ -153,7 +153,7 @@ class IndexModel @@ -153,7 +153,7 @@ class IndexModel
153 if(!empty($data['data'])) { 153 if(!empty($data['data'])) {
154 foreach($data['data'] as $key => $article) { 154 foreach($data['data'] as $key => $article) {
155 $list[] = array( 155 $list[] = array(
156 - 'url' => Helpers::url('/'.$article['id'].'.html', '', 'guang'), 156 + 'url' => Helpers::getArticleUrl($article['url'], $article['id']), //Helpers::url('/'.$article['id'].'.html', '', 'guang'),
157 'title' => $article['title'] 157 'title' => $article['title']
158 ); 158 );
159 if (isset($article['src']) && !empty($article['src'])) { 159 if (isset($article['src']) && !empty($article['src'])) {
@@ -134,7 +134,7 @@ class InfoModel @@ -134,7 +134,7 @@ class InfoModel
134 foreach ($data['relate'] as $key => $val) { 134 foreach ($data['relate'] as $key => $val) {
135 $result['relatedPost'][$key]['title'] = $val['title']; 135 $result['relatedPost'][$key]['title'] = $val['title'];
136 $result['relatedPost'][$key]['thumb'] = Images::getImageUrl($val['thumb'], 264, 173, 1); 136 $result['relatedPost'][$key]['thumb'] = Images::getImageUrl($val['thumb'], 264, 173, 1);
137 - $result['relatedPost'][$key]['url'] = Helpers::url('/'.$val['id'].'.html', array(), 'guang'); 137 + $result['relatedPost'][$key]['url'] = Helpers::getArticleUrl($val['url'], $val['id']); //Helpers::url('/'.$val['id'].'.html', array(), 'guang');
138 } 138 }
139 } 139 }
140 //精彩推荐 140 //精彩推荐
@@ -142,7 +142,7 @@ class InfoModel @@ -142,7 +142,7 @@ class InfoModel
142 foreach ($data['recommend'] as $key => $val) { 142 foreach ($data['recommend'] as $key => $val) {
143 $result['exRecos'][$key]['title'] = $val['title']; 143 $result['exRecos'][$key]['title'] = $val['title'];
144 $result['exRecos'][$key]['img'] = isset($val['src']) ? Images::getImageUrl($val['src'], 90, 60) : ''; 144 $result['exRecos'][$key]['img'] = isset($val['src']) ? Images::getImageUrl($val['src'], 90, 60) : '';
145 - $result['exRecos'][$key]['url'] = Helpers::url('/'.$val['id'].'.html', array(), 'guang'); 145 + $result['exRecos'][$key]['url'] = Helpers::getArticleUrl($val['url'], $val['id']); //Helpers::url('/'.$val['id'].'.html', array(), 'guang');
146 } 146 }
147 } 147 }
148 //热门标签 148 //热门标签