chaoyu/app/controller/Index.php

28 lines
1.1 KiB
PHP

<?php
namespace app\controller;
use app\model\{Category, Block, Article};
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']);
$blocks = Block::getByCategoryId($categoryId);
$blocks = Block::analysisBlock($blocks);
$this->data['blocks'] = $blocks;
// 网络营销栏目ID
$this->data['marketingCId'] = Category::$CIdList['marketing_network'];
// 关联产品中心
$this->data['products'] = Article::getLatestByCategory(Category::$CIdList['products'], 4);;
// 关联企业新闻
$this->data['newsEnterprises'] = Article::getLatestByCategory(Category::$CIdList['news_enterprise'], 4);
// 关联行业资讯
$this->data['newsIndustries'] = Article::getLatestByCategory(Category::$CIdList['news_industry'], 4);;
//dump($this->data);
return $this->view();
}
}