作者 董瑞恩
1 个管道 的构建 通过 耗费 0 秒

interface

... ... @@ -137,29 +137,25 @@ class OrderController extends HomeBaseController{
if ($endTime < $stateTime){
//设备使用时间段是否跨天(不跨天)
if ($hours_end_time > $hours_start_time){
dump(date('Y-m-d H:i:s',$new_start_time));
dump(date('Y-m-d H:i:s',$new_end_time));
dump(date('Y-m-d H:i:s',$stateTime));
dump(date('Y-m-d H:i:s',$endTime));
// dump(date('Y-m-d H:i:s',$new_start_time));
// dump(date('Y-m-d H:i:s',$new_end_time));
// dump(date('Y-m-d H:i:s',$stateTime));
// dump(date('Y-m-d H:i:s',$endTime));
//在预设时间段左边并不与之重合
if (($new_start_time > strtotime('00:00:00') && $new_start_time < $endTime) && ($new_end_time > $new_start_time && $new_end_time < $endTime)){
dump('1');
$price +=(ceil(($new_end_time-$new_start_time)/3600) * $interval['price']);
}
//与预设时间段的尾部重合
if (($new_start_time > strtotime('00:00:00') && $new_start_time < $endTime) && ($new_end_time > $endTime && $new_end_time < $stateTime)){
dump('2');
$price +=(ceil(($endTime-$new_start_time)/3600) * $interval['price'] + ceil(($new_end_time-$endTime)/3600) * $cost['cost']);
}
//与预设时间段的头尾都重合
if (($new_start_time > strtotime('00:00:00') && $new_start_time < $endTime) && $new_end_time > $stateTime){
dump('3');
$price +=(ceil(($endTime-$new_start_time)/3600) * $interval['price'] + ceil(($new_end_time-$stateTime)/3600) * $interval['price'] + ceil(($stateTime-$endTime)/3600) * $cost['cost']);
}
//不与预设时间段重合
if (($new_start_time > $endTime && $new_start_time < $stateTime) && ($new_end_time > $new_start_time && $new_end_time < $stateTime)){
//存在首小时免费
dump('4');
$price +=(ceil(($new_end_time-$new_start_time)/3600) * $cost['cost']);
if ($free==1 && $is_free==0){
$price-=$cost['cost'];
... ... @@ -169,7 +165,6 @@ class OrderController extends HomeBaseController{
//与预设时间段的头部重合
if (($new_start_time > $endTime && $new_start_time < $stateTime) && ($new_end_time > $stateTime && $new_end_time < strtotime('24:00:00'))){
//存在首小时免费
dump('5');
$price += (ceil(($stateTime-$new_start_time)/3600) * $cost['cost'] + ceil(($new_end_time-$stateTime)/3600) * $interval['price']);
if ($free==1 && $is_free==0){
$price-=$cost['cost'];
... ... @@ -178,10 +173,8 @@ class OrderController extends HomeBaseController{
}
//在预设时间段右边并不与之重合
if (($new_start_time > $stateTime && $new_start_time < strtotime('24:00:00')) && ($new_end_time > $new_start_time && $new_end_time < strtotime('24:00:00'))){
dump('6');
$price +=(ceil(($new_end_time-$new_start_time)/3600) * $interval['price']);
}
dump('什么都没有');
//设备使用时间段是否跨天(跨天:开始时间在昨天,结束时间在今天)
}else{
$YesterdayStateTime=$stateTime-86400;
... ...