Explorar el Código

优化运费计算

林琦海 hace 5 años
padre
commit
e654acf53e
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      common/components/freight.php

+ 2 - 2
common/components/freight.php

@@ -46,7 +46,7 @@ class freight
         //距离计算
         Yii::info("距离为:".$phpStatDistance);
         $phpStatDistance = $phpStatDistance -2;
-        if($phpStatDistance){
+        if($phpStatDistance > 0){
             if ($phpStatDistance <=10){
                 //每新增1km加2
                 $diffCost = $phpStatDistance*2;
@@ -66,7 +66,7 @@ class freight
         //重量计算
         Yii::info("重量为:".$weight);
         $weight = $weight -2;
-        if($weight){
+        if($weight > 0){
             if ($weight <=10){
                 //每增1 kg 加2
                 $diff = ceil(($weight - 2));