作者 景龙
1 个管道 的构建 通过 耗费 2 秒

关闭首页缓存

... ... @@ -22,16 +22,16 @@ class IndexController extends HomeBaseController
//统计访问量
$serverModel->statistics();
//banner轮播图
$coverImg = cache('coverImg');
if(!$coverImg){
// $coverImg = cache('coverImg');
// if(!$coverImg){
$coverImg = $this->getCoverImg(CityCategoryModel::indexImg,3);
cache('coverImg',$coverImg);
}
// cache('coverImg',$coverImg);
// }
$this->assign('coverImg',$coverImg);
//星球奇境,城市分类
$city = cache('res_city');
if(!$city){
// $city = cache('res_city');
// if(!$city){
$city[1]['id'] = CityCategoryModel::asia;
$city[2]['id'] = CityCategoryModel::europe;
$city[3]['id'] = CityCategoryModel::africa;
... ... @@ -52,13 +52,13 @@ class IndexController extends HomeBaseController
}
}
}
cache('res_city', $city);
}
// cache('res_city', $city);
// }
$this->assign('res_city',$city);
//星享体验
$month = cache('res_month');
if(!$month){
// $month = cache('res_month');
// if(!$month){
$res_month = $this->getMonthArticle();
$month = [];
foreach($res_month['data'] as &$value){
... ... @@ -72,8 +72,8 @@ class IndexController extends HomeBaseController
}
}
}
cache('res_month', $month);
}
// cache('res_month', $month);
// }
$this->assign('res_month',$month);
//星域秀场->星球影院
... ... @@ -113,27 +113,27 @@ class IndexController extends HomeBaseController
//星域秀场->明星访谈
$res_mxft = cache('res_mxft');
if(!$res_mxft){
// $res_mxft = cache('res_mxft');
// if(!$res_mxft){
$position = CityCategoryModel::mxft;
$field = 'id,full_name,position,trade,post_excerpt,thumbnail avatar';
$res_mxft = $this->getChildArticle($position,$field,1);
if($res_mxft){
$res_mxft = $res_mxft[0];
}
cache('res_mxft',$res_mxft);
}
// cache('res_mxft',$res_mxft);
// }
$this->assign('res_mxft',$res_mxft);
//星域秀场->星域画廊
$res_xyhl = cache('res_xyhl');
if(!$res_xyhl){
// $res_xyhl = cache('res_xyhl');
// if(!$res_xyhl){
$position = CityCategoryModel::xyhl;
$field = 'id,thumbnail';
$res_xyhl = $this->getChildArticle($position,$field,16);
cache('res_xyhl',$res_xyhl);
}
// cache('res_xyhl',$res_xyhl);
// }
$this->assign('res_xyhl',$res_xyhl);
... ... @@ -149,13 +149,13 @@ class IndexController extends HomeBaseController
//星际活动
$res_xjhd = cache('res_xjhd');
if(!$res_xjhd){
// $res_xjhd = cache('res_xjhd');
// if(!$res_xjhd){
$position = CityCategoryModel::xjhd;
$field = 'id,post_title,thumbnail';
$res_xjhd = $this->getParentArticle($position,$field,2);
cache('res_xjhd',$res_xjhd);
}
// cache('res_xjhd',$res_xjhd);
// }
$this->assign('res_xjhd',$res_xjhd);
return $this->fetch();
}
... ...