diff --git a/app/index/controller/Article.php b/app/index/controller/Article.php index 51e1cce..33c469f 100644 --- a/app/index/controller/Article.php +++ b/app/index/controller/Article.php @@ -27,18 +27,18 @@ class Article extends BaseController //获取分类ID $ename = Request::param('ename'); $type = Request::param('type'); - $cate = Db::name('cate')->where('ename',$ename)->find(); - - if($cate){ - $where = ['cate_id' => $cate['id']]; + $page = Request::param('page'); + + $cateId = Db::name('cate')->where('ename',$ename)->value('id'); + if($cateId){ + $where = ['cate_id' => $cateId]; } - $artList = Cache::get('arts'.$cate['id'].$type); - + $artList = Cache::get('arts'.$ename.$type.$page); if(!$artList){ switch ($type) { //查询文章,15个分1页 - case 'all': + case 'jie': $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 'user' => function($query){ $query->field('id,name,nickname,user_img,area_id'); } - ])->withCount(['comments'])->where('status',1)->where($where)->order(['is_top'=>'desc','create_time'=>'desc'])->paginate(15); + ])->withCount(['comments'])->where(['status'=>1,'jie'=>1])->where($where)->order(['is_top'=>'desc','create_time'=>'desc'])->paginate(15); break; case 'hot': @@ -79,11 +79,11 @@ class Article extends BaseController 'user' => function($query){ $query->field('id,name,nickname,user_img,area_id'); } - ])->withCount(['comments'])->where('status',1)->where($where)->order(['is_top'=>'desc','create_time'=>'desc'])->withCache(30)->paginate(15); - + ])->withCount(['comments'])->where('status',1)->where($where)->order(['is_top'=>'desc','create_time'=>'desc'])->paginate(15); + break; } - Cache::set('arts'.$cate['id'].$type,$artList,600); + Cache::set('arts'.$ename.$type.$page,$artList,600); } diff --git a/config/cache.php b/config/cache.php index d449329..db3fcd1 100644 --- a/config/cache.php +++ b/config/cache.php @@ -14,7 +14,7 @@ return [ // 驱动方式 'type' => 'File', // 缓存保存目录 - 'path' => '', + 'path' => '../runtime/cache/', // 缓存前缀 'prefix' => '', // 缓存有效期 0表示永久缓存 diff --git a/public/.htaccess b/public/.htaccess index e3df000..f6dffab 100644 --- a/public/.htaccess +++ b/public/.htaccess @@ -1,8 +1,13 @@ Options +FollowSymlinks -Multiviews RewriteEngine On + FileETag MTime Size + RewriteBase / + RewriteCond %{SERVER_PORT} !^443$ + RewriteRule (.*) https://%{SERVER_NAME}/$1 [R=301,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1] + diff --git a/public/robots.txt b/public/robots.txt index eb05362..5c3517f 100644 --- a/public/robots.txt +++ b/public/robots.txt @@ -1,2 +1,8 @@ User-agent: * -Disallow: + +Disallow: /admin/ +Disallow: /index/user/ +Disallow: /index/api/ +Disallow: /index/login.html +Disallow: /index/reg.html +Disallow: /*?* \ No newline at end of file diff --git a/view/index/index/index.html b/view/index/index/index.html index fb80bf9..5cc66a7 100644 --- a/view/index/index/index.html +++ b/view/index/index/index.html @@ -102,7 +102,7 @@
- 更多帖子 + 更多帖子
diff --git a/view/index/public/filter.html b/view/index/public/filter.html index fd9fd99..0454242 100644 --- a/view/index/public/filter.html +++ b/view/index/public/filter.html @@ -1,10 +1,12 @@
- 综合 + 综合 - 热帖 + 已结 + + 热帖 - 精华 + 精华