Authored by Rock Zhang

pull codes

... ... @@ -36,21 +36,6 @@ class BrandData
}
/**
* 获取品牌页顶部楼层数据
*
* @return array 品牌也顶部楼层数据
*/
public static function getBrandTopData()
{
// 构建必传参数
$param = Yohobuy::param();
$param['content_code'] = 'ce6ac059493ec26241a8cbe0bfa1b17a';
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::SERVICE_URL . 'operations/api/v5/resource/get', $param);
}
/**
* 获取品牌介绍
*
* @param integer $brandId 品牌ID
... ... @@ -70,13 +55,15 @@ class BrandData
/**
* 获取品牌banner数据
* @param integer $brandId 品牌ID
* @param integer $uid 用户id
* @return array banner数据
*/
public static function getBrandBanner($brandId)
public static function getBrandBanner($brandId, $uid)
{
// 构建必传参数
$param = Yohobuy::param();
$param['brand_id'] = $brandId;
$param['uid'] = $uid;
$param['method'] = 'app.brand.banner';
$param['client_secret'] = Sign::getSign($param);
... ...
... ... @@ -37,22 +37,33 @@ class SearchData
/**
* 根据跟定查询数据搜索数据列表
*
* @param string $query 查询条件
* @param string $query 查询条件, 默认为null
* @param string $brand 品牌,默认为null
* @param string $gender 性别,默认为null,"1,3"表示男, "2,3"表示女, "1,2,3"表示全部
* @param string $p_d 折扣,默认为null
* @param string $misort 商品分类,默认为null
* @param string $msort 商品分类,默认为null
* @param string $order 排序方式,默认为按照时间倒序排列s_t_desc,
* s_t_asc表示按时间正序排列,s_p_asc表示按价格正序排列,
* s_t_desc表示按价格倒序排列,
* s_t_asc表示按时间正序排列,
* s_p_asc表示按价格正序排列,
* s_p_desc表示按价格倒序排列,
* p_d_asc表示按折扣正序排列,
* p_d_desc表示按折扣倒序排列
* @param integer $page 指定查询是多少页,默认为第一页
* @param integer $limit 指定查询多少个,默认是60哥
* @return array 搜索到的数据
*/
public static function searchLiDatas($query, $order = 's_t_desc', $page = 1, $limit = 60)
public static function searchLiDatas($query = null, $brand = null, $gender = null, $p_d = null, $misort = null, $msort = null, $order = 's_t_desc', $page = 1, $limit = 60)
{
// 构建必传参数
$param = Yohobuy::param();
$param['query'] = $query;
is_null($query) || $param['query'] = $query;
is_null($brand) || $param['brand'] = $brand;
is_null($gender) || $param['gender'] = $gender;
is_null($p_d) || $param['p_d'] = $p_d;
is_null($misort) || $param['misort'] = $misort;
is_null($msort) || $param['msort'] = $msort;
$param['method'] = 'app.search.li';
$param['order'] = $order;
$param['page'] = $page;
... ...
... ... @@ -22,6 +22,7 @@ class BoysController extends AbstractAction
// 渲染模板并输出
$this->_view->display('index', array(
'searchUrl' => '/search',
'boysHomePage' => true,
'maybeLike' => true,
'content' => Index\HomeModel::getBoysFloor()
... ...
... ... @@ -22,6 +22,7 @@ class GirlsController extends AbstractAction
// 渲染模板并输出
$this->_view->display('index', array(
'searchUrl' => '/search',
'grilsHomePage' => true,
'maybeLike' => true,
'content' => Index\HomeModel::getGirlsFloor()
... ...
... ... @@ -22,6 +22,7 @@ class KidsController extends AbstractAction
// 渲染模板并输出
$this->_view->display('index', array(
'searchUrl' => '/search',
'kidsHomePage' => true,
'maybeLike' => true,
'content' => Index\HomeModel::getKidsFloor()
... ...
... ... @@ -22,6 +22,7 @@ class LifestyleController extends AbstractAction
// 渲染模板并输出
$this->_view->display('index', array(
'searchUrl' => '/search',
'lifestyleHomePage' => true,
'maybeLike' => true,
'content' => Index\HomeModel::getLifestyleFloor()
... ...
... ... @@ -57,7 +57,7 @@ class SearchController extends AbstractAction
$result = SearchData::searchFuzzyDatas($keyword);
$this->echoJson($result);
$this->_view->display('list', array('searchPage' => true, 'pageFooter' => true));
}
}
... ... @@ -68,9 +68,23 @@ class SearchController extends AbstractAction
*/
public function listsearch()
{
$query = $this->get('query', '');
$result = SearchData::searchLiDatas($query);
$this->echoJson($result);
}
/**
* 根据指定条件筛选查询到数据
*
* @return array 筛选之后的结果
*/
public function sortsearch()
{
if($this->isAjax())
{
$query = $this->get('query', '');
$query = $this->post('query', '');
$result = SearchData::searchLiDatas($query);
... ...
<?php
use Action\AbstractAction;
use LibModels\Wap\Product\SearchData;
use LibModels\Wap\Category\BrandData;
use Plugin\DataProcess\ListProcess;
/**
* 商品列表页
*/
class ListController extends AbstractAction
{
public function indexAction()
... ... @@ -13,97 +15,72 @@ class ListController extends AbstractAction
$data = array(
'goodListPage' => true,
'goodList' => array(
'search' => 'Aape',
'brandWay' => array(
'url' => 'http://aape.m.yohobuy.com/',
'name' => 'Aape',
'thumb' => 'http://img13.static.yhbimg.com/brandLogo/2015/08/26/15/02261f64c198cb4b181c5ef9e61f38f4b9.jpg?imageMogr2/thumbnail/150x70/extent/150x70/background/d2hpdGU=/position/center/quality/90'
),
'new' => array(
array(
'id' => 1,
'thumb' => 'http://img13.static.yhbimg.com/goodsimg/2015/09/15/03/02e50b1037b45b90aa8f33ee328b18facf.jpg?imageMogr2/thumbnail/290x388/extent/290x388/background/d2hpdGU=/position/center/quality/90',
'url' => '',
'name' => 'Aape X YO’HOOD moon face YOH',
'salePrice' => 599,
'tags' => array(
'is_new' => true,
'is_discount' => true
),
'is_soon_sold_out' => true
),
array(
'id' => 2,
'thumb' => 'http://img10.static.yhbimg.com/goodsimg/2015/09/15/03/0101b0c3998752d02724a5512c6efcb241.jpg?imageMogr2/thumbnail/290x388/extent/290x388/background/d2hpdGU=/position/center/quality/90',
'url' => '',
'name' => 'Aape X YO’HOOD moon face YOH',
'salePrice' => 99,
'tags' => array(
'is_yohoood' => true
),
'is_soon_sold_out' => true
)
),
'filter' => array(
array(
'classify' => array(
array(
'title' => '性别',
'name' => '全部性别',
'default' => true,
'subs' => array(
array(
'chosed' => true,
'dataId' => 0,
'name' => '全部性别'
),
array(
'dataId' => 1,
'name' => '男'
),
array(
'dataId' => 3,
'name' => '女'
)
)
),
array(
'title' => '尺寸',
'name' => 'XL',
'subs' => array(
array(
'dataId' => 0,
'name' => '全部尺寸'
),
array(
'dataId' => 1,
'name' => 'S'
),
array(
'dataId' => 2,
'name' => 'M'
),
array(
'dataId' => 3,
'name' => 'L'
),
array(
'chosed' => true,
'dataId' => 4,
'name' => 'XL'
),
array(
'dataId' => 5,
'name' => 'XXL'
)
)
)
)
)
);
$brand = $this->get('brand', null);
$gender = $this->get('gender', null);
$p_d = $this->get('p_d', null);
$misort = $this->get('misort', null);
$msort = $this->get('msort', null);
// 查询数据
$listData = SearchData::searchLiDatas(null, $brand, $gender, $p_d, $misort, $msort);
// 处理返回的数据
if (isset($listData['code']) && $listData['code'] == 200) {
$tmpData = $listData['data'];
$data['goodList'] = ListProcess::getListData($tmpData);
}
$this->_view->display('index', $data);
}
public function brandAction()
{
$brand = $this->get('brand', null);
$gender = $this->get('gender', null);
$sort = $this->get('sort', null);
$color = $this->get('color', null);
$size = $this->get('size', null);
$price = $this->get('price', null);
$p_d = $this->get('p_d', null);
$data = array(
'goodListPage' => true,
'goodList' => array(
'brand' => array(
'id' => $brand
)
)
);
// 获取品牌介绍信息
$introData = BrandData::getBrandIntro($brand);
if(isset($introData['code']) && $introData['code'] == 200)
{
$data['goodList']['intro'] = isset($introData['data']['brand_intro']) ? $introData['data']['brand_intro'] : '';
}
// 获取品牌banner的数据
$bannerData = BrandData::getBrandBanner($brand, 0);
if(isset($bannerData['code']) && $bannerData['code'] == 200)
{
$data['goodList']['banner'] = isset($bannerData['data']['banner']) ? $bannerData['data']['banner'] : '';
}
// 查询数据
$listData = BrandData::selectBrandDetail($gender, $brand, $sort, $color, $size, $price, $p_d);
// 处理返回的数据
if (isset($listData['code']) && $listData['code'] == 200) {
$tmpData = $listData['data'];
$data['goodList'] = ListProcess::getListData($tmpData);
}
$this->_view->display('index', $data);
}
}
... ...
... ... @@ -16,8 +16,10 @@ class NewsaleController extends AbstractAction
$data = array(
'newArrival' => true,
'header' => array(
'title' => '新品到着'
'pageHeader' => array(
'navBack' => true,
'navTitle' => '新品到着',
'navHome' => '/'
)
);
... ... @@ -74,8 +76,10 @@ class NewsaleController extends AbstractAction
$data = array(
'discount' => true,
'header' => array(
'title' => 'SALE'
'pageHeader' => array(
'navBack' => true,
'navTitle' => 'SALE',
'navHome' => '/'
)
);
... ...