Article.php 654 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2021 勾股工作室
  4. * @license https://opensource.org/licenses/Apache-2.0
  5. * @link https://www.gougucms.com
  6. */
  7. declare (strict_types = 1);
  8. namespace app\home\controller;
  9. use app\home\BaseController;
  10. use app\admin\model\Article as ArticleModel;
  11. use think\facade\Db;
  12. use think\facade\View;
  13. class Article extends BaseController
  14. {
  15. public function detail()
  16. {
  17. $param = get_params();
  18. $id = isset($param['id']) ? $param['id'] : 0;
  19. $detail = (new ArticleModel())->detail($id);
  20. ArticleModel::where('id', $param['id'])->inc('read')->update();
  21. View::assign('detail', $detail);
  22. return view();
  23. }
  24. }