top/hot
This commit is contained in:
parent
93ea8b9e02
commit
3e1092daab
@ -33,9 +33,9 @@ class Article extends BaseController
|
||||
$where = true;
|
||||
}
|
||||
switch ($types) {
|
||||
//查询文章,10个分1页
|
||||
//查询文章,15个分1页
|
||||
case 'all':
|
||||
$artList = ArticleModel::field('id,title,cate_id,user_id,create_time')->with([
|
||||
$artList = ArticleModel::field('id,title,cate_id,user_id,create_time,is_top,is_hot')->with([
|
||||
'cate' => function($query){
|
||||
$query->where('delete_time',0)->field('id,catename');
|
||||
},
|
||||
@ -46,7 +46,7 @@ class Article extends BaseController
|
||||
break;
|
||||
|
||||
case 'hot':
|
||||
$artList = ArticleModel::field('id,title,cate_id,user_id,create_time')->with([
|
||||
$artList = ArticleModel::field('id,title,cate_id,user_id,create_time,is_top,is_hot')->with([
|
||||
'cate' => function($query){
|
||||
$query->where('delete_time',0)->field('id,catename');
|
||||
},
|
||||
@ -57,7 +57,7 @@ class Article extends BaseController
|
||||
break;
|
||||
|
||||
case 'top':
|
||||
$artList = ArticleModel::field('id,title,cate_id,user_id,create_time')->with([
|
||||
$artList = ArticleModel::field('id,title,cate_id,user_id,create_time,is_top,is_hot')->with([
|
||||
'cate' => function($query){
|
||||
$query->where('delete_time',0)->field('id,catename');
|
||||
},
|
||||
@ -68,7 +68,7 @@ class Article extends BaseController
|
||||
break;
|
||||
|
||||
default:
|
||||
$artList = ArticleModel::field('id,title,cate_id,user_id,create_time')->with([
|
||||
$artList = ArticleModel::field('id,title,cate_id,user_id,create_time,is_top,is_hot')->with([
|
||||
'cate' => function($query){
|
||||
$query->where('delete_time',0)->field('id,catename');
|
||||
},
|
||||
|
@ -23,7 +23,7 @@ class Index extends BaseController
|
||||
$sliders = Db::name('slider')->where('slid_status',1)->where('delete_time',0)->where('slid_type',1)->whereTime('slid_over','>=',time())->select();
|
||||
|
||||
//置顶文章
|
||||
$artTop = Article::field('id,title,cate_id,user_id,create_time')->where(['is_top'=>1,'status'=>1,'delete_time'=>0])->with([
|
||||
$artTop = Article::field('id,title,cate_id,user_id,create_time,is_top')->where(['is_top'=>1,'status'=>1,'delete_time'=>0])->with([
|
||||
'cate' => function($query){
|
||||
$query->where('delete_time',0)->field('id,catename');
|
||||
},
|
||||
@ -33,7 +33,7 @@ class Index extends BaseController
|
||||
])->withCount(['comments'])->order('create_time','desc')->limit(5)->withCache(30)->select();
|
||||
|
||||
//首页文章显示15条
|
||||
$artList = Article::field('id,title,cate_id,user_id,create_time')->with([
|
||||
$artList = Article::field('id,title,cate_id,user_id,create_time,is_hot')->with([
|
||||
'cate' => function($query){
|
||||
$query->where('delete_time',0)->field('id,catename');
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user