Authored by biao

Merge branch 'hotfix/relatedBrand'

@@ -14,7 +14,7 @@ class InfoController extends AbstractAction @@ -14,7 +14,7 @@ class InfoController extends AbstractAction
14 14
15 /** 15 /**
16 * 详情页 16 * 详情页
17 - * 17 + *
18 * @param int id 内容ID 18 * @param int id 内容ID
19 */ 19 */
20 public function indexAction() 20 public function indexAction()
@@ -46,7 +46,7 @@ class InfoController extends AbstractAction @@ -46,7 +46,7 @@ class InfoController extends AbstractAction
46 if (isset($detail['code']) && $detail['code'] === 400) { 46 if (isset($detail['code']) && $detail['code'] === 400) {
47 $this->error(); 47 $this->error();
48 } 48 }
49 - 49 +
50 if (empty($detail['getArticle'])) { 50 if (empty($detail['getArticle'])) {
51 $this->_view->display('index', $data); 51 $this->_view->display('index', $data);
52 return; 52 return;
@@ -180,9 +180,11 @@ class InfoController extends AbstractAction @@ -180,9 +180,11 @@ class InfoController extends AbstractAction
180 // 相关品牌 180 // 相关品牌
181 if (!empty($detail['getBrand'])) { 181 if (!empty($detail['getBrand'])) {
182 $data['relatedBrand'] = $detail['getBrand']; 182 $data['relatedBrand'] = $detail['getBrand'];
183 - foreach ($data['relatedBrand'] as &$value) {  
184 - $value['thumb'] = strtr($value['thumb'], array('http://' => '//')); 183 +
  184 + foreach ($data['relatedBrand'] as $key => $value) {
  185 + $data['relatedBrand'][$key]['thumb'] = strtr($value['thumb'], array('http://' => '//'));
185 } 186 }
  187 +
186 } 188 }
187 189
188 // 相关标签 190 // 相关标签
@@ -223,6 +225,7 @@ class InfoController extends AbstractAction @@ -223,6 +225,7 @@ class InfoController extends AbstractAction
223 // 标识有微信分享 225 // 标识有微信分享
224 $data['hasWxShare'] = true; 226 $data['hasWxShare'] = true;
225 227
  228 +
226 $this->_view->display('index', $data); 229 $this->_view->display('index', $data);
227 230
228 $detail = array(); 231 $detail = array();
@@ -231,7 +234,7 @@ class InfoController extends AbstractAction @@ -231,7 +234,7 @@ class InfoController extends AbstractAction
231 234
232 /** 235 /**
233 * APP里使用的收藏内容的接口 236 * APP里使用的收藏内容的接口
234 - * 237 + *
235 * @param id 资讯ID 238 * @param id 资讯ID
236 * @param type "fav"表示收藏 或者 "cancel"表示取消收藏 239 * @param type "fav"表示收藏 或者 "cancel"表示取消收藏
237 * @return json 240 * @return json
@@ -277,7 +280,7 @@ class InfoController extends AbstractAction @@ -277,7 +280,7 @@ class InfoController extends AbstractAction
277 // 单张图 280 // 单张图
278 elseif (isset($value['singleImage'])) { 281 elseif (isset($value['singleImage'])) {
279 $build['bigImage'] = Helpers::getImageUrl($value['singleImage']['data'][0]['src'], 640, 640); 282 $build['bigImage'] = Helpers::getImageUrl($value['singleImage']['data'][0]['src'], 640, 640);
280 - } 283 + }
281 elseif (isset($value['smallPic']['data'])) { 284 elseif (isset($value['smallPic']['data'])) {
282 $imgs = $value['smallPic']['data']; 285 $imgs = $value['smallPic']['data'];
283 $build['smallImage'] = array( 286 $build['smallImage'] = array(
@@ -356,6 +359,7 @@ class InfoController extends AbstractAction @@ -356,6 +359,7 @@ class InfoController extends AbstractAction
356 $data['relatedBrand'] = $detail['getBrand']; 359 $data['relatedBrand'] = $detail['getBrand'];
357 } 360 }
358 361
  362 +
359 // 分享参数 363 // 分享参数
360 if (isset($detail['getArticle']['cover_image'])) { 364 if (isset($detail['getArticle']['cover_image'])) {
361 $data['shareLink'] = Helpers::url('/info/index', array('id' => $id), 'guang'); 365 $data['shareLink'] = Helpers::url('/info/index', array('id' => $id), 'guang');
@@ -376,36 +380,36 @@ class InfoController extends AbstractAction @@ -376,36 +380,36 @@ class InfoController extends AbstractAction
376 $detail = array(); 380 $detail = array();
377 $data = array(); 381 $data = array();
378 } 382 }
379 - 383 +
380 /** 384 /**
381 * 提供给YOHO资讯站调用的接口 385 * 提供给YOHO资讯站调用的接口
382 - * 386 + *
383 * @param int id 逛内容ID 387 * @param int id 逛内容ID
384 * @return json 388 * @return json
385 */ 389 */
386 public function foryohoAction() 390 public function foryohoAction()
387 { 391 {
388 $result = array(); 392 $result = array();
389 - 393 +
390 do { 394 do {
391 /* 判断参数是否有效 */ 395 /* 判断参数是否有效 */
392 $id = $this->get('id'); 396 $id = $this->get('id');
393 if (!is_numeric($id)) { 397 if (!is_numeric($id)) {
394 break; 398 break;
395 } 399 }
396 - 400 +
397 $app = $this->get('app'); 401 $app = $this->get('app');
398 $isApp = empty($app) ? false : true; 402 $isApp = empty($app) ? false : true;
399 - 403 +
400 /* 判断是否有内容 */ 404 /* 判断是否有内容 */
401 $detail = DetailData::package($id, $isApp); 405 $detail = DetailData::package($id, $isApp);
402 if (empty($detail['getArticleContent'])) { 406 if (empty($detail['getArticleContent'])) {
403 break; 407 break;
404 } 408 }
405 - 409 +
406 /* 品牌信息 */ 410 /* 品牌信息 */
407 $result['brand'] = $detail['getBrand']; 411 $result['brand'] = $detail['getBrand'];
408 - 412 +
409 $build = array(); 413 $build = array();
410 $good = array(); 414 $good = array();
411 $skns = array(); 415 $skns = array();
@@ -421,7 +425,7 @@ class InfoController extends AbstractAction @@ -421,7 +425,7 @@ class InfoController extends AbstractAction
421 // 单张图 425 // 单张图
422 elseif (isset($value['singleImage'])) { 426 elseif (isset($value['singleImage'])) {
423 $build['bigImage'] = Helpers::getImageUrl($value['singleImage']['data'][0]['src'], 640, 640); 427 $build['bigImage'] = Helpers::getImageUrl($value['singleImage']['data'][0]['src'], 640, 640);
424 - } 428 + }
425 elseif (isset($value['smallPic']['data'])) { 429 elseif (isset($value['smallPic']['data'])) {
426 $imgs = $value['smallPic']['data']; 430 $imgs = $value['smallPic']['data'];
427 $build['smallImage'] = array( 431 $build['smallImage'] = array(
@@ -482,15 +486,15 @@ class InfoController extends AbstractAction @@ -482,15 +486,15 @@ class InfoController extends AbstractAction
482 elseif (isset($value['link'])) { 486 elseif (isset($value['link'])) {
483 $build['moreLink'] = $value['link']['data'][0]['url']; 487 $build['moreLink'] = $value['link']['data'][0]['url'];
484 } 488 }
485 - 489 +
486 // 内容详情 490 // 内容详情
487 if (array() !== $build) { 491 if (array() !== $build) {
488 $result['content'][] = $build; 492 $result['content'][] = $build;
489 } 493 }
490 } 494 }
491 - } 495 + }
492 while (false); 496 while (false);
493 - 497 +
494 $this->echoJson($result); 498 $this->echoJson($result);
495 } 499 }
496 500