Page.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 海豚PHP框架 [ DolphinPHP ]
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2016~2019 广东卓锐软件有限公司 [ http://www.zrthink.com ]
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: http://dolphinphp.com
  8. // +----------------------------------------------------------------------
  9. namespace app\cms\home;
  10. use app\cms\model\Page as PageModel;
  11. /**
  12. * 前台单页控制器
  13. * @package app\cms\admin
  14. */
  15. class Page extends Common
  16. {
  17. /**
  18. * 单页详情
  19. * @param null $id 单页id
  20. * @author 蔡伟明 <314013107@qq.com>
  21. * @return mixed
  22. * @throws \think\Exception
  23. * @throws \think\db\exception\DataNotFoundException
  24. * @throws \think\db\exception\ModelNotFoundException
  25. * @throws \think\exception\DbException
  26. */
  27. public function detail($id = null)
  28. {
  29. $info = PageModel::where('status', 1)->find($id);
  30. $info['url'] = url('cms/page/detail', ['id' => $info['id']]);
  31. $info['tags'] = explode(',', $info['keywords']);
  32. // 更新阅读量
  33. PageModel::where('id', $id)->setInc('view');
  34. $this->assign('page_info', $info);
  35. return $this->fetch(); // 渲染模板
  36. }
  37. }