From 295c89c4d4b53b75436eb29716ff97de994e4866 Mon Sep 17 00:00:00 2001 From: cody <648753004@qq.com> Date: Thu, 28 May 2026 13:17:25 +0800 Subject: [PATCH] update --- app/Console/Commands/AutoSchoolmate.php | 6 ++-- .../Admin/AppointmentController.php | 1 + ...01_add_course_id_to_appointments_table.php | 31 +++++++++++++++++++ 3 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 database/migrations/2026_05_28_000001_add_course_id_to_appointments_table.php diff --git a/app/Console/Commands/AutoSchoolmate.php b/app/Console/Commands/AutoSchoolmate.php index c08343a..2e8ba10 100755 --- a/app/Console/Commands/AutoSchoolmate.php +++ b/app/Console/Commands/AutoSchoolmate.php @@ -41,11 +41,11 @@ class AutoSchoolmate extends Command */ public function handle() { - // 获取所有已开始且需要自动加入校友库的课程(只处理存在 start_date 的课程) - $today = date('Y-m-d'); + // 获取所有明天开课且需要自动加入校友库的课程(只处理存在 start_date 的课程) + $tomorrow = date('Y-m-d', strtotime('+1 day')); $courses = Course::where('auto_schoolmate', 1) ->whereNotNull('start_date') - ->where('start_date', '<=', $today) + ->where('start_date', $tomorrow) ->get(); if ($courses->isEmpty()) { diff --git a/app/Http/Controllers/Admin/AppointmentController.php b/app/Http/Controllers/Admin/AppointmentController.php index adb7067..c7f1436 100755 --- a/app/Http/Controllers/Admin/AppointmentController.php +++ b/app/Http/Controllers/Admin/AppointmentController.php @@ -159,6 +159,7 @@ class AppointmentController extends BaseController * summary="更新或新增", * @OA\Parameter(name="id", in="query", @OA\Schema(type="integer"), required=true, description="课程ID(存在则更新,不存在则新增)"), * @OA\Parameter(name="user_id", in="query", @OA\Schema(type="string", format="date"), description="用户id,创建时多个用户英文逗号分隔"), + * @OA\Parameter(name="course_id", in="query", @OA\Schema(type="integer"), description="课程id"), * @OA\Parameter(name="date", in="query", @OA\Schema(type="string", format="date"), description="预约日期"), * @OA\Parameter(name="start_time", in="query", @OA\Schema(type="string", format="date-time"), description="开始时间,例如:2023-01-01 11:11:11"), * @OA\Parameter(name="end_time", in="query", @OA\Schema(type="string", format="date-time"), description="结束时间,例如:2023-01-01 11:11:11"), diff --git a/database/migrations/2026_05_28_000001_add_course_id_to_appointments_table.php b/database/migrations/2026_05_28_000001_add_course_id_to_appointments_table.php new file mode 100644 index 0000000..65cf752 --- /dev/null +++ b/database/migrations/2026_05_28_000001_add_course_id_to_appointments_table.php @@ -0,0 +1,31 @@ +integer('course_id')->nullable()->after('user_id')->comment('课程id'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('appointments', function (Blueprint $table) { + $table->dropColumn('course_id'); + }); + } +};