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

interface

@@ -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,13 +143,17 @@ class OrderController extends HomeBaseController{ @@ -137,13 +143,17 @@ 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']);
140 - $price-=$cost['cost']; 146 + if ($free==1){
  147 + $price-=$cost['cost'];
  148 + }
141 } 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']);
146 - $price-=$cost['cost']; 154 + if ($free==1){
  155 + $price-=$cost['cost'];
  156 + }
147 } 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'))){
@@ -165,8 +175,9 @@ class OrderController extends HomeBaseController{ @@ -165,8 +175,9 @@ 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 -  
169 - $price-=$cost['cost']; 178 + if ($free==1){
  179 + $price-=$cost['cost'];
  180 + }
170 } 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)){
@@ -174,8 +185,9 @@ class OrderController extends HomeBaseController{ @@ -174,8 +185,9 @@ class OrderController extends HomeBaseController{
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 -  
178 - $price-=$cost['cost']; 188 + if ($free==1){
  189 + $price-=$cost['cost'];
  190 + }
179 } 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)){