Authored by Rock Zhang

修改新品到着,折扣专区的数据处理方式

... ... @@ -56,25 +56,10 @@ class NewsaleData
$param['limit'] = $limit;
$param['yh_channel'] = $channel;
$build = $param;
$build['dayLimit'] = 1;
$build['client_secret'] = Sign::getSign($build);
$urlList['new'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $build);
$build = $param;
$build['dayLimit'] = 2;
$build['client_secret'] = Sign::getSign($build);
$urlList['week'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $build);
$build = $param;
$build['dayLimit'] = 3;
$build['client_secret'] = Sign::getSign($build);
$urlList['sale'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $build);
$build = array();
$param = array();
$param['dayLimit'] = 1;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::getMulti($urlList);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
... ... @@ -147,13 +132,10 @@ class NewsaleData
$param['limit'] = $limit;
$param['yh_channel'] = $channel;
// 构建url地址列表
$urlList = array();
$param['p_d'] = '0.1,0.9';
$param['client_secret'] = Sign::getSign($param);
$urlList['ALL'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param);
return Yohobuy::getMulti($urlList);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
... ...
... ... @@ -198,7 +198,7 @@ class ListProcess
$result = array(
'title' => '品类',
'name' => '所有品类',
'dataType' => 'msort',
'dataType' => 'sort',
'subs' => array(
array(
'chosed' => true,
... ...
... ... @@ -20,25 +20,11 @@ class NewSaleProcess
public static function newSaleData($products)
{
$result = array();
$noTab = true;
$productsLi = array();
$tabItem = array();
foreach ($products as $single) {
if (empty($single)) {
continue;
}
// 处理Filter
if(isset($single['filter'])) {
$result['filter'] = ListProcess::getFilterData($single['filter']);
}
// 处理Tabs
$noTab = true;
if (isset($single['tabs']) && $noTab) {
if (isset($products['tabs'])) {
$result['tabs'] = array();
foreach ($single['tabs'] as $key => $one) {
foreach ($products['tabs'] as $key => $one) {
$tabItem = array();
$tabItem['title'] = $one;
$tabItem['dataId'] = $key;
... ... @@ -47,23 +33,19 @@ class NewSaleProcess
}
$result['tabs'][] = $tabItem;
}
$noTab = false;
}
// 处理商品
$productsLi = array();
if (isset($single['product_list'])) {
foreach ($single['product_list'] as $value) {
$productsLi['goods'][] = Helpers::formatProduct($value, true, false, false);
}
// 处理Filter
if(isset($products['filter'])) {
$result['filter'] = ListProcess::getFilterData($products['filter']);
}
// 对于第一个productsLi添加show字段
if (!isset($result['goodsContainer'][0])) {
$productsLi['show'] = true;
}
// 处理商品
if (isset($products['product_list'])) {
foreach ($products['product_list'] as $single) {
$result['goodsContainer'][] = $productsLi;
$result['goods'][] = Helpers::formatProduct($single, true, false, false);
}
}
return $result;
... ...
... ... @@ -117,8 +117,8 @@ class NewsaleModel
}
/* 格式化商品数据 */
if (!empty($products)) {
$result = NewSaleProcess::newSaleData($products);
if (isset($products['code']) && $products['code'] == 200) {
$result = NewSaleProcess::newSaleData($products['data']);
}
return $result;
... ... @@ -154,8 +154,8 @@ class NewsaleModel
}
/* 格式化商品数据 */
if (!empty($products)) {
$result = NewSaleProcess::newSaleData($products);
if (isset($products['code']) && $products['code'] == 200) {
$result = NewSaleProcess::newSaleData($products['data']);
}
return $result;
... ... @@ -170,6 +170,8 @@ class NewsaleModel
*/
private static function cacheControl($cacheKey, $codeKey)
{
$result = array();
if (USE_CACHE) {
// 先尝试获取一级缓存(master), 有数据则直接返回.
$result = Cache::get($cacheKey, 'master');
... ...
... ... @@ -32,11 +32,11 @@ class NewsaleController extends AbstractAction
}
// 设置一些筛选的默认参数
$data += array(
'brand' => 0,
'msort' => 0,
'brand' => '0',
'sort' => '0',
'gender' => Helpers::getGenderByCookie(),
'price' => 0,
'size' => 0,
'price' => '0',
'size' => '0',
'dayLimit' => 1,
'discount' => ''
);
... ... @@ -65,11 +65,11 @@ class NewsaleController extends AbstractAction
}
// 设置一些筛选的默认参数
$data += array(
'brand' => 0,
'msort' => 0,
'brand' => '0',
'sort' => '0',
'gender' => Helpers::getGenderByCookie(),
'price' => 0,
'size' => 0,
'price' => '0',
'size' => '0',
'discount' => '0.1,0.9'
);
//var_dump($data);exit;
... ... @@ -86,7 +86,7 @@ class NewsaleController extends AbstractAction
if ($this->isAjax()) {
$gender = $this->get('gender', 'boys');
$brand = $this->get('brand', null);
$sort = $this->get('msort', null);
$sort = $this->get('sort', null);
$color = $this->get('color', null);
$size = $this->get('size', null);
$price = $this->get('price', null);
... ...