Browse Source

送达时间

master
Lemon 5 years ago
parent
commit
a096885e0c
  1. 9
      app/Service/v3/Implementations/AppointmentTimeService.php

9
app/Service/v3/Implementations/AppointmentTimeService.php

@ -77,14 +77,13 @@ class AppointmentTimeService implements AppointmentTimeServiceInterface
$res = [];
$time1Max = max($time1Arr);
$time2Min = min($time2Arr);
if($time2Min > $nowTime+60*30) {
if($time2Min > $nowTime) {
$res = array_merge($res,$this->calculateTime($time1Max, $time2Min));
}
if(!empty($time3Arr) && !empty($time4Arr)){
var_dump($time3Arr,$time4Arr);
$time3Max = max($time3Arr);
$time4Min = min($time4Arr);
if($time4Min > $nowTime+60*30) {
if($time4Min > $nowTime) {
$res = array_merge($res,$this->calculateTime($time3Max, $time4Min));
}
}
@ -102,7 +101,11 @@ class AppointmentTimeService implements AppointmentTimeServiceInterface
$peakPeriod = strtotime('16:00');
$peakPeriodEnd = strtotime('18:00');
//取得订单下所有店铺时间段 交集 并计算时间段横跨单位区间长度
if($endTime == $startTime){
$length = 1;
}else{
$length = ceil(($endTime - $startTime) / (30*60));
}
for ($i=1;$i<=$length;$i++){
$addTime = $startTime + (30*60*$i);
if($addTime >= $peakPeriod && $addTime < $peakPeriodEnd){

Loading…
Cancel
Save