添加轮播图
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user