Commit ef4bcd6d authored by wangzhengwen's avatar wangzhengwen

课程列表

parent 6698a57c
......@@ -90,11 +90,13 @@ class Course extends Model
public function getCourseList($category_id, $page, $pageSize, $searchKeyWords = null)
{
$where = ['status' => 3, 'is_sell' => 1, 'is_del' => 0];
$query = self::where($where);
if ($category_id) {
$where['cate_id'] = $category_id;
$son_ids = CourseCategory::where('pid', $category_id)->column('id');
$query->whereIn('cate_id', array_merge([$category_id], $son_ids));
}
$query = self::where($where);
if ($searchKeyWords) {
$query->where('title', 'like', '%' . $searchKeyWords . '%');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment