ListController.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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 cmf\controller\HomeBaseController;
  13. use app\portal\model\PortalCategoryModel;
  14. class ListController extends HomeBaseController
  15. {
  16. /***
  17. * 文章列表
  18. * @return mixed
  19. * @throws \think\db\exception\DataNotFoundException
  20. * @throws \think\db\exception\ModelNotFoundException
  21. * @throws \think\exception\DbException
  22. */
  23. public function index()
  24. {
  25. $id = $this->request->param('id', 0, 'intval');
  26. $portalCategoryModel = new PortalCategoryModel();
  27. $category = $portalCategoryModel->where('id', $id)->where('status', 1)->find();
  28. $this->assign('category', $category);
  29. $listTpl = empty($category['list_tpl']) ? 'list' : $category['list_tpl'];
  30. return $this->fetch('/' . $listTpl);
  31. }
  32. }