shish 1 rok temu
rodzic
commit
4fa4d21373
1 zmienionych plików z 8 dodań i 0 usunięć
  1. 8 0
      app-hd/controllers/CustomRechargeController.php

+ 8 - 0
app-hd/controllers/CustomRechargeController.php

@@ -54,11 +54,19 @@ class CustomRechargeController extends BaseController
         $ghsShopId = $ghs->shopId ?? 0;
         $ghsMainId = $ghs->mainId ?? 0;
         $ghsBalance = $ghs->balance ?? 0;
+        $ghsDebtAmount = $ghs->debtAmount ?? 0;
         $ghsName = $ghs->name ?? '';
         $ghsShop = ShopClass::getById($ghsShopId, true);
         if (empty($ghsShop)) {
             util::fail('供货商信息不完全哦');
         }
+        $remainGhsDebt = bcsub($ghsDebtAmount, $ghsBalance, 2);
+        if ($remainGhsDebt < 0) {
+            util::fail('已结清,不需要充值');
+        }
+        if ($actPrice > $remainGhsDebt) {
+            util::fail('最多可以充' . $remainGhsDebt . '元');
+        }
 
         $customStaffId = 0;
         $customStaffName = '';