shish 2 ani în urmă
părinte
comite
80ac85025a
1 a modificat fișierele cu 7 adăugiri și 3 ștergeri
  1. 7 3
      app-ghs/controllers/TestController.php

+ 7 - 3
app-ghs/controllers/TestController.php

@@ -78,6 +78,7 @@ class TestController extends BaseController
                 }
                 $totalAmount = bcadd($totalAmount, $actPrice, 2);
                 $orderItemList = OrderItemClass::getAllByCondition(['orderSn' => $orderSn], null, '*', null, true);
+                $currentAmount = 0;
                 if (!empty($orderItemList)) {
                     foreach ($orderItemList as $orderItem) {
                         $refundNum = $orderItem->refundNum ?? 0;
@@ -87,9 +88,7 @@ class TestController extends BaseController
                         $xhUnitPrice = $orderItem->xhUnitPrice ?? 0;
 
                         $now = bcmul($num, $xhUnitPrice);
-                        if(floatval($now)!=floatval($actPrice) && $discountAmount<=0 && $labourCost<=0 && $tkPrice<=0){
-                            echo $orderSn;die;
-                        }
+                        $currentAmount = bcadd($currentAmount, $now, 2);
 
                         $remainNum = bcsub($num, $refundNum);
                         $classId = $orderItem->classId ?? 0;
@@ -106,6 +105,11 @@ class TestController extends BaseController
                             $arr[$classId]['income'] = $amount;
                         }
                     }
+                    if (floatval($currentAmount) != floatval($actPrice) && $discountAmount <= 0 && $labourCost <= 0 && $tkPrice <= 0) {
+                        echo $orderSn;
+                        die;
+                    }
+
                     if ($tkPrice > 0) {
                         $refundList = RefundOrderClass::getAllByCondition(['relateOrderSn' => $orderSn], null, '*', null, true);
                         if (!empty($refundList)) {