IndexController.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | Author: 老猫 <thinkcmf@126.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\portal\controller;
  12. use app\admin\model\SlideItemModel;
  13. use app\portal\model\PortalPostModel;
  14. use cmf\controller\HomeBaseController;
  15. class IndexController extends HomeBaseController
  16. {
  17. public function index()
  18. {
  19. $this->getTopNav();
  20. $data = [];
  21. //轮播图
  22. $data['slide'] = SlideItemModel::where('slide_id',1)->where('status',1)->order('list_order','asc')->select();
  23. //文章
  24. $portalModel = new PortalPostModel();
  25. $data['xuexi'] = $portalModel->getListByCategory(1, 5);
  26. $data['zhengce'] = $portalModel->getListByCategory(17, 5);
  27. $data['xiazai'] = $portalModel->getListByCategory(2, 5);
  28. $data['changjian'] = $portalModel->getListByCategory(3, 5);
  29. return $this->fetch(':index', $data);
  30. }
  31. }