...
|
...
|
@@ -105,39 +105,39 @@ class OrderController extends HomeBaseController{ |
|
|
$cost=Db::name('cost')->where('id',1)->find();
|
|
|
$interval = Db::name('interval')->where('id',1)->find();
|
|
|
|
|
|
//用了多少天
|
|
|
$date=floor(($end_time-$start_time)/86400);
|
|
|
//去余数
|
|
|
$yu=($end_time-$start_time)%86400;
|
|
|
|
|
|
$new_start_time=$end_time-$yu;
|
|
|
$new_end_time= $end_time;
|
|
|
|
|
|
|
|
|
$stateTime=strtotime($interval['start_time']);
|
|
|
$endTime=strtotime($interval['end_time']);
|
|
|
|
|
|
$price=1;
|
|
|
//判断是否跨天
|
|
|
if ($endTime < $stateTime){
|
|
|
$endTime+=86400;
|
|
|
}
|
|
|
dump(date('Y-m-d H:i:s',$stateTime));
|
|
|
dump(date('Y-m-d H:i:s',$endTime));
|
|
|
|
|
|
//不跨天处理方法
|
|
|
//跨天
|
|
|
|
|
|
|
|
|
|
|
|
//判断是否在时间段内
|
|
|
if ($end_time > $interval['start_time'] && $end_time < $interval['end_time']){
|
|
|
//全部处于时间段中
|
|
|
if ($start_time > $interval['start_time']){
|
|
|
$time=ceil(($end_time-$start_time)/3600);
|
|
|
$price=$time*$interval['price'];
|
|
|
}else if ($start_time < $interval['start_time']){
|
|
|
|
|
|
}
|
|
|
}elseif ($start_time < $interval['end_time'] && $end_time > $interval['end_time']){
|
|
|
|
|
|
$endTime+=86400;
|
|
|
}else{
|
|
|
//不跨天
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
$price=1;
|
|
|
return $price;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* @title 统一下单
|
|
|
* @description 微信统一下单
|
...
|
...
|
|