...
|
...
|
@@ -39,16 +39,38 @@ 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();
|
|
|
foreach ($value['sub'] as $oneSub) {
|
|
|
$subs[] = self::formatSideItem($oneSub);
|
|
|
}
|
|
|
|
|
|
$group[$groupKey]['subNav'] = $subs;
|
|
|
}
|
|
|
$groupKey++;
|
|
|
|
|
|
if ($count === $key + 1) {
|
|
|
$result[$num] = $group;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
@@ -126,4 +148,24 @@ class SideModel |
|
|
);
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 格式化侧边栏数据
|
|
|
*
|
|
|
* @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);
|
|
|
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|