article jie show

This commit is contained in:
toogee 2020-04-25 17:36:24 +08:00
parent 2641921efb
commit d5ce1b5cbf
2 changed files with 6 additions and 6 deletions

View File

@ -40,7 +40,7 @@ class Article extends BaseController
switch ($type) { switch ($type) {
//查询文章,15个分1页 //查询文章,15个分1页
case 'jie': case 'jie':
$artList = ArticleModel::field('id,title,title_color,cate_id,user_id,create_time,is_top,is_hot')->with([ $artList = ArticleModel::field('id,title,title_color,cate_id,user_id,create_time,is_top,is_hot,jie')->with([
'cate' => function($query){ 'cate' => function($query){
$query->where('delete_time',0)->field('id,catename'); $query->where('delete_time',0)->field('id,catename');
}, },
@ -51,7 +51,7 @@ class Article extends BaseController
break; break;
case 'hot': case 'hot':
$artList = ArticleModel::field('id,title,title_color,cate_id,user_id,create_time,is_top,is_hot')->with([ $artList = ArticleModel::field('id,title,title_color,cate_id,user_id,create_time,is_top,is_hot,jie')->with([
'cate' => function($query){ 'cate' => function($query){
$query->where('delete_time',0)->field('id,catename'); $query->where('delete_time',0)->field('id,catename');
}, },
@ -62,7 +62,7 @@ class Article extends BaseController
break; break;
case 'top': case 'top':
$artList = ArticleModel::field('id,title,title_color,cate_id,user_id,create_time,is_top,is_hot')->with([ $artList = ArticleModel::field('id,title,title_color,cate_id,user_id,create_time,is_top,is_hot,jie')->with([
'cate' => function($query){ 'cate' => function($query){
$query->where('delete_time',0)->field('id,catename'); $query->where('delete_time',0)->field('id,catename');
}, },
@ -73,7 +73,7 @@ class Article extends BaseController
break; break;
default: default:
$artList = ArticleModel::field('id,title,title_color,cate_id,user_id,create_time,is_top,is_hot')->with([ $artList = ArticleModel::field('id,title,title_color,cate_id,user_id,create_time,is_top,is_hot,jie')->with([
'cate' => function($query){ 'cate' => function($query){
$query->where('delete_time',0)->field('id,catename'); $query->where('delete_time',0)->field('id,catename');
}, },

View File

@ -26,7 +26,7 @@ class Index extends BaseController
//置顶文章 //置顶文章
$artTop = Cache::get('arttop'); $artTop = Cache::get('arttop');
if(!$artTop){ if(!$artTop){
$artTop = Article::field('id,title,title_color,cate_id,user_id,create_time,is_top')->where(['is_top'=>1,'status'=>1,'delete_time'=>0])->with([ $artTop = Article::field('id,title,title_color,cate_id,user_id,create_time,is_top,jie')->where(['is_top'=>1,'status'=>1,'delete_time'=>0])->with([
'cate' => function($query){ 'cate' => function($query){
$query->where('delete_time',0)->field('id,catename'); $query->where('delete_time',0)->field('id,catename');
}, },
@ -40,7 +40,7 @@ class Index extends BaseController
//首页文章显示20条 //首页文章显示20条
$artList = Cache::get('artlist'); $artList = Cache::get('artlist');
if(!$artList){ if(!$artList){
$artList = Article::field('id,title,title_color,cate_id,user_id,create_time,is_hot')->with([ $artList = Article::field('id,title,title_color,cate_id,user_id,create_time,is_hot,jie')->with([
'cate' => function($query){ 'cate' => function($query){
$query->where('delete_time',0)->field('id,catename'); $query->where('delete_time',0)->field('id,catename');
}, },