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 @@