fix: 后台banner分类接口

This commit is contained in:
2025-07-01 15:08:13 +08:00
parent 5472ca2f8d
commit fa37bda635

View File

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