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

interface

... ... @@ -97,6 +97,12 @@ class OrderController extends HomeBaseController{
}
Db::commit();
//调起支付
if ($price==0){
$data=[
'state'=>2,
];
$this->apiResponse(200,'success',$data);
}
$this->pay($order['order_no']);
}
... ... @@ -137,14 +143,18 @@ class OrderController extends HomeBaseController{
if (($new_start_time > $endTime && $new_start_time < $stateTime) && ($new_end_time < $new_start_time && $new_end_time < $stateTime)){
//存在首小时免费
$price +=(ceil(($new_end_time-$new_start_time)/3600) * $cost['cost']);
if ($free==1){
$price-=$cost['cost'];
}
}
//与预设时间段的头部重合
if (($new_start_time > $endTime && $new_start_time < $stateTime) && ($new_end_time > $stateTime && $new_end_time < strtotime('24:00:00'))){
//存在首小时免费
$price += (ceil(($stateTime-$new_start_time)/3600) * $cost['cost'] + ceil(($new_end_time-$stateTime)/3600) * $interval['price']);
if ($free==1){
$price-=$cost['cost'];
}
}
//在预设时间段右边并不与之重合
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'))){
$price +=(ceil(($new_end_time-$new_start_time)/3600) * $interval['price']);
... ... @@ -165,18 +175,20 @@ class OrderController extends HomeBaseController{
//存在首小时免费
$price+= ceil(($YesterdayStateTime-$new_start_time)/3600) * $cost['cost']
+ceil(($new_end_time-$YesterdayStateTime)/3600) * $interval['price'];
if ($free==1){
$price-=$cost['cost'];
}
}
//昨天预设开始前使用,今天预设结束后停止
if(($new_start_time > $YesterdayEndTime && $new_start_time < $YesterdayStateTime) && ($new_end_time > $endTime && $new_end_time < $stateTime)){
//存在首小时免费
$price+= ceil(($YesterdayStateTime-$new_start_time)/3600) * $cost['cost']
+ceil(($endTime-$YesterdayStateTime)/3600) * $interval['price']
+ceil(($new_end_time-$endTime)/3600) * $cost['cost'];
if ($free==1){
$price-=$cost['cost'];
}
}
//昨天预设开始后使用,今天预设结束前停止
if(($new_start_time > $YesterdayStateTime && $new_start_time < strtotime('00:00:00')) && ($new_end_time > strtotime('00:00:00') && $new_end_time < $endTime)){
$price+= ceil(($new_end_time-$new_start_time)/3600) * $interval['price'];
... ...