diff --git a/app/controller/Article.php b/app/controller/Article.php index f8fbb77..e3f2aed 100644 --- a/app/controller/Article.php +++ b/app/controller/Article.php @@ -144,12 +144,13 @@ class Article extends Base { $cateIds[] = $article['category_id']; $currentCateId = input('param.source', 0); + $categoryList = Category::getChildrenByParentId($topCategory['id']); if($currentCateId == $topCategory['id']) { - $categoryList = Category::getChildrenByParentId($topCategory['id']); foreach ($categoryList as $cate) { $cateIds[] = $cate['id']; } } + $this->data['categoryChildren'] = $categoryList; $this->data['prev'] = MArticle::getPrevArticleByIdAndCategories($article['id'], $cateIds, true, $article['sort'], true); $this->data['next'] = MArticle::getNextArticleByIdAndCategories($article['id'], $cateIds, true, $article['sort'], true); $this->data['currentCateId'] = $currentCateId; diff --git a/app/controller/Index.php b/app/controller/Index.php index ff394ad..619bd35 100644 --- a/app/controller/Index.php +++ b/app/controller/Index.php @@ -16,19 +16,12 @@ class Index extends Base $this->data['blocks'] = $blocks; // 轮播图 $this->data['slides'] = Slide::getList(); - // 网络营销栏目ID + // 营销网络栏目ID $this->data['marketingCId'] = Category::$CIdList['marketing']; - // 关联产品中心 - $productsCId = Category::$CIdList['products']; - $productChildren = Category::getChildrenByParentId($productsCId); - $productsCIds[] = $productsCId; - foreach ($productChildren as $cate) { - $productsCIds[] = $cate['id']; - } - $this->data['products'] = [ - 'category' => Category::getById($productsCId), - 'items' => Article::getListByCategoryIds($productsCIds, 4, '', [], 1, ['create_time'=>'desc']) - ]; + // 关联产品分类 + $productsCenterCId = Category::$CIdList['products']; + $this->data['productsCenter'] = Category::getById($productsCenterCId); + $this->data['products'] = Category::getChildrenByParentId($productsCenterCId); // 关联新闻 $this->data['newsCenter'] = Category::getById(Category::$CIdList['news']); $newsCIdList = [Category::$CIdList['news_children']['enterprise'], Category::$CIdList['news_children']['industry']]; diff --git a/view/article/product.html b/view/article/product.html index 3992d66..df9388e 100644 --- a/view/article/product.html +++ b/view/article/product.html @@ -13,6 +13,23 @@
{$products['category']['description'] ?? 'product center'}
{$productsCenter['description'] ?? 'product center'}