From 92b96aaf503f5abd4d427f8b78a051d0ab67e6f0 Mon Sep 17 00:00:00 2001 From: cody <648753004@qq.com> Date: Sat, 9 Aug 2025 17:43:44 +0800 Subject: [PATCH] update --- app/Http/Controllers/Mobile/CourseController.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Mobile/CourseController.php b/app/Http/Controllers/Mobile/CourseController.php index bfa5fec..aa8eb28 100755 --- a/app/Http/Controllers/Mobile/CourseController.php +++ b/app/Http/Controllers/Mobile/CourseController.php @@ -839,6 +839,7 @@ class CourseController extends CommonController * path="/api/mobile/course/calendars", * tags={"小程序-课程"}, * summary="日历", + * @OA\Parameter(name="type", in="query", @OA\Schema(type="string"), required=false, description="类型"), * @OA\Parameter(name="month", in="query", @OA\Schema(type="string"), required=false, description="月份,例如:2025-01"), * @OA\Parameter(name="token", in="query", @OA\Schema(type="string"), required=true, description="token"), * @OA\Response( @@ -862,8 +863,13 @@ class CourseController extends CommonController // $startDate = $all['month'] . '-01'; // $endDate = date('Y-m-t', strtotime($startDate)); $list = Calendar::with('course', 'courseContent') + ->where(function ($query) use ($all) { + if (isset($all['type'])) { + $query->where('type', $all['type']); + } + }) ->orderBy('start_time', 'asc') - ->whereDate('start_time', '<=', $all['month']) + ->where('start_time', 'like', '%' . $all['month'] . '%') ->get(); // $range = getDates($startDate, $endDate);