...
|
...
|
@@ -8,7 +8,7 @@ use Plugin\Helpers; |
|
|
use Plugin\Cache;
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
*
|
|
|
* @name SideModel
|
|
|
* @package models/Index
|
|
|
* @copyright yoho.inc
|
...
|
...
|
@@ -20,7 +20,7 @@ class SideModel |
|
|
|
|
|
/**
|
|
|
* 获取左侧边栏数据
|
|
|
*
|
|
|
*
|
|
|
* @param string $guangChoosed 逛默认选中项 "all"表示全部,"boys":只看男生,"girls":只看女生
|
|
|
*/
|
|
|
public static function getLeftNav($guangChoosed = 'all')
|
...
|
...
|
@@ -39,16 +39,47 @@ class SideModel |
|
|
// 调用接口获取后台配置的侧边栏数据
|
|
|
$side = SideData::leftNav();
|
|
|
if (!empty($side['data'])) {
|
|
|
$group = array();
|
|
|
$num = 0;
|
|
|
$groupKey = 0;
|
|
|
$count = count(($side['data']));
|
|
|
foreach ($side['data'] as $key => $value) {
|
|
|
if ($value['separative_sign'] === 'Y') {
|
|
|
$result[$num] = $group;
|
|
|
$num++;
|
|
|
$groupKey = 0;
|
|
|
$group = array();
|
|
|
}
|
|
|
|
|
|
// 逛的按照原来的做法,使用配置
|
|
|
if ($value['sort_name_en'] === 'TRENDFINDER') {
|
|
|
continue;
|
|
|
}
|
|
|
$result[$key]['textCn'] = $value['sort_name'];
|
|
|
$result[$key]['textEn'] = $value['sort_name_en'];
|
|
|
$result[$key]['styleClass'] = strtolower($value['sort_name_en']);
|
|
|
$result[$key]['url'] = Helpers::getFilterUrl($value['sort_url']);
|
|
|
$result[$key]['img'] = Helpers::getImageUrl($value['sort_ico'], 60, 60, 1);
|
|
|
$group[$groupKey] = self::formatSideItem($value);
|
|
|
|
|
|
// 如果存在子菜单,就输出子菜单
|
|
|
if (isset($value['sub']) && !empty($value['sub'])) {
|
|
|
$subs = array(
|
|
|
array(
|
|
|
'textCn' => $group[$groupKey]['textCn'],
|
|
|
'textEn' => $group[$groupKey]['textEn'],
|
|
|
'back' => true,
|
|
|
'isSelect' => false,
|
|
|
'bgColor' => self::getSideTopColor($guangChoosed)
|
|
|
)
|
|
|
);
|
|
|
foreach ($value['sub'] as $oneSub) {
|
|
|
$subs[] = self::formatSideItem($oneSub);
|
|
|
}
|
|
|
|
|
|
$group[$groupKey]['styleClass'] = 'guang';
|
|
|
$group[$groupKey]['subNav']['list'] = $subs;
|
|
|
}
|
|
|
$groupKey++;
|
|
|
|
|
|
if ($count === $key + 1) {
|
|
|
$result[$num] = $group;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
@@ -71,13 +102,65 @@ class SideModel |
|
|
|
|
|
/**
|
|
|
* 获取并生成左侧边栏中逛的数据
|
|
|
*
|
|
|
*
|
|
|
* @param string $guangChoosed 逛默认选中项 "all"表示全部,"boys":只看男生,"girls":只看女生
|
|
|
* @return array
|
|
|
*/
|
|
|
private static function genLeftNavGuang($guangChoosed = 'all')
|
|
|
{
|
|
|
// 判断逛的背景色
|
|
|
$color = self::getSideTopColor($guangChoosed);
|
|
|
|
|
|
return
|
|
|
array(
|
|
|
array(
|
|
|
'textCn' => '逛',
|
|
|
'textEn' => 'TRENDFINDER',
|
|
|
'styleClass' => 'guang',
|
|
|
'subNav' => array(
|
|
|
'list' => array(
|
|
|
0 => array(
|
|
|
'textCn' => '逛',
|
|
|
'textEn' => 'TrendFinder',
|
|
|
'back' => true,
|
|
|
'isSelect' => false,
|
|
|
'bgColor' => $color,
|
|
|
),
|
|
|
1 => array(
|
|
|
'textCn' => '查看全部',
|
|
|
'textEn' => '',
|
|
|
'back' => false,
|
|
|
'isSelect' => ($guangChoosed === 'lifestyle' || $guangChoosed === 'kids') ? true : false,
|
|
|
'url' => Helpers::url('', array('gender' => '1,2,3'), 'guang')
|
|
|
),
|
|
|
2 => array(
|
|
|
'textCn' => '只看男生',
|
|
|
'textEn' => 'Boys',
|
|
|
'back' => false,
|
|
|
'isSelect' => ($guangChoosed === 'boys') ? true : false,
|
|
|
'url' => Helpers::url('', array('gender' => '1,3'), 'guang')
|
|
|
),
|
|
|
3 => array(
|
|
|
'textCn' => '只看女生',
|
|
|
'textEn' => 'Girls',
|
|
|
'back' => false,
|
|
|
'isSelect' => ($guangChoosed === 'girls') ? true : false,
|
|
|
'url' => Helpers::url('', array('gender' => '2,3'), 'guang')
|
|
|
),
|
|
|
)
|
|
|
)
|
|
|
)
|
|
|
);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据选择的频道获取逛的背景色
|
|
|
* @param string $guangChoosed 逛默认选中项 "all"表示全部,"boys":只看男生,"girls":只看女生
|
|
|
* @return string color值
|
|
|
*/
|
|
|
private static function getSideTopColor($guangChoosed)
|
|
|
{
|
|
|
// 判断逛的背景色
|
|
|
$color = false;
|
|
|
if ($guangChoosed === 'girls') {
|
|
|
$color = '#FF88AE';
|
...
|
...
|
@@ -87,43 +170,30 @@ class SideModel |
|
|
$color = '#4f4138';
|
|
|
}
|
|
|
|
|
|
return array(
|
|
|
'textCn' => '逛',
|
|
|
'textEn' => 'TRENDFINDER',
|
|
|
'styleClass' => 'guang',
|
|
|
'subNav' => array(
|
|
|
'list' => array(
|
|
|
0 => array(
|
|
|
'textCn' => '逛',
|
|
|
'textEn' => 'TrendFinder',
|
|
|
'back' => true,
|
|
|
'isSelect' => false,
|
|
|
'bgColor' => $color,
|
|
|
),
|
|
|
1 => array(
|
|
|
'textCn' => '查看全部',
|
|
|
'textEn' => '',
|
|
|
'back' => false,
|
|
|
'isSelect' => ($guangChoosed === 'lifestyle' || $guangChoosed === 'kids') ? true : false,
|
|
|
'url' => Helpers::url('', array('gender' => '1,2,3'), 'guang')
|
|
|
),
|
|
|
2 => array(
|
|
|
'textCn' => '只看男生',
|
|
|
'textEn' => 'Boys',
|
|
|
'back' => false,
|
|
|
'isSelect' => ($guangChoosed === 'boys') ? true : false,
|
|
|
'url' => Helpers::url('', array('gender' => '1,3'), 'guang')
|
|
|
),
|
|
|
3 => array(
|
|
|
'textCn' => '只看女生',
|
|
|
'textEn' => 'Girls',
|
|
|
'back' => false,
|
|
|
'isSelect' => ($guangChoosed === 'girls') ? true : false,
|
|
|
'url' => Helpers::url('', array('gender' => '2,3'), 'guang')
|
|
|
),
|
|
|
)
|
|
|
)
|
|
|
);
|
|
|
return $color;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 格式化侧边栏数据
|
|
|
*
|
|
|
* @param array $data 要格式化的侧边栏数据
|
|
|
* @return array
|
|
|
*/
|
|
|
private static function formatSideItem($data)
|
|
|
{
|
|
|
$result = array();
|
|
|
|
|
|
$result['textCn'] = $data['sort_name'];
|
|
|
$result['textEn'] = $data['sort_name_en'];
|
|
|
$result['styleClass'] = strtolower($data['sort_name_en']);
|
|
|
$result['url'] = Helpers::getFilterUrl($data['sort_url']);
|
|
|
$result['img'] = Helpers::getImageUrl($data['sort_ico'], 60, 60, 1);
|
|
|
if (isset($data['sort_name_color'])) {
|
|
|
$result['color'] = $data['sort_name_color'];
|
|
|
}
|
|
|
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|