lip il y a 2 jours
Parent
commit
e229938da5
2 fichiers modifiés avec 15 ajouts et 3 suppressions
  1. 14 2
      app/Http/Controllers/api/Wallet.php
  2. 1 1
      app/Models/RechargeChannel.php

+ 14 - 2
app/Http/Controllers/api/Wallet.php

@@ -271,9 +271,16 @@ class Wallet extends BaseController
             if ($check === false) {
                 throw new Exception(lang("不支持此提现方式"));
             }
-            $serviceCharge = (new WithdrawService())->serviceCharge;
+            
             $amount = $params['amount'];
             $address = $params['address'];
+            
+            //校验提现金额的限制
+            if ($amount < $check->min || $amount > $check->max) {
+                throw new Exception(lang("提现金额超出限制"));
+            }
+
+            $serviceCharge = (new WithdrawService())->serviceCharge;
             $real = bcsub($amount, $serviceCharge, 10);
             $real = floatval($real);
 
@@ -348,11 +355,16 @@ class Wallet extends BaseController
             if ($check === false) {
                 throw new Exception(lang("不支持此提现方式"));
             }
+
+            $amount = $params['amount'];
+            //校验提现金额的限制
+            if ($amount < $check->min || $amount > $check->max) {
+                throw new Exception(lang("提现金额超出限制"));
+            }
             
             if ($params['channel'] == 'rgtx') {
                 
                 DB::beginTransaction();
-                $amount = $params['amount'];
                 try {
                     $wallet = WalletService::findOne(['member_id' => $member_id]);
                     if (!$wallet) throw new Exception('钱包不存在', HttpStatus::CUSTOM_ERROR);

+ 1 - 1
app/Models/RechargeChannel.php

@@ -100,7 +100,7 @@ class RechargeChannel extends BaseModel
         $recharge_channel_group_id = $recharge_channel_group_id > 0 ? $recharge_channel_group_id : 1;
         $withdraw_type = RechargeChannelGroup::where('id', $recharge_channel_group_id)->value('withdraw_type');
         if (in_array($type, $withdraw_type)) {
-            return true;
+            return self::where('data_type', 2)->where('type', $type)->first();
         } else {
             return false;
         }