Authored by 毕凯

Merge branch 'feature/skc' into release/4.4

... ... @@ -93,7 +93,7 @@ class DetailData
$article = $result['data'];
// file_put_contents('../../../../../../Desktop/app/n/getArticle3.txt', var_export($article, true));
if (!isset($article['author_id'])) {
if (USE_CACHE && !isset($article['author_id'])) {
// 再尝试获取二级缓存(slave), 有数据则直接返回.
$cached = Cache::get($key, 'slave');
if (!empty($cached)) {
... ...
... ... @@ -4,6 +4,7 @@ use Action\AbstractAction;
use LibModels\Wap\Guang\DetailData;
use LibModels\Wap\Product\ListData;
use Plugin\Helpers;
use Plugin\Images;
/**
* 逛详情页
... ... @@ -42,7 +43,6 @@ class InfoController extends AbstractAction
// 获取详情内容信息, 异常则跳到错误页面
$detail = array();
$detail = DetailData::package($id, $isApp);
if (isset($detail['code']) && $detail['code'] === 400) {
$this->error();
}
... ... @@ -95,11 +95,13 @@ class InfoController extends AbstractAction
}
// 相关推荐
elseif (isset($value['goods']['data'])) {
$good = array();
$reco = array();
// 遍历取得SKN
$skns = array();
$arr = array();
foreach ($value['goods']['data'] as $goods) {
$skns[] = $goods['id'];
$arr[$goods['id']]=$goods['src'];
}
// 通过SKN获取商品信息
$product = ListData::productInfoBySkns($skns);
... ... @@ -109,38 +111,58 @@ class InfoController extends AbstractAction
if ($i > 3) {
break;
}
$good[] = Helpers::formatProduct($goods, false, true, true, 235, 314, $isApp);
$d[] = Helpers::formatProduct($goods, false, true, true, 235, 314, $isApp);
}
foreach ($arr as $k=>$v) {
foreach ($d as $key=>$value) {
if ($k == $value['id']) {
$value['thumb'] = Images::getImageUrl($v,235,314);
$reco[] = $value;
}
}
}
}
// 没有商品
if (!isset($i)) {
continue;
}
// 单个商品
elseif ($i === 0 && isset($good[0])) {
elseif ($i === 0 && isset($reco[0])) {
$build['relatedReco'] = $good[0];
}
// 多个商品
else {
$build['relatedReco'] = $good;
$build['relatedReco'] = $reco;
}
}
// 悬停浮动商品
elseif (isset($value['goodsGroup']['data'])) {
$goods =array();
foreach ($value['goodsGroup']['data'] as $goods) {
$good = array();
$good['thumb'] = Helpers::getImageUrl($goods['cover']['cover'], 235, 314);
$good['type'] = Helpers::getProductIcon($goods['cover']['maxSortId']);
$good['goods'] = array();
$skns = array();
$arr = array();
foreach ($goods['list'] as $mini) {
$skns[] = $mini['id'];
$arr[$mini['id']]=$mini['src'];
}
// 通过SKN获取商品信息
$product = ListData::productInfoBySkns($skns);
if (!empty($product['data']['product_list'])) {
foreach ($product['data']['product_list'] as $i => $goods) {
$good['goods'][] = Helpers::formatProduct($goods, false, true, true, 235, 314, $isApp);
$g[] = Helpers::formatProduct($goods, false, true, true, 235, 314, $isApp);
}
foreach ($arr as $k=>$v) {
foreach ($g as $key=>$value) {
if ($k == $value['id']) {
$value['thumb'] = Images::getImageUrl($v,235,314);
$good['goods'][] = $value;
}
}
}
$build['collocation'][] = $good;
}
... ...