diff --git a/app/Helpers/function.php b/app/Helpers/function.php
index 3a8d02a..99e22cb 100644
--- a/app/Helpers/function.php
+++ b/app/Helpers/function.php
@@ -225,3 +225,24 @@ function getOneArticle($article_id, $key = '')
return '';
}
+/**
+ * Notes: 判断顶级分类
+ *
+ * @Author: 玄尘
+ * @Date: 2021/12/9 10:13
+ * @param $parent_id
+ * @param $category_id
+ * @return bool
+ */
+function isTopCategory($parent_id, $category_id): bool
+{
+ $category_ids = [];
+ if (is_array($parent_id)) {
+ foreach ($parent_id as $id) {
+ $category_ids[] = (Category::getTopCategory($id))->id;
+ }
+ } else {
+ $category_ids[] = (Category::getTopCategory($parent_id))->id;
+ }
+ return in_array($category_id, $category_ids);
+}
\ No newline at end of file
diff --git a/app/Models/Category.php b/app/Models/Category.php
index 728e8f8..9c9f72c 100644
--- a/app/Models/Category.php
+++ b/app/Models/Category.php
@@ -127,4 +127,17 @@ class Category extends Model
return str_replace("\n", "", $this->description);
}
+ public static function getTopCategory($category_id)
+ {
+ $category = self::find($category_id);
+
+ while ($category) {
+ if ($category->parent) {
+ $category = $category->parent;
+ } else {
+ return $category;
+ }
+ }
+ }
+
}
diff --git a/config/article.php b/config/article.php
index 47a2257..600441a 100644
--- a/config/article.php
+++ b/config/article.php
@@ -3,6 +3,9 @@
return [
// 不显示时间段文章
'no_time' => [
- '118'
+ '118',
+ '131',
+ '133',
+ '134',
]
];
\ No newline at end of file
diff --git a/resources/views/category/hz_jl.blade.php b/resources/views/category/hz_jl.blade.php
new file mode 100644
index 0000000..b805b84
--- /dev/null
+++ b/resources/views/category/hz_jl.blade.php
@@ -0,0 +1,109 @@
+@extends('layouts.app')
+
+@section('title', $parent->title)
+
+@section('content')
+
+ @include('category.navigation')
+
+
+
+
+
+ @include('category.left')
+
+
+
+
+
+
+
+
+

+ {{ getOneCategory(26,'title') }}
+
+
+
+
+
+
+
+
+

+
+
+
+
{{ getOneCategory(78,'title') }}
+
+ @if (getArticlesBYCate(78,5)->isNotEmpty())
+ @foreach (getArticlesBYCate(78,5) as $info)
+ -
+
+
+
+ {{ $info->title }}
+
+
+ @if(!in_array($info->id,config('article.no_time')))
+
+ {{ $info->created_at->format('Y年m月d日')}}
+
+ @endif
+
+
+ @endforeach
+ @endif
+
+
+
+
+
+
+
+
+
+
+
+
+
{{ getOneCategory(77,'title') }}
+
更多>>
+
+
+
+ @if (getArticlesBYCate(77,3)->isNotEmpty())
+ @foreach (getArticlesBYCate(77,3) as $info)
+ -
+
+
+
+ {{ $info->title }}
+
+
+
+ {{ $info->created_at->format('Y年m月d日') }}
+
+
+
+ @endforeach
+ @endif
+
+
+
+
+
+
+
+
+
+
+@endsection
diff --git a/resources/views/category/kxcb.blade.php b/resources/views/category/kxcb.blade.php
new file mode 100644
index 0000000..4669753
--- /dev/null
+++ b/resources/views/category/kxcb.blade.php
@@ -0,0 +1,110 @@
+@extends('layouts.app')
+
+@section('title', $parent->title)
+
+@section('content')
+
+ @include('category.navigation')
+
+
+
+
+
+ @include('category.left')
+
+
+
+
+
+
+
{{ getOneCategory(29,'title') }}
+
+ 查看更多>>
+
+
+
+
+
+ @if(getVideoByCate(29))
+
+ @endif
+
+
+ {{ getVideoByCate(29,'title') }}
+
+
+
+
+ @if(getVideosByCate(29,10))
+ @foreach(getVideosByCate(29,10) as $video)
+ @if($loop->iteration>1)
+ -
+
+
+
+ {{ $video->title }}
+
+
+
+ {{ $video->created_at->format('Y年m月d日') }}
+
+
+
+ @endif
+ @endforeach
+ @endif
+
+
+
+
+
+
+
+
+
{{ getOneCategory(30,'title') }}
+
+ 查看更多>>
+
+
+
+ @if (getArticlesBYCate(30,2)->isNotEmpty())
+
+
+
+ @endif
+
+ @if (getArticlesBYCate(30,3)->isNotEmpty())
+
+ @foreach (getArticlesBYCate(30,3) as $info)
+ -
+
+
+
+ {{ $info->title }}
+
+
+
+ {{ $info->created_at->format('Y年m月d日') }}
+
+
+
+ @endforeach
+
+ @endif
+
+
+
+
+
+
+
+@endsection
diff --git a/resources/views/category/kxyj.blade.php b/resources/views/category/kxyj.blade.php
index fb2d15d..14a38a7 100644
--- a/resources/views/category/kxyj.blade.php
+++ b/resources/views/category/kxyj.blade.php
@@ -90,9 +90,11 @@
{{ $info->title }}
-
- {{ $info->created_at->format('Y年m月d日')}}
-
+ @if(!in_array($info->id,config('article.no_time')))
+
+ {{ $info->created_at->format('Y年m月d日')}}
+
+ @endif
@endforeach
@@ -268,8 +270,8 @@
@endif
-
+
{{ getVideoByCate(29,'title') }}
diff --git a/resources/views/category/xh_qk.blade.php b/resources/views/category/xh_qk.blade.php
index 4c9d802..528d3fa 100644
--- a/resources/views/category/xh_qk.blade.php
+++ b/resources/views/category/xh_qk.blade.php
@@ -38,31 +38,37 @@
@endif
-
-
-
-
{{ getOneCategory(64,'title') }}
- @if(getOneArticle(156))
-
-
- {{ getOneArticle(156,'title') }}
- / {{ getOneArticle(156,'remark') }}
-
- {{ getOneArticle(156,'description') }}
-
-
更多>>
-
-
-
- @endif
-
-
+
+
+
+
{{ getOneCategory(64,'title') }}
+ @if(getOneArticle(156))
+
+
+
+

+
+ {{ getOneArticle(156,'title') }}
+ {{ getOneArticle(156,'remark') }}
+
+
+
+ {{ getOneArticle(156,'description') }}
+
+
更多>>
+
+
+ @endif
+
+
diff --git a/resources/views/layouts/header.blade.php b/resources/views/layouts/header.blade.php
index 9e7acc7..c7432e4 100644
--- a/resources/views/layouts/header.blade.php
+++ b/resources/views/layouts/header.blade.php
@@ -60,7 +60,8 @@
}
@endphp
@foreach ($all_categorys as $cate)
- id,$top_ids)) class="active" @endif data-href="{{ $cate->link }}">
+ id,$cate->id)) class="active"
+ @endif data-href="{{ $cate->link }}">
{{ $cate->title }}
@endforeach