|
|
|
@ -22,10 +22,16 @@ class Course extends CourseModel |
|
|
|
|
* @return \think\Paginator |
|
|
|
|
* @throws \think\db\exception\DbException |
|
|
|
|
*/ |
|
|
|
|
public function getList(): \think\Paginator |
|
|
|
|
{ |
|
|
|
|
return $this->order(['sort' => 'asc', 'create_time' => 'desc'])->paginate(15); |
|
|
|
|
|
|
|
|
|
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); |
|
|
|
|
} else { |
|
|
|
|
$list = $this->where('course_category_id',$courseCategoryId) |
|
|
|
|
->where('status',1)->order(['sort' => 'asc', 'create_time' => 'desc'])->paginate($pageSize); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $list; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |