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);