Authored by Rock Zhang

修改新品,折扣模块的数据处理,添加频道选择页的数据格式

framework @ 119c247f
Subproject commit 75bbc3b075de19f239532f60c5995d06c5f814e2
Subproject commit 119c247f5cf929aa1e059e40609bb16dd6b58f05
... ...
... ... @@ -264,36 +264,4 @@ class FloorProcess
return array('plusStar'=>$data['data']);
}
/**
* 也许喜欢数据处理方法
* @param array $data 也许喜欢数据
* @param $type 类型 默认1:男首页 2:女首页 3:kids 4:lifestyle
* @return array 处理之后的也许喜欢数据
*/
private static function maybeLike($data, $type)
{
$result = array('goods'=>array());
foreach ($data as $one) {
$product = array();
$product['id'] = $one['brand_id'];
$product['thumb'] = Helpers::getImageUrl($one['default_images'], 235, 314, 1);
$product['price'] = $one['market_price'];
$product['salePrice'] = $one['sales_price'];
// 处理tags
$product['tags'] = array();
foreach ($one['tags'] as $val) {
$product['tags'][$val] = 1;
}
$product['is_soon_sold_out'] = $one['is_soon_sold_out'];
$product['name'] = $one['product_name'];
$product['url'] = $one['product_skn'];
$result['goods'][] = $product;
}
return $result;
}
}
... ...
... ... @@ -48,18 +48,7 @@ class NewSaleProcess
{
foreach ($single['product_list'] as $value)
{
$oneProduct = array();
$oneProduct['id'] = $value['product_skn'];
$oneProduct['thumb'] = Helpers::getImageUrl($value['default_images'], 290, 388, 1);
$oneProduct['name'] = $value['product_name'];
$oneProduct['price'] = $value['market_price'];
$oneProduct['salePrice'] = $value['sales_price'];
$oneProduct['isSale'] = ($value['is_discount'] === 'N' ? false : true);
$oneProduct['isFew'] = ($value['is_soon_sold_out'] === 'N' ? false : true);
$oneProduct['isNew'] = ($value['is_new'] === 'N' ? false : true);
$oneProduct['url'] = $value['product_skn'];
$productsLi['goods'][] = $oneProduct;
$productsLi['goods'][] = Helpers::formatProduct($value);
}
}
... ... @@ -75,6 +64,19 @@ class NewSaleProcess
return $result;
}
public static function selectData($data)
{
$result = array('goods'=>array());
if($data['code'] === 200)
{
foreach ($data['data']['product_list'] as $val) {
$result['goods'][] = Helpers::formatProduct($val);
}
}
return $result;
}
/**
* 处理页面顶部焦点图数据
*
... ...
{{# goods}}
{{> good}}
{{/ goods}}
\ No newline at end of file
... ...
... ... @@ -14,22 +14,34 @@ class IndexController extends AbstractAction
*/
public function indexAction()
{
// 启动滚动图
$startBannerData = IndexData::getBannerStart();
$startBanner = array();
if ($startBannerData['code'] == 200) {
foreach ($startBannerData['data'] as $single) {
$startBanner = $single['data'];
}
}
// 用户个人信息
$userProfile = IndexData::getUserProfile(0);
/* echo '<pre>';
var_dump($homeChannels);exit; */
$data = array(
'channels' => array(
array(
'name' => '男生',
'name_en' => 'BOYS',
'url' => '/boys'
),
array(
'name' => '男生',
'name_en' => 'BOYS',
'url' => '/boys'
),
array(
'name' => '男生',
'name_en' => 'BOYS',
'url' => '/boys'
),
array(
'name' => '男生',
'name_en' => 'BOYS',
'url' => '/boys'
),
)
);
$this->_view->assign('title', 'YOHO!有货');
$this->_view->display('index', compact('startBanner', 'userProfile'));
$this->_view->display('index', $data);
}
}
... ...
... ... @@ -228,32 +228,34 @@ class NewsaleController extends AbstractAction
$this->_view->display('new', $data);
}
/**
* Ajax方式筛选新品到着、折扣专区商品
*
* @return array 根据指定条件筛选之后的商品
*/
public function selectNewAction()
public function selectNewSaleAction()
{
if($this->isAjax())
{
$gender = $this->get('gender', '1,3');
$brand = $this->get('brand', 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);
$channel = $this->get('channel', '1');
$dayLimit = $this->get('dayLimit', '1');
$limit = $this->get('limit', 50);
$page = $this->get('page', 1);
/*if($this->isAjax())
{*/
$gender = $this->get('gender', '1,3');
$brand = $this->get('brand', 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);
$channel = $this->get('channel', '1');
$dayLimit = $this->get('dayLimit', '1');
$limit = $this->get('limit', 50);
$page = $this->get('page', 1);
$data = Newsale::selectNewSaleProducts($gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page);
$data = Newsale::selectNewSaleProducts($gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page);
$this->returnJson(200, '获取成功', $data);
}
$result = NewSaleProcess::selectData($data);
$this->_view->display('product', $result);
// $this->returnJson(200, '获取成功', $data);
// }
}
/**
... ...