Authored by Rock Zhang

修改新品到着筛选有关的bug

... ... @@ -38,11 +38,12 @@ class NewsaleData
*
* @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
* @param string $channel 1表示男, 2表示女
* @param integer $limit 查询返回的最大限制数, 默认为50
* @param string $order 排序方式,默认s_t_desc表示按照时间倒序排列
* @param integer $limit 查询返回的最大限制数, 默认为60
* @param integer $page 分页第几页, 默认第1页
* @return array 新品到着商品数据
*/
public static function getNewProducts($gender, $channel, $limit = 50, $page = 1)
public static function getNewProducts($gender, $channel, $order = 's_t_desc', $limit = 60, $page = 1)
{
// 构建url地址列表
$urlList = array();
... ... @@ -50,6 +51,7 @@ class NewsaleData
$param = Yohobuy::param();
$param['method'] = 'app.search.newProduct';
$param['gender'] = $gender;
$param['order'] = $order;
$param['page'] = $page;
$param['limit'] = $limit;
$param['yh_channel'] = $channel;
... ... @@ -89,9 +91,11 @@ class NewsaleData
* @param integer $dayLimit 限制读取多少天,默认为1天
* @param integer $limit 查询返回的最大限制数, 默认为50
* @param integer $page 分页第几页, 默认第1页
* @param string $order 排序方式,默认s_t_desc表示按照时间倒序排列
*
* @return array 根据指定条件筛选出来的商品
*/
public static function selectNewSaleProducts($gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit = null, $limit = 50, $page = 1)
public static function selectNewSaleProducts($gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit = null, $limit = 60, $page = 1, $order = 's_t_desc')
{
$selectItems = array(
'gender' => $gender,
... ... @@ -112,6 +116,7 @@ class NewsaleData
$param['method'] = 'app.search.newProduct';
$param['page'] = $page;
$param['limit'] = $limit;
$param['order'] = $order;
$param['yh_channel'] = $channel;
$param = array_merge($param, $queriedParams);
... ...
... ... @@ -146,7 +146,7 @@ class FloorProcess
$build = array();
foreach ($data['list'] as $one) {
$build['url'] = Helpers::getFilterUrl($one['url']);
$build['img'] = Helpers::getImageUrl($one['src'], 140, 140);
$build['img'] = Helpers::getImageUrl($one['src'], 128, 140);
$build['textCn'] = $one['title'];
$result['hotCategory']['list'][] = $build;
}
... ...
... ... @@ -156,9 +156,9 @@ class ListProcess
)
);
foreach ($data as $one) {
foreach ($data as $key => $one) {
$discount = array();
$discount['dataId'] = $one['count'];
$discount['dataId'] = $key;
$discount['name'] = $one['name'] .'折商品';
$result['subs'][] = $discount;
... ...
... ... @@ -20,22 +20,20 @@ class NewsaleController extends AbstractAction
$this->setTitle('新品到着');
$this->setNavHeader('新品到着');
$channel = $this->get('channel', 1);
if (!is_numeric($channel)) {
$this->error();
}
$channel = $this->getCookie('_Channel', 'boys');
$this->channelTrans($channel);
$data = array();
$data['newArrival'] = true;
$data['headerBanner'] = \Product\NewsaleModel::getNewFocus($channel);
$goodsList = \Product\NewsaleModel::getNewProducts($channel, 20);
$goodsList = \Product\NewsaleModel::getNewProducts($channel, 60);
if (!empty($goodsList)) {
$data += $goodsList;
}
// 设置一些筛选的默认参数
$data += array(
'brand' => 0,
'sort' => 0,
'msort' => 0,
'gender' => $this->getCookie('_Channel', 'boys'),
'price' => 0,
'size' => 0,
... ... @@ -56,10 +54,8 @@ class NewsaleController extends AbstractAction
$this->setTitle('折扣专区');
$this->setNavHeader('Sale');
$channel = $this->get('channel', 1);
if (!is_numeric($channel)) {
$this->error();
}
$channel = $this->getCookie('_Channel', 'boys');
$this->channelTrans($channel);
$data = array();
$data['discount'] = true;
... ... @@ -71,7 +67,7 @@ class NewsaleController extends AbstractAction
// 设置一些筛选的默认参数
$data += array(
'brand' => 0,
'sort' => 0,
'msort' => 0,
'gender' => $this->getCookie('_Channel', 'boys'),
'price' => 0,
'size' => 0,
... ... @@ -109,16 +105,16 @@ class NewsaleController extends AbstractAction
public function selectNewSaleAction()
{
if ($this->isAjax()) {
$gender = $this->get('gender', '1,3');
$gender = $this->get('gender', 'boys');
$brand = $this->get('brand', null);
$sort = $this->get('sort', null);
$sort = $this->get('msort', 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');
$p_d = $this->get('discount', null);
$channel = $this->getCookie('_Channel', 'boys');
$dayLimit = $this->get('dayLimit', '1');
$limit = $this->get('limit', 20);
$limit = $this->get('limit', 60);
$page = $this->get('page', 1);
// 转换性别
... ... @@ -135,6 +131,9 @@ class NewsaleController extends AbstractAction
$gender = '1,2,3';
}
// 转换频道
$this->channelTrans($channel);
$data = NewsaleData::selectNewSaleProducts(
$gender, $brand, $sort, $color,
$size, $price, $p_d, $channel, $dayLimit, $limit, $page
... ... @@ -154,4 +153,28 @@ class NewsaleController extends AbstractAction
}
}
/**
* 转换频道
* @param string &$channel 待转换的频道
* @return integer 转换之后的频道
*/
private function channelTrans(&$channel)
{
switch ($channel) {
case 'girls':
$channel = 2;
break;
case 'kids':
$channel = 3;
break;
case 'lifestyle':
$channel = 4;
break;
case 'boys':
default:
$channel = 1;
break;
}
}
}
... ...