|
|
|
@ -40,6 +40,7 @@ class AppointmentTimeService implements AppointmentTimeServiceInterface |
|
|
|
$time3Arr = []; |
|
|
|
$time4Arr = []; |
|
|
|
$nowTime = time(); |
|
|
|
//取得所有店铺营业时间交集
|
|
|
|
foreach($stores as $store){ |
|
|
|
//店铺手动 点击歇业
|
|
|
|
if($store['is_rest'] == 1){ |
|
|
|
@ -70,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) |
|
|
|
@ -101,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; |
|
|
|
} |