lszyh
zengyyh 7 months ago
parent db4ca90183
commit 42467e693c
  1. 4
      app/admin/model/Course.php
  2. 2
      app/api/controller/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;

@ -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)){

Loading…
Cancel
Save