|
@@ -105,39 +105,39 @@ class OrderController extends HomeBaseController{ |
|
@@ -105,39 +105,39 @@ class OrderController extends HomeBaseController{ |
105
|
$cost=Db::name('cost')->where('id',1)->find();
|
105
|
$cost=Db::name('cost')->where('id',1)->find();
|
106
|
$interval = Db::name('interval')->where('id',1)->find();
|
106
|
$interval = Db::name('interval')->where('id',1)->find();
|
107
|
|
107
|
|
|
|
108
|
+ //用了多少天
|
|
|
109
|
+ $date=floor(($end_time-$start_time)/86400);
|
|
|
110
|
+ //去余数
|
|
|
111
|
+ $yu=($end_time-$start_time)%86400;
|
|
|
112
|
+
|
|
|
113
|
+ $new_start_time=$end_time-$yu;
|
|
|
114
|
+ $new_end_time= $end_time;
|
|
|
115
|
+
|
|
|
116
|
+
|
108
|
$stateTime=strtotime($interval['start_time']);
|
117
|
$stateTime=strtotime($interval['start_time']);
|
109
|
$endTime=strtotime($interval['end_time']);
|
118
|
$endTime=strtotime($interval['end_time']);
|
110
|
-
|
119
|
+ $price=1;
|
111
|
//判断是否跨天
|
120
|
//判断是否跨天
|
112
|
if ($endTime < $stateTime){
|
121
|
if ($endTime < $stateTime){
|
113
|
- $endTime+=86400;
|
|
|
114
|
- }
|
|
|
115
|
- dump(date('Y-m-d H:i:s',$stateTime));
|
|
|
116
|
- dump(date('Y-m-d H:i:s',$endTime));
|
|
|
117
|
-
|
|
|
118
|
- //不跨天处理方法
|
122
|
+ //跨天
|
119
|
|
123
|
|
120
|
|
124
|
|
121
|
|
125
|
|
122
|
- //判断是否在时间段内
|
|
|
123
|
- if ($end_time > $interval['start_time'] && $end_time < $interval['end_time']){
|
|
|
124
|
- //全部处于时间段中
|
|
|
125
|
- if ($start_time > $interval['start_time']){
|
|
|
126
|
- $time=ceil(($end_time-$start_time)/3600);
|
|
|
127
|
- $price=$time*$interval['price'];
|
|
|
128
|
- }else if ($start_time < $interval['start_time']){
|
|
|
129
|
-
|
|
|
130
|
- }
|
|
|
131
|
- }elseif ($start_time < $interval['end_time'] && $end_time > $interval['end_time']){
|
|
|
132
|
|
126
|
|
|
|
127
|
+ $endTime+=86400;
|
133
|
}else{
|
128
|
}else{
|
|
|
129
|
+ //不跨天
|
|
|
130
|
+
|
134
|
|
131
|
|
135
|
}
|
132
|
}
|
136
|
|
133
|
|
|
|
134
|
+
|
137
|
$price=1;
|
135
|
$price=1;
|
138
|
return $price;
|
136
|
return $price;
|
139
|
}
|
137
|
}
|
140
|
|
138
|
|
|
|
139
|
+
|
|
|
140
|
+
|
141
|
/**
|
141
|
/**
|
142
|
* @title 统一下单
|
142
|
* @title 统一下单
|
143
|
* @description 微信统一下单
|
143
|
* @description 微信统一下单
|