正在显示
1 个修改的文件
包含
14 行增加
和
2 行删除
@@ -97,6 +97,12 @@ class OrderController extends HomeBaseController{ | @@ -97,6 +97,12 @@ class OrderController extends HomeBaseController{ | ||
97 | } | 97 | } |
98 | Db::commit(); | 98 | Db::commit(); |
99 | //调起支付 | 99 | //调起支付 |
100 | + if ($price==0){ | ||
101 | + $data=[ | ||
102 | + 'state'=>2, | ||
103 | + ]; | ||
104 | + $this->apiResponse(200,'success',$data); | ||
105 | + } | ||
100 | $this->pay($order['order_no']); | 106 | $this->pay($order['order_no']); |
101 | 107 | ||
102 | } | 108 | } |
@@ -137,14 +143,18 @@ class OrderController extends HomeBaseController{ | @@ -137,14 +143,18 @@ class OrderController extends HomeBaseController{ | ||
137 | if (($new_start_time > $endTime && $new_start_time < $stateTime) && ($new_end_time < $new_start_time && $new_end_time < $stateTime)){ | 143 | if (($new_start_time > $endTime && $new_start_time < $stateTime) && ($new_end_time < $new_start_time && $new_end_time < $stateTime)){ |
138 | //存在首小时免费 | 144 | //存在首小时免费 |
139 | $price +=(ceil(($new_end_time-$new_start_time)/3600) * $cost['cost']); | 145 | $price +=(ceil(($new_end_time-$new_start_time)/3600) * $cost['cost']); |
146 | + if ($free==1){ | ||
140 | $price-=$cost['cost']; | 147 | $price-=$cost['cost']; |
141 | } | 148 | } |
149 | + } | ||
142 | //与预设时间段的头部重合 | 150 | //与预设时间段的头部重合 |
143 | if (($new_start_time > $endTime && $new_start_time < $stateTime) && ($new_end_time > $stateTime && $new_end_time < strtotime('24:00:00'))){ | 151 | if (($new_start_time > $endTime && $new_start_time < $stateTime) && ($new_end_time > $stateTime && $new_end_time < strtotime('24:00:00'))){ |
144 | //存在首小时免费 | 152 | //存在首小时免费 |
145 | $price += (ceil(($stateTime-$new_start_time)/3600) * $cost['cost'] + ceil(($new_end_time-$stateTime)/3600) * $interval['price']); | 153 | $price += (ceil(($stateTime-$new_start_time)/3600) * $cost['cost'] + ceil(($new_end_time-$stateTime)/3600) * $interval['price']); |
154 | + if ($free==1){ | ||
146 | $price-=$cost['cost']; | 155 | $price-=$cost['cost']; |
147 | } | 156 | } |
157 | + } | ||
148 | //在预设时间段右边并不与之重合 | 158 | //在预设时间段右边并不与之重合 |
149 | 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'))){ | 159 | 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'))){ |
150 | $price +=(ceil(($new_end_time-$new_start_time)/3600) * $interval['price']); | 160 | $price +=(ceil(($new_end_time-$new_start_time)/3600) * $interval['price']); |
@@ -165,18 +175,20 @@ class OrderController extends HomeBaseController{ | @@ -165,18 +175,20 @@ class OrderController extends HomeBaseController{ | ||
165 | //存在首小时免费 | 175 | //存在首小时免费 |
166 | $price+= ceil(($YesterdayStateTime-$new_start_time)/3600) * $cost['cost'] | 176 | $price+= ceil(($YesterdayStateTime-$new_start_time)/3600) * $cost['cost'] |
167 | +ceil(($new_end_time-$YesterdayStateTime)/3600) * $interval['price']; | 177 | +ceil(($new_end_time-$YesterdayStateTime)/3600) * $interval['price']; |
168 | - | 178 | + if ($free==1){ |
169 | $price-=$cost['cost']; | 179 | $price-=$cost['cost']; |
170 | } | 180 | } |
181 | + } | ||
171 | //昨天预设开始前使用,今天预设结束后停止 | 182 | //昨天预设开始前使用,今天预设结束后停止 |
172 | if(($new_start_time > $YesterdayEndTime && $new_start_time < $YesterdayStateTime) && ($new_end_time > $endTime && $new_end_time < $stateTime)){ | 183 | if(($new_start_time > $YesterdayEndTime && $new_start_time < $YesterdayStateTime) && ($new_end_time > $endTime && $new_end_time < $stateTime)){ |
173 | //存在首小时免费 | 184 | //存在首小时免费 |
174 | $price+= ceil(($YesterdayStateTime-$new_start_time)/3600) * $cost['cost'] | 185 | $price+= ceil(($YesterdayStateTime-$new_start_time)/3600) * $cost['cost'] |
175 | +ceil(($endTime-$YesterdayStateTime)/3600) * $interval['price'] | 186 | +ceil(($endTime-$YesterdayStateTime)/3600) * $interval['price'] |
176 | +ceil(($new_end_time-$endTime)/3600) * $cost['cost']; | 187 | +ceil(($new_end_time-$endTime)/3600) * $cost['cost']; |
177 | - | 188 | + if ($free==1){ |
178 | $price-=$cost['cost']; | 189 | $price-=$cost['cost']; |
179 | } | 190 | } |
191 | + } | ||
180 | //昨天预设开始后使用,今天预设结束前停止 | 192 | //昨天预设开始后使用,今天预设结束前停止 |
181 | if(($new_start_time > $YesterdayStateTime && $new_start_time < strtotime('00:00:00')) && ($new_end_time > strtotime('00:00:00') && $new_end_time < $endTime)){ | 193 | if(($new_start_time > $YesterdayStateTime && $new_start_time < strtotime('00:00:00')) && ($new_end_time > strtotime('00:00:00') && $new_end_time < $endTime)){ |
182 | $price+= ceil(($new_end_time-$new_start_time)/3600) * $interval['price']; | 194 | $price+= ceil(($new_end_time-$new_start_time)/3600) * $interval['price']; |
-
请 注册 或 登录 后发表评论