feat: 英文nas相关

This commit is contained in:
2025-04-14 10:30:12 +08:00
parent 9bdbdebc39
commit 9052b70816
5 changed files with 230 additions and 47 deletions

View File

@@ -175,6 +175,47 @@ class BaseController extends Controller {
return $tree;
}
protected function buildTree($data, $pid = 0)
{
$tree = [];
foreach ($data as $val) {
if ($val['pid'] == $pid) {
$children = $this->buildTree($data, $val['id']);
if (!empty($children)) {
$val['items'] = $children;
}
$tree[] = $val;
}
}
return $tree;
}
/**
* nasNavigation 获取并组装nas专题页的top导航和footer
*/
protected function nasNavigation()
{
$navs = Loader::model('Navigation')->field([
'id',
'pid',
'name',
'url',
'value',
'data_type',
'is_new_window_open',
])
->where('stat', '=', 0)
->where('nav_type', '=', 'tops_nas_header')
->where('country_code', '=', $this->country_code)
->order('sort')
->select();
$navs_array = collection($navs)->toArray();
$header = $this->NavDataDealWith($navs_array);
$this->assign('nav_header', $this->buildTree($header));
}
//导航初始化
private function navInit(){
// 读取缓存数据