Authored by yangyang

完成list-index页banner

... ... @@ -663,7 +663,7 @@
keyEntry: [
{
name: '',
link: ''
url: ''
},
...
],
... ...
... ... @@ -31,18 +31,42 @@ class IndexModel
//批量调接口获取数据
$result = Yohobuy::getMulti($urlList, array(), true);
// 组织模板数据
$data = HelperSearch::getList($result, $searchCondition['options']);
//调用接口获取list-index banner数据
$msort = isset($searchCondition['condition']['msort']) ? $searchCondition['condition']['msort'] : false;
$misort = isset($searchCondition['condition']['misort']) ? $searchCondition['condition']['misort'] : false;
$positionId = isset($searchCondition['options']['positionId']) ? $searchCondition['options']['positionId'] : '';
$gender = $searchCondition['condition']['gender'] == '2,3' ? 2 : 1;
if ($msort && $misort) {
$bannerData = Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URI_INDEX_TBANNER, 'get', array(10,$msort,$misort,$gender,0,0,0,0,0));
$bannerData = Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URI_INDEX_TBANNER, 'get', array($positionId,$msort,$misort,$gender,0,0,0,0,0));
if (isset($bannerData['code']) && $bannerData['code'] == '200') {
$banner = self::formatBanner($bannerData['data']);
}
}
//插入banner数据
if (!empty($banner)) {
$data['sortIntro'] = $banner;
}
// 组织模板数据
$data = HelperSearch::getList($result, $searchCondition['options']);
return $data;
}
//组织list-index banner数据
public static function formatBanner($bannerData)
{
$banner = array();
$banner['name'] = $bannerData['title'];
$banner['enName'] = $bannerData['subtitle'];
$banner['desc'] = $bannerData['intro'];
$banner['img'] = $bannerData['logo'];
foreach($bannerData['keyword'] as $key => $vo){
$banner['keyEntry'][$key]['name'] = $vo['word'];
$banner['keyEntry'][$key]['url'] = $vo['url'];
}
return $banner;
}
}
... ...
... ... @@ -5,8 +5,12 @@ class ListController extends WebAction
{
public function indexAction()
{
//获取banner id
$positionId = 10; //搜素banner 位置id
$condition = array();
$options = array();
$options = array(
'positionId' => $positionId
);
$indexData = Product\IndexModel::getIndexData($condition, $options);
$data = array(
... ...