Files
orico-official-website/app/index/controller/TopicSsd.php
jsasg 00e8eed191
All checks were successful
Gitea Actions Official-website / deploy-dev (push) Successful in 5s
topic ssd data
2026-05-06 11:34:57 +08:00

53 lines
1.5 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
declare (strict_types = 1);
namespace app\index\controller;
use app\index\model\SysBannerModel;
use think\facade\View;
/**
* 专题 - SSD
*/
class TopicSsd extends Common
{
/**
* 专题 - 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');
}
}