Selaa lähdekoodia

实收金额控制

shish 5 vuotta sitten
vanhempi
commit
429e249f04
1 muutettua tiedostoa jossa 13 lisäystä ja 3 poistoa
  1. 13 3
      biz-ghs/clear/classes/ClearClass.php

+ 13 - 3
biz-ghs/clear/classes/ClearClass.php

@@ -70,8 +70,19 @@ class ClearClass extends BaseClass
         $data['customAvatar'] = $customAvatar;
         $data['customMobile'] = $customMobile;
         $data['prePrice'] = $totalPrice;
-        $data['actPrice'] = $totalPrice;
-        $data['realPrice'] = $totalPrice;
+        $realPrice = $totalPrice;
+        if ($data['modifyPrice']) {
+            $modifyPrice = $data['modifyPrice'] ?? 0.00;
+            if (is_numeric($modifyPrice) == false) {
+                util::fail('实收金额错误');
+            }
+            if ($modifyPrice > $totalPrice) {
+                util::fail('实收金额不能大于订单金额');
+            }
+            $realPrice = $modifyPrice;
+        }
+        $data['actPrice'] = $realPrice;
+        $data['realPrice'] = $realPrice;
         $data['orderSn'] = $orderSn;
         $data['purchaseIds'] = implode(',', $arr);
         $deadTime = time() + 120;
@@ -83,7 +94,6 @@ class ClearClass extends BaseClass
         return $order;
     }
 
-
     //支付成功后的流程 shish 2021.4.28
     public static function complete($order, $payWay)
     {