cqpCow 1 year ago
parent
commit
d646abeb2b
1 changed files with 4 additions and 1 deletions
  1. 4 1
      app/Service/CheckService.php

+ 4 - 1
app/Service/CheckService.php

@@ -429,7 +429,10 @@ class CheckService extends Service
         if(! $bool) return [false,'合同生成失败!'];
         if(! $bool) return [false,'合同生成失败!'];
 
 
         //反写数据
         //反写数据
-        $rate = ($product_total + $order['other_fee'] - $order['discount_fee']) / ($product_total + $order['other_fee'] ?? 1);
+
+        $tmp = $product_total + $order['other_fee'];
+        $tmp = $tmp > 0 ? $tmp : 1;
+        $rate = ($product_total + $order['other_fee'] - $order['discount_fee']) / $tmp;
         SalesOrder::where('id',$sales_order_id)->update([
         SalesOrder::where('id',$sales_order_id)->update([
             'product_total' => $product_total,
             'product_total' => $product_total,
             'rate' =>$rate
             'rate' =>$rate