Browse Source

送达时间

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

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

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

Loading…
Cancel
Save