...
|
...
|
@@ -36,33 +36,108 @@ class NewsaleModel |
|
|
* @param int $channel boys表示男生频道, girls表示女生频道, kids表示潮童频道, lifestyle表示创意生活频道
|
|
|
* @return array
|
|
|
*/
|
|
|
public static function getNewsaleByChannel($channel)
|
|
|
public static function getNewByChannel($channel)
|
|
|
{
|
|
|
$result = array();
|
|
|
$newsale = array();
|
|
|
$new = array();
|
|
|
|
|
|
/* 根据频道调用接口 */
|
|
|
switch ($channel) {
|
|
|
case 'boys': // 男生
|
|
|
$new = NewsaleData::newPackage(self::CODE_TOP_NEW_BOYS, '1,3', 1);
|
|
|
break;
|
|
|
case 'girls': // 女生
|
|
|
$new = NewsaleData::newPackage(self::CODE_TOP_NEW_GIRLS, '2,3', 2);
|
|
|
break;
|
|
|
case 'kids': // 潮童
|
|
|
$new = NewsaleData::newPackage(self::CODE_TOP_NEW_KIDS, '1,2,3', 3);
|
|
|
break;
|
|
|
case 'lifestyle': // 创意生活
|
|
|
$new = NewsaleData::newPackage(self::CODE_TOP_NEW_LIFESTYLE, '1,2,3', 4);
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
/* 顶部的轮翻广告列表 */
|
|
|
$result['headerBanner'] = self::bannerData($new['newsaleTop']);
|
|
|
|
|
|
/* 下部商品列表 */
|
|
|
unset($new['newsaleTop']);
|
|
|
foreach($new as $single)
|
|
|
{
|
|
|
// 处理Tabs
|
|
|
$noTab = true;
|
|
|
if(isset($single['tabs']) && $noTab)
|
|
|
{
|
|
|
$result['tabs'] = array();
|
|
|
foreach ($single['tabs'] as $key => $one)
|
|
|
{
|
|
|
$tabItem = array();
|
|
|
$tabItem['title'] = $one;
|
|
|
if($key === 1)
|
|
|
{
|
|
|
$tabItem['focus'] = true;
|
|
|
}
|
|
|
$result['tabs'][] = $tabItem;
|
|
|
}
|
|
|
$noTab = false;
|
|
|
}
|
|
|
|
|
|
// 处理商品
|
|
|
$productsLi = array('goods'=>array());
|
|
|
if(isset($single['product_list']))
|
|
|
{
|
|
|
foreach ($single['product_list'] as $value)
|
|
|
{
|
|
|
$productsLi['goods'][] = Helpers::formatProduct($value);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 对于第一个productsLi添加show字段
|
|
|
if(!isset($result['goodsContainer']))
|
|
|
{
|
|
|
$productsLi['show'] = true;
|
|
|
}
|
|
|
|
|
|
$result['goodsContainer'][] = $productsLi;
|
|
|
}
|
|
|
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 根据频道获取折扣专区数据
|
|
|
*
|
|
|
* @param int $channel boys表示男生频道, girls表示女生频道, kids表示潮童频道, lifestyle表示创意生活频道
|
|
|
* @return array
|
|
|
*/
|
|
|
public static function getSaleByChannel($channel)
|
|
|
{
|
|
|
$result = array();
|
|
|
$sale = array();
|
|
|
|
|
|
/* 根据频道调用接口 */
|
|
|
switch (intval($channel)) {
|
|
|
switch ($channel) {
|
|
|
case 'boys': // 男生
|
|
|
$newsale = NewsaleData::package(self::CODE_TOP_NEW_BOYS, '1,3', 1);
|
|
|
$sale = NewsaleData::salePackage(self::CODE_TOP_SALE_BOYS, '1,3', 1);
|
|
|
break;
|
|
|
case 'girls': // 女生
|
|
|
$newsale = NewsaleData::package(self::CODE_TOP_NEW_GIRLS, '2,3', 2);
|
|
|
$sale = NewsaleData::salePackage(self::CODE_TOP_SALE_GIRLS, '2,3', 2);
|
|
|
break;
|
|
|
case 'kids': // 潮童
|
|
|
$newsale = NewsaleData::package(self::CODE_TOP_NEW_KIDS, '1,2,3', 3);
|
|
|
$sale = NewsaleData::salePackage(self::CODE_TOP_SALE_KIDS, '1,2,3', 3);
|
|
|
break;
|
|
|
case 'lifestyle': // 创意生活
|
|
|
$newsale = NewsaleData::package(self::CODE_TOP_NEW_LIFESTYLE, '1,2,3', 4);
|
|
|
$sale = NewsaleData::salePackage(self::CODE_TOP_SALE_LIFESTYLE, '1,2,3', 4);
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
/* 顶部的轮翻广告列表 */
|
|
|
$result['headerBanner'] = self::bannerData($newsale['newsaleTop']);
|
|
|
$result['headerBanner'] = self::bannerData($sale['newsaleTop']);
|
|
|
|
|
|
/* 下部商品列表 */
|
|
|
unset($newsale['newsaleTop']);
|
|
|
foreach($newsale as $single)
|
|
|
unset($sale['newsaleTop']);
|
|
|
foreach($sale as $single)
|
|
|
{
|
|
|
// 处理Tabs
|
|
|
$noTab = true;
|
...
|
...
|
@@ -136,5 +211,38 @@ class NewsaleModel |
|
|
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 筛选出来的商品数据处理
|
|
|
*
|
|
|
* @param string gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
|
|
|
* @param integer brand 品牌Id
|
|
|
* @param integer sort 品类Id
|
|
|
* @param integer color 颜色Id
|
|
|
* @param integer size 尺码Id
|
|
|
* @param string price 价格
|
|
|
* @param string $channel 1表示男, 2表示女
|
|
|
* @param integer $p_d 折扣
|
|
|
* @param integer $dayLimit查询天数的限制区间,默认为1
|
|
|
* @param integer $limit 查询返回的最大限制数, 默认为50
|
|
|
* @param integer $page 分页第几页, 默认第1页
|
|
|
* @return array 处理之后的筛选数据
|
|
|
*/
|
|
|
public static function selectData($gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit = 1, $limit = 50, $page = 1)
|
|
|
{
|
|
|
$data = NewsaleData::selectNewSaleProducts($gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page);
|
|
|
|
|
|
$result = array();
|
|
|
|
|
|
if($data['code'] === 200)
|
|
|
{
|
|
|
foreach ($data['data']['product_list'] as $val) {
|
|
|
$result['goods'][] = Helpers::formatProduct($val);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|