chaoyu/app/controller/Index.php

29 lines
1.2 KiB
PHP
Raw Normal View History

<?php
namespace app\controller;
use app\model\{Category, Block, Article, Slide};
class Index extends Base
{
public function index()
{
$category = Category::getIndex();
$categoryId = $category['id'] ?? 0;
$this->data['categoryId'] = $categoryId;
$this->setSeo($this->system['seo_title'], $this->system['seo_keywords'], $this->system['seo_description']);
2020-11-25 10:48:29 +00:00
$blocks = Block::getByCategoryId($categoryId);
$blocks = Block::analysisBlock($blocks);
$this->data['blocks'] = $blocks;
// 轮播图
$this->data['slides'] = Slide::getList();
2020-11-25 10:48:29 +00:00
// 网络营销栏目ID
$this->data['marketingCId'] = Category::$CIdList['marketing'];
2020-11-25 10:48:29 +00:00
// 关联产品中心
$this->data['products'] = Article::getLatestByCategory(Category::$CIdList['products'], 4);;
// 关联企业新闻
$this->data['newsEnterprises'] = Article::getLatestByCategory(Category::$CIdList['news_children']['enterprise'], 4);
2020-11-25 10:48:29 +00:00
// 关联行业资讯
$this->data['newsIndustries'] = Article::getLatestByCategory(Category::$CIdList['news_children']['industry'], 4);;
return $this->view();
}
}