feat: 英文移动端nas

This commit is contained in:
2025-04-14 14:46:50 +08:00
parent 40fa4b70f2
commit b6e69b4e95
7 changed files with 1389 additions and 245 deletions

View File

@@ -15,6 +15,9 @@ class BaseController extends Controller {
//当前用户
protected $customer_id = 0;
// 当前国家编码
protected $country_code = 'US';
public function __construct() {
parent::__construct();
}
@@ -71,6 +74,47 @@ class BaseController extends Controller {
$this->view->assign('allCategoryList', $this->categoryList);
}
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(){
// 读取缓存数据