diff --git a/app/Http/Controllers/Admin/OtherController.php b/app/Http/Controllers/Admin/OtherController.php index 63f1821..5e41b8d 100755 --- a/app/Http/Controllers/Admin/OtherController.php +++ b/app/Http/Controllers/Admin/OtherController.php @@ -683,8 +683,12 @@ class OtherController extends CommonController case 'course_total': // 开课场次明细 - 与coursesHome算法一致 - $calendars = Calendar::whereIn('course_id', $course_ids) - ->whereBetween('date', [$start_date, $end_date]) + $calendars = Calendar::whereBetween('date', [$start_date, $end_date]) + ->where(function ($query) use ($course_ids) { + if (request('course_type_id')) { + $query->whereIn('course_id', $course_ids); + } + }) ->with('course') ->get(); @@ -711,9 +715,12 @@ class OtherController extends CommonController case 'course_day_total': // 开课天数明细 - 与coursesHome算法一致 - $calendars = Calendar::whereIn('course_id', $course_ids) - ->whereBetween('date', [$start_date, $end_date]) - ->where('is_count_days', 1) + $calendars = Calendar::whereBetween('date', [$start_date, $end_date]) + ->where(function ($query) use ($course_ids) { + if (request('course_type_id')) { + $query->whereIn('course_id', $course_ids); + } + })->where('is_count_days', 1) ->with('course') ->get();