feat: nas首页
This commit is contained in:
125
app/index/controller/TopicNas.php
Normal file
125
app/index/controller/TopicNas.php
Normal file
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\index\controller;
|
||||
|
||||
use app\index\model\SysBannerModel;
|
||||
use think\facade\View;
|
||||
|
||||
/**
|
||||
* 专题-Nas控制器
|
||||
*/
|
||||
class TopicNas extends Common
|
||||
{
|
||||
/**
|
||||
* 重写控制器初始化
|
||||
*/
|
||||
protected function initialize()
|
||||
{
|
||||
// 获取国家/语言列表
|
||||
$languages = $this->getLanguages();
|
||||
|
||||
// 获取当前语言
|
||||
$current_language = $this->getCurrentLanguage($languages);
|
||||
if (!empty($current_language)) {
|
||||
$this->lang_id = $current_language['id'];
|
||||
}
|
||||
|
||||
// 获取产品分类
|
||||
$categorys = $this->getProductCategory($this->lang_id);
|
||||
// 输出产品分类
|
||||
View::assign('header_categorys', $categorys);
|
||||
|
||||
// 输出顶部导航
|
||||
View::assign('header_navigation', $this->getNavigation('NAV_680ef95e9db90', $this->lang_id));
|
||||
|
||||
// 获取系统配置
|
||||
$configs = $this->getSysConfig($this->lang_id, ['basic', 'contact', 'media']);
|
||||
$this->basic_config = $configs['basic'];
|
||||
// 输出系统配置
|
||||
View::assign('basic_config', $configs['basic']);
|
||||
View::assign('contact_config', $configs['contact']);
|
||||
View::assign('media_config', $configs['media']);
|
||||
|
||||
// 获取底部导航
|
||||
$footer_navigation = $this->getNavigation('NAV_67f60be43df8d', $this->lang_id);
|
||||
// 输出底部导航
|
||||
View::assign('footer_navigation', $footer_navigation);
|
||||
}
|
||||
|
||||
/**
|
||||
* 专题-Nas首页
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$focus_image = [];
|
||||
$nas_category = [];
|
||||
$nas_video = [];
|
||||
$nas_solution = [];
|
||||
$nas_software = [];
|
||||
// 获取banner数据
|
||||
$banners = SysBannerModel::with(['items' => function($query) {
|
||||
$query->withoutField(['sort', 'created_at', 'updated_at', 'deleted_at']);
|
||||
}])
|
||||
->uniqueLabel([
|
||||
'BANNER_680f156a805a8',
|
||||
'BANNER_680f15ca5482f',
|
||||
'BANNER_680f161b5fd3a',
|
||||
'BANNER_680f16358f14c',
|
||||
'BANNER_680f1e5132184'
|
||||
])
|
||||
->language($this->lang_id)
|
||||
->enabled(true)
|
||||
->select();
|
||||
if (!$banners->isEmpty()) {
|
||||
$banners_map = [];
|
||||
foreach ($banners as $banner) {
|
||||
$banners_map[$banner->unique_label] = $banner;
|
||||
}
|
||||
$focus_image = data_get($banners_map, 'BANNER_680f156a805a8')?->items->toArray();
|
||||
$nas_category = data_get($banners_map, 'BANNER_680f15ca5482f')?->items->chunk(3)?->toArray();
|
||||
$nas_video = data_get($banners_map, 'BANNER_680f161b5fd3a')?->items->first()?->toArray();
|
||||
$nas_solution = data_get($banners_map, 'BANNER_680f16358f14c')?->items->toArray();
|
||||
$nas_software = data_get($banners_map, 'BANNER_680f1e5132184')?->items->toArray();
|
||||
}
|
||||
View::assign('focus_image', $focus_image);
|
||||
View::assign('nas_category', $nas_category);
|
||||
View::assign('nas_video', $nas_video);
|
||||
View::assign('nas_solution', $nas_solution);
|
||||
View::assign('nas_software', $nas_software);
|
||||
|
||||
return View::fetch('index');
|
||||
}
|
||||
|
||||
/**
|
||||
* 专题-Nas产品体验页
|
||||
*/
|
||||
public function product()
|
||||
{
|
||||
return View::fetch('product');
|
||||
}
|
||||
|
||||
/**
|
||||
* 专题-Nas客户合作页
|
||||
*/
|
||||
public function cooperation()
|
||||
{
|
||||
return View::fetch('cooperation');
|
||||
}
|
||||
|
||||
/**
|
||||
* 专题-Nas帮助中心页
|
||||
*/
|
||||
public function help()
|
||||
{
|
||||
return View::fetch('help');
|
||||
}
|
||||
|
||||
/**
|
||||
* 专题-Nas软件下载页
|
||||
*/
|
||||
public function download()
|
||||
{
|
||||
return View::fetch('download');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user