{php} //use app\model\Category; // 一级栏目的banner //$firstCategoryId = Category::firstGradeId($category['path'], $category['id']); //if ($firstCategoryId == $category['id']) { //$bg_pc = $category['bg']; //$bg_mobile = $category['bg_mobile']; //} else { //$firstCategory = Category::where('id', $firstCategoryId)->field('id,title,bg,bg_mobile')->find(); //$bg_pc = $firstCategory['bg']; //$bg_mobile = $firstCategory['bg_mobile']; //} $bgImg = $isMobile? $system['img_bg_mobile'] : $system['img_bg_pc']; $bgImg = trim($bgImg); $defaultBg = '/static/web/images/public/header-bg.jpg'; $bgImg = request()->controller() == 'Index' ? '' : ($bgImg ?: $defaultBg); {/php}