添加轮播图

This commit is contained in:
Dev
2026-10-15 16:25:51 +08:00
parent 3bc5ea70fe
commit 373ac94411
9 changed files with 154 additions and 41 deletions
@@ -29,6 +29,28 @@ class CategoryService
return $list;
}
/**
* 首页轮播:分类类型 banner,仅正常状态,按权重从高到低
* @return array
*/
public static function getBannerList()
{
$list = self::getList(['type' => 'banner', 'status' => 'normal'], 0, 'weigh desc,id desc');
$rows = [];
foreach ($list as $item) {
$image = (string)($item['image'] ?? '');
if ($image === '') {
continue;
}
$rows[] = [
'name' => (string)($item['name'] ?? ''),
'image' => cdnurl($image, true),
'description' => (string)($item['description'] ?? ''),
];
}
return $rows;
}
public static function transformTree($data)
{
return array_map(function ($item) {