cqpCow 1 年之前
父节点
当前提交
d646abeb2b
共有 1 个文件被更改,包括 4 次插入1 次删除
  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,'合同生成失败!'];
 
         //反写数据
-        $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([
             'product_total' => $product_total,
             'rate' =>$rate