...
|
...
|
@@ -117,9 +117,13 @@ class OrderController extends HomeBaseController{ |
|
|
$cost=Db::name('cost')->where('id',1)->find();
|
|
|
$interval = Db::name('interval')->where('id',1)->find();
|
|
|
$free=$cost['free'];
|
|
|
//获取整天的价格
|
|
|
$dayPrice=$this->getDayPrice();
|
|
|
|
|
|
|
|
|
//用了多少天
|
|
|
$day=floor(($end_time-$start_time)/86400);
|
|
|
$price=$day*1;
|
|
|
$price=$day*$dayPrice;
|
|
|
//去掉整天的金额
|
|
|
$new_start_time=$start_time+$day*86400;//时间戳
|
|
|
$new_end_time= $end_time;//时间戳
|
...
|
...
|
@@ -214,6 +218,21 @@ class OrderController extends HomeBaseController{ |
|
|
return $price;
|
|
|
}
|
|
|
|
|
|
//获取整天的价格
|
|
|
public function getDayPrice(){
|
|
|
$cost=Db::name('cost')->where('id',1)->find();
|
|
|
$interval = Db::name('interval')->where('id',1)->find();
|
|
|
$stateTime=strtotime($interval['start_time']);
|
|
|
$endTime=strtotime($interval['end_time']);
|
|
|
//预设时间长度
|
|
|
$time=($stateTime-$endTime)/3600;
|
|
|
if ($endTime < $stateTime){
|
|
|
$price=($time * $cost['cost']) + ((24-$time) * $interval['price']);
|
|
|
}else{
|
|
|
$price=($time * $interval['price']) + ((24-$time) * $cost['cost']);
|
|
|
}
|
|
|
return $price;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
...
|
...
|
|