topic ssd data
All checks were successful
Gitea Actions Official-website / deploy-dev (push) Successful in 5s

This commit is contained in:
2026-05-06 11:34:57 +08:00
parent aeec3e4f0d
commit 00e8eed191
2 changed files with 53 additions and 35 deletions

View File

@@ -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');
}