From 80c549a72f7cddd807d831404c0fa67da574c46d Mon Sep 17 00:00:00 2001 From: jsasg <735273025@qq.com> Date: Wed, 14 May 2025 11:24:02 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E9=A6=96=E9=A1=B5=E5=93=81?= =?UTF-8?q?=E7=89=8C=E6=95=85=E4=BA=8B=E5=B9=B4=E4=BB=BD=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/index/controller/Index.php | 10 +++++++++- app/index/view/index/index.html | 6 +++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/index/controller/Index.php b/app/index/controller/Index.php index ab7610d2..a94b6c43 100644 --- a/app/index/controller/Index.php +++ b/app/index/controller/Index.php @@ -19,6 +19,7 @@ class Index extends Common */ public function index() { + // 获取banner数据 $banner = $this->getBannerData(); View::assign('focus_images', $banner['focus_images']); @@ -26,7 +27,14 @@ class Index extends Common View::assign('featured_topics', $banner['featured_topics']); View::assign('video', array_shift($banner['video'])); View::assign('scenes', $banner['scenes']); - View::assign('brand_story', $banner['brand_story']); + View::assign('brand_story', array_map(function($item) { + $item['year'] = ''; + $arr = explode('-', $item['title']); + if (count($arr) > 1) { + $item['year'] = $arr[0]; + } + return $item; + }, $banner['brand_story']??null)); View::assign('data_statistics', $banner['data_statistics']); // 获取明星产品/热点产品 diff --git a/app/index/view/index/index.html b/app/index/view/index/index.html index 9b56b029..4ba629f5 100644 --- a/app/index/view/index/index.html +++ b/app/index/view/index/index.html @@ -167,9 +167,9 @@

- - - + {volist name="brand_story" id="story" key="k"} + {$story.year} + {/volist}