...
|
...
|
@@ -14,7 +14,7 @@ class InfoController extends AbstractAction |
|
|
|
|
|
/**
|
|
|
* 详情页
|
|
|
*
|
|
|
*
|
|
|
* @param int id 内容ID
|
|
|
*/
|
|
|
public function indexAction()
|
...
|
...
|
@@ -46,7 +46,7 @@ class InfoController extends AbstractAction |
|
|
if (isset($detail['code']) && $detail['code'] === 400) {
|
|
|
$this->error();
|
|
|
}
|
|
|
|
|
|
|
|
|
if (empty($detail['getArticle'])) {
|
|
|
$this->_view->display('index', $data);
|
|
|
return;
|
...
|
...
|
@@ -180,9 +180,11 @@ class InfoController extends AbstractAction |
|
|
// 相关品牌
|
|
|
if (!empty($detail['getBrand'])) {
|
|
|
$data['relatedBrand'] = $detail['getBrand'];
|
|
|
foreach ($data['relatedBrand'] as &$value) {
|
|
|
$value['thumb'] = strtr($value['thumb'], array('http://' => '//'));
|
|
|
|
|
|
foreach ($data['relatedBrand'] as $key => $value) {
|
|
|
$data['relatedBrand'][$key]['thumb'] = strtr($value['thumb'], array('http://' => '//'));
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
// 相关标签
|
...
|
...
|
@@ -223,6 +225,7 @@ class InfoController extends AbstractAction |
|
|
// 标识有微信分享
|
|
|
$data['hasWxShare'] = true;
|
|
|
|
|
|
|
|
|
$this->_view->display('index', $data);
|
|
|
|
|
|
$detail = array();
|
...
|
...
|
@@ -231,7 +234,7 @@ class InfoController extends AbstractAction |
|
|
|
|
|
/**
|
|
|
* APP里使用的收藏内容的接口
|
|
|
*
|
|
|
*
|
|
|
* @param id 资讯ID
|
|
|
* @param type "fav"表示收藏 或者 "cancel"表示取消收藏
|
|
|
* @return json
|
...
|
...
|
@@ -277,7 +280,7 @@ class InfoController extends AbstractAction |
|
|
// 单张图
|
|
|
elseif (isset($value['singleImage'])) {
|
|
|
$build['bigImage'] = Helpers::getImageUrl($value['singleImage']['data'][0]['src'], 640, 640);
|
|
|
}
|
|
|
}
|
|
|
elseif (isset($value['smallPic']['data'])) {
|
|
|
$imgs = $value['smallPic']['data'];
|
|
|
$build['smallImage'] = array(
|
...
|
...
|
@@ -356,6 +359,7 @@ class InfoController extends AbstractAction |
|
|
$data['relatedBrand'] = $detail['getBrand'];
|
|
|
}
|
|
|
|
|
|
|
|
|
// 分享参数
|
|
|
if (isset($detail['getArticle']['cover_image'])) {
|
|
|
$data['shareLink'] = Helpers::url('/info/index', array('id' => $id), 'guang');
|
...
|
...
|
@@ -376,36 +380,36 @@ class InfoController extends AbstractAction |
|
|
$detail = array();
|
|
|
$data = array();
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 提供给YOHO资讯站调用的接口
|
|
|
*
|
|
|
*
|
|
|
* @param int id 逛内容ID
|
|
|
* @return json
|
|
|
*/
|
|
|
public function foryohoAction()
|
|
|
{
|
|
|
$result = array();
|
|
|
|
|
|
|
|
|
do {
|
|
|
/* 判断参数是否有效 */
|
|
|
$id = $this->get('id');
|
|
|
if (!is_numeric($id)) {
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
|
|
|
$app = $this->get('app');
|
|
|
$isApp = empty($app) ? false : true;
|
|
|
|
|
|
|
|
|
/* 判断是否有内容 */
|
|
|
$detail = DetailData::package($id, $isApp);
|
|
|
if (empty($detail['getArticleContent'])) {
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
|
|
|
/* 品牌信息 */
|
|
|
$result['brand'] = $detail['getBrand'];
|
|
|
|
|
|
|
|
|
$build = array();
|
|
|
$good = array();
|
|
|
$skns = array();
|
...
|
...
|
@@ -421,7 +425,7 @@ class InfoController extends AbstractAction |
|
|
// 单张图
|
|
|
elseif (isset($value['singleImage'])) {
|
|
|
$build['bigImage'] = Helpers::getImageUrl($value['singleImage']['data'][0]['src'], 640, 640);
|
|
|
}
|
|
|
}
|
|
|
elseif (isset($value['smallPic']['data'])) {
|
|
|
$imgs = $value['smallPic']['data'];
|
|
|
$build['smallImage'] = array(
|
...
|
...
|
@@ -482,15 +486,15 @@ class InfoController extends AbstractAction |
|
|
elseif (isset($value['link'])) {
|
|
|
$build['moreLink'] = $value['link']['data'][0]['url'];
|
|
|
}
|
|
|
|
|
|
|
|
|
// 内容详情
|
|
|
if (array() !== $build) {
|
|
|
$result['content'][] = $build;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
while (false);
|
|
|
|
|
|
|
|
|
$this->echoJson($result);
|
|
|
}
|
|
|
|
...
|
...
|
|