diff --git a/app/index/controller/Article.php b/app/index/controller/Article.php index 2756ab0..8f00796 100644 --- a/app/index/controller/Article.php +++ b/app/index/controller/Article.php @@ -95,7 +95,7 @@ class Article extends BaseController //文章详情页 public function detail($id) { - $article = Cache::get('article'); + $article = Cache::get('article_'.$id); if(!$article){ //查询文章 $article = ArticleModel::field('id,title,content,status,cate_id,user_id,is_top,is_hot,is_reply,pv,jie,tags,create_time')->where('status',1)->with([ @@ -106,7 +106,7 @@ class Article extends BaseController $query->field('id,name,nickname,user_img,area_id'); } ])->find($id); - Cache::set('article',$article,3600); + Cache::set('article_'.$id,$article,3600); } $comments = $article->comments()->where('status',1)->select(); $article->inc('pv')->update();