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

interface

... ... @@ -139,19 +139,25 @@ class OrderController extends HomeBaseController{
if ($hours_end_time > $hours_start_time){
//在预设时间段左边并不与之重合
if (($new_start_time > strtotime('00:00:00') && $new_start_time < $endTime) && ($new_end_time > $new_start_time && $new_end_time < $endTime)){
echo 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)){
echo 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){
echo 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)){
//存在首小时免费
echo 4;
echo $new_end_time;
echo $new_start_time;
$price +=(ceil(($new_end_time-$new_start_time)/3600) * $cost['cost']);
if ($free==1 && $is_free==0){
$price-=$cost['cost'];
... ... @@ -161,6 +167,7 @@ class OrderController extends HomeBaseController{
//与预设时间段的头部重合
if (($new_start_time > $endTime && $new_start_time < $stateTime) && ($new_end_time > $stateTime && $new_end_time < strtotime('24:00:00'))){
//存在首小时免费
echo 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'];
... ... @@ -169,6 +176,7 @@ 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'))){
echo 6;
$price +=(ceil(($new_end_time-$new_start_time)/3600) * $interval['price']);
}
... ... @@ -178,6 +186,7 @@ class OrderController extends HomeBaseController{
$YesterdayEndTime=$endTime-86400;
//昨天预设结束前使用,今天预设结束前停止
if(($new_start_time > (strtotime('00:00:00')-86400) && $new_start_time < $YesterdayEndTime) && ($new_end_time > strtotime('00:00:00') && $new_end_time < $endTime)){
echo 1;
$price+= ceil(($YesterdayEndTime-$new_start_time)/3600) * $interval['price']
+ceil(($YesterdayStateTime-$YesterdayEndTime)/3600) * $cost['cost']
+ceil(($new_end_time-$YesterdayStateTime)/3600) * $interval['price'];
... ... @@ -185,6 +194,7 @@ class OrderController extends HomeBaseController{
//昨天预设开始前使用,今天预设结束前停止
if(($new_start_time > $YesterdayEndTime && $new_start_time < $YesterdayStateTime) && ($new_end_time > strtotime('00:00:00') && $new_end_time < $endTime)){
//存在首小时免费
echo 1;
$price+= ceil(($YesterdayStateTime-$new_start_time)/3600) * $cost['cost']
+ceil(($new_end_time-$YesterdayStateTime)/3600) * $interval['price'];
if ($free==1 && $is_free==0){
... ... @@ -195,6 +205,7 @@ class OrderController extends HomeBaseController{
//昨天预设开始前使用,今天预设结束后停止
if(($new_start_time > $YesterdayEndTime && $new_start_time < $YesterdayStateTime) && ($new_end_time > $endTime && $new_end_time < $stateTime)){
//存在首小时免费
echo 1;
$price+= ceil(($YesterdayStateTime-$new_start_time)/3600) * $cost['cost']
+ceil(($endTime-$YesterdayStateTime)/3600) * $interval['price']
+ceil(($new_end_time-$endTime)/3600) * $cost['cost'];
... ... @@ -205,15 +216,18 @@ class OrderController extends HomeBaseController{
}
//昨天预设开始后使用,今天预设结束前停止
if(($new_start_time > $YesterdayStateTime && $new_start_time < strtotime('00:00:00')) && ($new_end_time > strtotime('00:00:00') && $new_end_time < $endTime)){
echo 1;
$price+= ceil(($new_end_time-$new_start_time)/3600) * $interval['price'];
}
//昨天预设开始后使用,今天预设结束后停止
if(($new_start_time > $YesterdayStateTime && $new_start_time < strtotime('00:00:00')) && ($new_end_time > $endTime && $new_end_time < $stateTime)){
echo 1;
$price+= ceil(($endTime-$new_start_time)/3600) * $interval['price']
+ceil(($new_end_time-$endTime)/3600) * $cost['cost'];
}
//昨天预设开始后使用,今天预设开始前停止
if(($new_start_time > $YesterdayStateTime && $new_start_time < strtotime('00:00:00')) && ($new_end_time > $stateTime && $new_end_time < ($new_start_time+86400))){
echo 1;
$price+= ceil(($endTime-$new_start_time)/3600) * $interval['price']
+ceil(($stateTime-$endTime)/3600) * $cost['cost']
+ceil(($new_end_time-$stateTime)/3600) * $interval['price'];
... ...