mirror of
https://gitee.com/ulthon/ulthon_information.git
synced 2026-03-04 00:24:29 +08:00
优化性能和轮播图;
This commit is contained in:
@@ -20,13 +20,11 @@ class Index extends Common
|
||||
public function index()
|
||||
{
|
||||
|
||||
|
||||
$page_cache_key = md5($this->request->url());
|
||||
|
||||
|
||||
$content = Cache::get($page_cache_key);
|
||||
|
||||
if (!empty($content)) {
|
||||
if (!env('app_debug') && !empty($content)) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
@@ -34,13 +32,15 @@ class Index extends Common
|
||||
$sub_category = [];
|
||||
$current_category = [];
|
||||
|
||||
if (!empty($this->request->param('category_id'))) {
|
||||
$sub_category = Category::where('pid', $this->request->param('category_id'))->where('type', 3)->order('sort asc')->select();
|
||||
$current_category = Category::find($this->request->param('category_id'));
|
||||
if (empty($this->request->param('sub_category_id'))) {
|
||||
$categorys = [$this->request->param('category_id')];
|
||||
$category_id = $this->request->param('category_id');
|
||||
|
||||
$categorys = array_merge($categorys, array_column((array)Category::getListLevel($this->request->param('category_id')), 3));
|
||||
if (!empty($category_id)) {
|
||||
$sub_category = Category::where('pid', $category_id)->where('type', 3)->order('sort asc')->select();
|
||||
$current_category = Category::find($category_id);
|
||||
if (empty($this->request->param('sub_category_id'))) {
|
||||
$categorys = [$category_id];
|
||||
|
||||
$categorys = array_merge($categorys, array_column((array)Category::getListLevel($category_id), 3));
|
||||
|
||||
$categorys_where = PostCategory::whereIn('category_id', $categorys);
|
||||
|
||||
@@ -76,6 +76,8 @@ class Index extends Common
|
||||
$content = View::fetch();
|
||||
|
||||
Cache::tag('page_cache')->set($page_cache_key, $content);
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user