From d8acea60d46ece96fa29d042dbea5c8fb557b346 Mon Sep 17 00:00:00 2001 From: yanzai Date: Mon, 29 Apr 2024 11:08:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8F=AF=E9=A2=84=E7=BA=A6?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E8=8C=83=E5=9B=B4=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/AppointmentController.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/AppointmentController.php b/app/Http/Controllers/AppointmentController.php index 3d345a3..4409ccd 100644 --- a/app/Http/Controllers/AppointmentController.php +++ b/app/Http/Controllers/AppointmentController.php @@ -5,6 +5,7 @@ namespace App\Http\Controllers; use App\Models\Appointment; use App\Models\AppointmentHolidays; use App\Models\AppointmentTemplate; +use App\Models\Config; use App\Models\Hospital; use Illuminate\Http\Request; use Login; @@ -269,13 +270,24 @@ class AppointmentController extends Controller Login::user(); $month = $request->post('month'); $hospital = $request->post('hospital'); + + // var_dump($sevenDaysLater); $appointments = Appointment::where('hospital', $hospital) - ->where('date', 'like', $month . '%') + ->where('date', 'like', $month . '%'); + + $config=Config::where('label','预约时间范围')->first(); + if(!!$config and $config->value>0){ + $range = date('Y-m-d', strtotime('+'.$config->value.' days')); //N天后的日期 + $appointments=$appointments ->where('date', '<=', $range); + } + + $appointments=$appointments ->where('status', 1) ->where('del', 2) ->orderBy('date') ->orderBy('start_time') ->get(); + $list = []; foreach ($appointments as $appointment) { $date = substr($appointment->date, 8, 2);