fix: 后台banner分类接口

This commit is contained in:
2025-07-01 15:08:13 +08:00
parent cd9c01ca41
commit 968a537576

View File

@@ -34,12 +34,12 @@ class Banner
$datas = [];
if (!$banners->isEmpty()) {
$temp = [];
$map = ['pc' => 'PC端', 'mobile' => '移动端'];
$map = ['pc' => ['id' => -1, 'name' => 'PC端'], 'mobile' => ['id' => -2, 'name' => '移动端']];
foreach ($banners as $banner) {
if (!isset($temp[$banner->at_platform])) {
$temp[$banner->at_platform] = [
'id' => 0,
'name' => $map[$banner->at_platform] ?? '未知平台',
'id' => $map[$banner->at_platform]['id'] ?? 0,
'name' => $map[$banner->at_platform]['name'] ?? '未知平台',
'children' => []
];
}