diff --git a/app/admin/model/Course.php b/app/admin/model/Course.php index cb0ca179..985683cd 100644 --- a/app/admin/model/Course.php +++ b/app/admin/model/Course.php @@ -25,10 +25,10 @@ class Course extends CourseModel public function getList(int $courseCategoryId, int $pageSize ): \think\Paginator { if(empty($courseCategoryId)){ - $list = $this->where('status',1)->order(['sort' => 'asc', 'create_time' => 'desc'])->paginate($pageSize); + $list = $this->order(['sort' => 'asc', 'create_time' => 'desc'])->paginate($pageSize); } else { $list = $this->where('course_category_id',$courseCategoryId) - ->where('status',1)->order(['sort' => 'asc', 'create_time' => 'desc'])->paginate($pageSize); + ->order(['sort' => 'asc', 'create_time' => 'desc'])->paginate($pageSize); } return $list; diff --git a/app/api/controller/Course.php b/app/api/controller/Course.php index 00f7a355..6b27362f 100644 --- a/app/api/controller/Course.php +++ b/app/api/controller/Course.php @@ -27,7 +27,7 @@ class Course extends Controller $pageSize = input('pageSize'); $list = CourseModel::withoutGlobalScope() ->when($courseCategoryId, function ($query) use ($courseCategoryId) { - return $query->where('course_category_id', $courseCategoryId); + return $query->where('course_category_id', $courseCategoryId)->where('status', 1); })->paginate($pageSize); if(empty($list)){