diff --git a/app/index/controller/TopicSsd.php b/app/index/controller/TopicSsd.php index 70351d95..a4b8483a 100644 --- a/app/index/controller/TopicSsd.php +++ b/app/index/controller/TopicSsd.php @@ -3,19 +3,49 @@ declare (strict_types = 1); namespace app\index\controller; +use app\index\model\SysBannerModel; use think\facade\View; -use think\Request; -class TopicSsd +/** + * 专题 - SSD + */ +class TopicSsd extends Common { /** - * 显示资源列表 - * - * @return \think\Response + * 专题 - SSD首页 */ public function index() { + $banners = SysBannerModel::with([ + 'items' => function ($query) { + $query->withoutField(['sort', 'created_at', 'updated_at', 'deleted_at']) + ->order(['sort' => 'asc', 'id' => 'desc']) + ->enabled(true); + } + ]) + ->atPlatform(request()->from) + ->uniqueLabel([ + 'BANNER_69faaf8582967', // 专题 - 闪存(SSD)首页 - 焦点图 + 'BANNER_69fab1bed8f71', // 专题 - 闪存(SSD)首页 - 产品 + ]) + ->language($this->lang_id) + ->enabled(true) + ->order(['sort' => 'asc', 'id' => 'desc']) + ->select(); + $data = []; + if (!$banners->isEmpty()) { + $banners_map = []; + foreach ($banners as $banner) { + $banners_map[$banner->unique_label] = $banner; + } + + // 焦点图轮播图 + $data['top_focus_images'] = data_get($banners_map, 'BANNER_69faaf8582967')?->items->toArray(); + // 产品 + $data['products'] = data_get($banners_map, 'BANNER_69fab1bed8f71')?->items->toArray(); + } + View::assign('data', $data); return View::fetch('index'); } diff --git a/app/index/view/pc/topic_ssd/index.html b/app/index/view/pc/topic_ssd/index.html index 3a143134..fe1cb556 100644 --- a/app/index/view/pc/topic_ssd/index.html +++ b/app/index/view/pc/topic_ssd/index.html @@ -1,4 +1,7 @@ +{extend name="public/base" /} +{block name="style"} + - -
- - +{/block} +{block name="main"} +
+ {volist name="data.top_focus_images" id="item"} + + + + {/volist} +
+ {volist name="data.products" id="item"} + + - - - - - - - - - - - + {/volist}
- +
+{/block}