From e35c55a03f0f58ed8dc79b45390ca9404957df70 Mon Sep 17 00:00:00 2001 From: koogua Date: Wed, 9 Dec 2020 15:25:55 +0800 Subject: [PATCH 1/4] =?UTF-8?q?!38=20=E4=BF=AE=E5=A4=8D=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E6=9C=AA=E8=BF=87=E6=BB=A4=20*=20=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=E8=AF=BE=E7=A8=8B=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Admin/Services/Course.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Http/Admin/Services/Course.php b/app/Http/Admin/Services/Course.php index 9dba1d7c..b0f4bfdc 100644 --- a/app/Http/Admin/Services/Course.php +++ b/app/Http/Admin/Services/Course.php @@ -8,6 +8,7 @@ use App\Caches\CourseCategoryList as CourseCategoryListCache; use App\Caches\CourseRelatedList as CourseRelatedListCache; use App\Caches\CourseTeacherList as CourseTeacherListCache; use App\Library\Paginator\Query as PagerQuery; +use App\Models\Category as CategoryModel; use App\Models\Course as CourseModel; use App\Models\CourseCategory as CourseCategoryModel; use App\Models\CourseRating as CourseRatingModel; @@ -224,7 +225,10 @@ class Course extends Service { $categoryRepo = new CategoryRepo(); - $allCategories = $categoryRepo->findAll(['deleted' => 0]); + $allCategories = $categoryRepo->findAll([ + 'type' => CategoryModel::TYPE_COURSE, + 'deleted' => 0, + ]); if ($allCategories->count() == 0) { return []; From 3854e1d4581b2bca14a30190072fad22ce0aa1b2 Mon Sep 17 00:00:00 2001 From: koogua Date: Wed, 9 Dec 2020 15:31:42 +0800 Subject: [PATCH 2/4] =?UTF-8?q?!39=20=E4=BF=AE=E5=A4=8D=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E6=9C=AA=E8=BF=87=E6=BB=A4=20*=20=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=E8=AF=BE=E7=A8=8B=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Admin/Services/Course.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Http/Admin/Services/Course.php b/app/Http/Admin/Services/Course.php index 9dba1d7c..b0f4bfdc 100644 --- a/app/Http/Admin/Services/Course.php +++ b/app/Http/Admin/Services/Course.php @@ -8,6 +8,7 @@ use App\Caches\CourseCategoryList as CourseCategoryListCache; use App\Caches\CourseRelatedList as CourseRelatedListCache; use App\Caches\CourseTeacherList as CourseTeacherListCache; use App\Library\Paginator\Query as PagerQuery; +use App\Models\Category as CategoryModel; use App\Models\Course as CourseModel; use App\Models\CourseCategory as CourseCategoryModel; use App\Models\CourseRating as CourseRatingModel; @@ -224,7 +225,10 @@ class Course extends Service { $categoryRepo = new CategoryRepo(); - $allCategories = $categoryRepo->findAll(['deleted' => 0]); + $allCategories = $categoryRepo->findAll([ + 'type' => CategoryModel::TYPE_COURSE, + 'deleted' => 0, + ]); if ($allCategories->count() == 0) { return []; From 70682f1ebbed4adec0fed8cdbf9c0b64855a026d Mon Sep 17 00:00:00 2001 From: koogua Date: Wed, 9 Dec 2020 16:01:04 +0800 Subject: [PATCH 3/4] =?UTF-8?q?!40=20=E4=BF=AE=E5=A4=8D=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E6=9C=AA=E8=BF=87=E6=BB=A42=20*=20=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=E8=AF=BE=E7=A8=8B=E5=88=86=E7=B1=BB=20*=20=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=E8=AF=BE=E7=A8=8B=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Admin/Services/Course.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Http/Admin/Services/Course.php b/app/Http/Admin/Services/Course.php index b0f4bfdc..7f644d0d 100644 --- a/app/Http/Admin/Services/Course.php +++ b/app/Http/Admin/Services/Course.php @@ -251,8 +251,11 @@ class Course extends Service $list = []; + /** + * 没有二级分类的不显示 + */ foreach ($allCategories as $category) { - if ($category->level == 1) { + if ($category->level == 1 && $category->child_count > 0) { $list[$category->id] = [ 'name' => $category->name, 'value' => $category->id, From 9d8c147d38e0f6075aa56af10b3cdabbbaf85067 Mon Sep 17 00:00:00 2001 From: koogua Date: Wed, 9 Dec 2020 17:50:08 +0800 Subject: [PATCH 4/4] =?UTF-8?q?!41=20=E4=BF=AE=E5=A4=8D=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E6=9C=AA=E8=BF=87=E6=BB=A42=20*=20=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=E8=AF=BE=E7=A8=8B=E5=88=86=E7=B1=BB=20*=20=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=E8=AF=BE=E7=A8=8B=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Admin/Services/Course.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Http/Admin/Services/Course.php b/app/Http/Admin/Services/Course.php index b0f4bfdc..7f644d0d 100644 --- a/app/Http/Admin/Services/Course.php +++ b/app/Http/Admin/Services/Course.php @@ -251,8 +251,11 @@ class Course extends Service $list = []; + /** + * 没有二级分类的不显示 + */ foreach ($allCategories as $category) { - if ($category->level == 1) { + if ($category->level == 1 && $category->child_count > 0) { $list[$category->id] = [ 'name' => $category->name, 'value' => $category->id,