Просмотр исходного кода

Wesmiler 人人车 初始化项目 0816

APPLE 3 лет назад
Родитель
Сommit
577ee6c681
1 измененных файлов с 9 добавлено и 4 удалено
  1. 9 4
      application/api/controller/v1/Taxi.php

+ 9 - 4
application/api/controller/v1/Taxi.php

@@ -334,7 +334,7 @@ class Taxi extends ApiController
         $valid = $this->validate($param, [
             'id' => 'require|number',
         ]);
-        
+
         // 错误
         if (true !== $valid) {
             return $this->ApiJson(-1, $valid);
@@ -357,9 +357,14 @@ class Taxi extends ApiController
                 // 如果平台已指派司机,则扣除部分金额
                 $cost_price = 0;
                 $taxiUid = isset($row['taxi_uid'])? $row['taxi_uid'] : 0;
-                if ($row['status'] == 3) {
-                    $total_price = $total_price * (1 - $config['store']['store_cancel_order']/100);
-                    $cost_price = $total_price * $config['store']['store_cancel_order']/100;
+                $createTime = isset($row['created_at'])? $row['created_at'] : 0;
+                $cancelTime = isset($config['store']['store_cancel_order'])? $config['store']['store_cancel_order'] : 0;
+                if ($row['status'] == 3 ) {
+                    // 免费取消时间内不扣除
+                    if($cancelTime<=0 || time() < ($createTime - $cancelTime)){
+                        $total_price = $total_price * (1 - $config['store']['store_cancel_order']/100);
+                        $cost_price = $total_price * $config['store']['store_cancel_order']/100;
+                    }
                 }
                 if ($row->paylog['pay_type'] == 'balance') {
                     model('common/Users')->changeBalance(