...
|
...
|
@@ -70,7 +70,7 @@ class InfoModel |
|
|
{
|
|
|
$result = array();
|
|
|
//推荐商品列表
|
|
|
$goods = array();
|
|
|
$goods = $goodsGroup = array();
|
|
|
$result['pathNav'] = self::getCenterCrumb($article['article_title'], $channel);
|
|
|
//文章头部信息
|
|
|
$result['header']['title'] = $article['article_title'];
|
...
|
...
|
@@ -88,10 +88,12 @@ class InfoModel |
|
|
if (isset($data['contents']) && !empty($data['contents'])) {
|
|
|
foreach ($data['contents'] as $key => $val) {
|
|
|
foreach ($val as $type => $con) {
|
|
|
if ($type != 'goods') {
|
|
|
$result['content'][] = is_callable("self::$type") ? self::$type($con['data']) : '';
|
|
|
} else {
|
|
|
if ($type === 'goods') {
|
|
|
$goods = array_merge_recursive($goods, self::goods($con['data']));
|
|
|
} elseif ($type === 'goodsGroup') {
|
|
|
$goodsGroup = array_merge_recursive($goodsGroup, self::goodsGroup($con['data']));
|
|
|
} else {
|
|
|
$result['content'] = is_callable("self::$type") ? self::$type($con['data']) : '';
|
|
|
}
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -99,6 +101,9 @@ class InfoModel |
|
|
if (!empty($goods)) {
|
|
|
$result['content'][] = array('relatedReco'=>array('recos'=>$goods));
|
|
|
}
|
|
|
if (!empty($goodsGroup)) {
|
|
|
$result['content']['relatedReco'] = $goodsGroup;
|
|
|
}
|
|
|
//赞、收藏
|
|
|
if (isset($data['baseInfo']) && !empty($data['baseInfo'])) {
|
|
|
$result['userInfo']['isLike'] = $data['baseInfo']['isPraise'] == 'Y' ? true : false;
|
...
|
...
|
@@ -182,20 +187,21 @@ class InfoModel |
|
|
*/
|
|
|
public static function goodsGroup($goodsGroup)
|
|
|
{
|
|
|
$result = $groupSkn = $productSkn = array();
|
|
|
$result = $groupSkn = array();
|
|
|
foreach ($goodsGroup as $key => $val) {
|
|
|
if (!isset($val['list']) || empty($val['list'])) {
|
|
|
continue;
|
|
|
}
|
|
|
$productSkn = array();
|
|
|
foreach ($val['list'] as $k => $v) {
|
|
|
$groupSkn[$key][] = $v['id'];
|
|
|
$productSkn[] = $v['id'];
|
|
|
}
|
|
|
}
|
|
|
if (!empty($productSkn)) {
|
|
|
$product = SearchData::searchElasticByCondition(array('query' => implode(',', $productSkn)));
|
|
|
if (isset($product['data']['product_list'])) {
|
|
|
$result['relatedReco']['recos'] = array_slice(self::formatProduct($product['data']['product_list']), 0, 4);
|
|
|
$result[$key]['recos'] = array_slice(self::formatProduct($product['data']['product_list']), 0, 4);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return $result;
|
...
|
...
|
|