refactor: 首页视频不显示问题

This commit is contained in:
2025-05-14 18:06:23 +08:00
parent 7f4199f151
commit 3fbf20e6c7

View File

@@ -19,7 +19,6 @@ class Index extends Common
*/ */
public function index() public function index()
{ {
// 获取banner数据 // 获取banner数据
$banner = $this->getBannerData(); $banner = $this->getBannerData();
View::assign('focus_images', $banner['focus_images']); View::assign('focus_images', $banner['focus_images']);
@@ -53,7 +52,7 @@ class Index extends Common
private function getBannerData() private function getBannerData()
{ {
$banners = SysBannerModel::with(['items' => function($query) { $banners = SysBannerModel::with(['items' => function($query) {
$query->where('type', '=', 'image')->where('status', '=', 1)->order(['sort' => 'asc', 'id' => 'desc']); $query->where('type', 'IN', ['image', 'video'])->where('status', '=', 1)->order(['sort' => 'asc', 'id' => 'desc']);
}]) }])
->uniqueLabel([ ->uniqueLabel([
'BANNER_67f61cd70e8e1', 'BANNER_67f61cd70e8e1',
@@ -72,7 +71,7 @@ class Index extends Common
foreach ($banners as $v) { foreach ($banners as $v) {
$banner_map[$v->unique_label] = $v; $banner_map[$v->unique_label] = $v;
} }
// 处理焦点轮播图和产品分类 // 处理焦点轮播图和产品分类
$data['focus_images'] = []; // 焦点轮播图 $data['focus_images'] = []; // 焦点轮播图
$data['product_categorys'] = []; // 产品分类信息 $data['product_categorys'] = []; // 产品分类信息