<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 老猫 <thinkcmf@126.com>
// +----------------------------------------------------------------------
namespace app\portal\controller;

use app\admin\model\LinkModel;
use app\admin\model\SlideItemModel;
use app\portal\model\PortalPostModel;
use cmf\controller\HomeBaseController;

class IndexController extends HomeBaseController
{
    public function index()
    {
        $this->getTopNav();
        $data = [];

        //轮播图
        $data['slide'] = SlideItemModel::where('slide_id',1)->where('status',1)->order('list_order','asc')->select();

        //文章
        $portalModel = new PortalPostModel();
        $data['xuexi']       = $portalModel->getListByCategory(1, 5);
        $data['zhengce']     = $portalModel->getListByCategory(17, 5);
        $data['xiazai']      = $portalModel->getListByCategory(2, 5);
        $data['changjian']   = $portalModel->getListByCategory(3, 5);

        //友情链接
        $link = LinkModel::where('status',1)->order('list_order','asc')->select();
        $this->assign('link',$link);

        return $this->fetch(':index', $data);
    }
}
