Authored by 周少峰

use api url

@@ -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'] = self::getArticleUrl($articleData['url'], $articleData['id'], $isApp); 362 + $result['url'] = $articleData['url'] ? $articleData['url'] : self::url('/'.$articleData['id'].'.html', array(), 'guang');
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,20 +1146,4 @@ class Helpers @@ -1146,20 +1146,4 @@ class Helpers
1146 } 1146 }
1147 return 'http:'; 1147 return 'http:';
1148 } 1148 }
1149 -  
1150 - /**  
1151 - * 获得文章 url  
1152 - * @param string url 后台返回的url  
1153 - * @param int $id 文章id  
1154 - * @return string $rurl  
1155 - */  
1156 - public static function getArticleUrl($url, $id)  
1157 - {  
1158 - $jurl = json_decode($url, true);  
1159 - if(!empty($jurl) && isset($jurl['url']) && !empty($jurl['url'])) {  
1160 - return $jurl['url'];  
1161 - } else {  
1162 - return self::url('/'.$id.'.html', array(), 'guang');  
1163 - }  
1164 - }  
1165 } 1149 }
@@ -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::getArticleUrl($article['url'], $article['id']), //Helpers::url('/'.$article['id'].'.html', '', 'guang'), 156 + 'url' => $article['url'] ? $article['url'] : 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'])) {