From e2c7673611913f2270770e1b61470eedbdf75094 Mon Sep 17 00:00:00 2001 From: devil_gong Date: Wed, 9 Jan 2019 19:08:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E8=88=AA=F0=9F=8E=A7=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E5=A4=B1=E8=B4=A5bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/service/NavigationService.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/application/service/NavigationService.php b/application/service/NavigationService.php index 6628225e4..c9f689153 100755 --- a/application/service/NavigationService.php +++ b/application/service/NavigationService.php @@ -37,27 +37,28 @@ class NavigationService $footer = cache(config('shopxo.cache_common_home_nav_footer_key')); // 导航模型 - $m = Db::name('Navigation'); $field = array('id', 'pid', 'name', 'url', 'value', 'data_type', 'is_new_window_open'); // 缓存没数据则从数据库重新读取,顶部菜单 if(empty($header)) { - $header = self::NavDataDealWith($m->field($field)->where(array('nav_type'=>'header', 'is_show'=>1, 'pid'=>0))->order('sort')->select()); + $header = self::NavDataDealWith(Db::name('Navigation')->field($field)->where(array('nav_type'=>'header', 'is_show'=>1, 'pid'=>0))->order('sort')->select()); if(!empty($header)) { - foreach($header as $k=>$v) + foreach($header as &$v) { - $header[$k]['item'] = self::NavDataDealWith($m->field($field)->where(array('nav_type'=>'header', 'is_show'=>1, 'pid'=>$v['id']))->order('sort')->select()); + $v['items'] = self::NavDataDealWith(Db::name('Navigation')->field($field)->where(array('nav_type'=>'header', 'is_show'=>1, 'pid'=>$v['id']))->order('sort')->select()); } } cache(config('shopxo.cache_common_home_nav_header_key'), $header); } + print_r($header); + // 底部导航 if(empty($footer)) { - $footer = self::NavDataDealWith($m->field($field)->where(array('nav_type'=>'footer', 'is_show'=>1))->order('sort')->select()); + $footer = self::NavDataDealWith(Db::name('Navigation')->field($field)->where(array('nav_type'=>'footer', 'is_show'=>1))->order('sort')->select()); cache(config('shopxo.cache_common_home_nav_footer_key'), $footer); } -- GitLab