From 64f398307e8a44f3e0b28065adbbf849d143cbf5 Mon Sep 17 00:00:00 2001 From: Lemon <15040771@qq.com> Date: Mon, 14 Sep 2020 18:10:48 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=81=E8=BE=BE=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../v3/Implementations/AppointmentTimeService.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/Service/v3/Implementations/AppointmentTimeService.php b/app/Service/v3/Implementations/AppointmentTimeService.php index a5b2e6c..01a98fa 100644 --- a/app/Service/v3/Implementations/AppointmentTimeService.php +++ b/app/Service/v3/Implementations/AppointmentTimeService.php @@ -71,16 +71,16 @@ class AppointmentTimeService implements AppointmentTimeServiceInterface $time1Max = max($time1Arr); $time2Min = min($time2Arr); if($time2Min > $nowTime) { - array_push($res, $this->calculateTime($time1Max, $time2Min)); + $res[] = $this->calculateTime($time1Max, $time2Min); } if(!empty($time3Arr) && !empty($time4Arr)){ $time3Max = max($time3Arr); $time4Min = min($time4Arr); if($time4Min > $nowTime) { - array_push($res, $this->calculateTime($time3Max, $time4Min)); + $res[] = $this->calculateTime($time3Max, $time4Min); } } - return $res; + return array_shift($res); } function calculateTime($startTime,$endTime) @@ -102,7 +102,9 @@ class AppointmentTimeService implements AppointmentTimeServiceInterface $i+=$span; $addTime = $startTime + (30*60*$i); } - $res[] = date('H:i',$addTime) . ' - ' . date('H:i',$addTime + (30*60)); + $date['title'] = date('H:i',$addTime) . ' - ' . date('H:i',$addTime + (30*60)); + $date['value'] = date('H:i',$addTime) . ' - ' . date('H:i',$addTime + (30*60)); + $res[] = $date; } return $res; }