|
|
<?php
|
|
|
|
|
|
namespace Product;
|
|
|
|
|
|
use Plugin\HelperSearch;
|
|
|
use Product\SearchModel;
|
|
|
use Api\Yohobuy;
|
|
|
|
|
|
/**
|
|
|
* list Index页模板数据模型
|
|
|
*
|
|
|
*/
|
|
|
class IndexModel
|
|
|
{
|
|
|
const URI_INDEX_TBANNER = '/shops/service/v1/searchbanner';
|
|
|
|
|
|
public static function getIndexData($customCondition, $customOptions)
|
|
|
{
|
|
|
$urlList = array();
|
|
|
$searchCondition = SearchModel::searchCondition($customCondition, $customOptions);
|
|
|
|
|
|
// 组合搜索商品url
|
|
|
$urlList['product'] = HelperSearch::getProductUrl($searchCondition['condition']);
|
|
|
|
|
|
// 组合搜索分类url
|
|
|
$urlList['sort'] = HelperSearch::getClassesUrl($searchCondition['condition']);
|
|
|
|
|
|
//用户浏览记录
|
|
|
//$urlList['reviewUrl'] = HelperSearch::getReviewUrl($searchCondition['condition']);
|
|
|
|
|
|
//批量调接口获取数据
|
|
|
$result = Yohobuy::getMulti($urlList, array(), true);
|
|
|
|
|
|
//调用接口获取list-index banner数据
|
|
|
$msort = $searchCondition['condition']['msort'];
|
|
|
$misort = $searchCondition['condition']['misort'];
|
|
|
$gender = $searchCondition['condition']['gender'] == '2,3' ? 2 : 1;
|
|
|
$bannerData = Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URI_INDEX_TBANNER, 'get', array(10,$msort,$misort,$gender,0,0,0,0,0));
|
|
|
|
|
|
// 组织模板数据
|
|
|
$data = HelperSearch::getList($result, $searchCondition['options']);
|
|
|
|
|
|
return $data;
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|