afa 8 сар өмнө
parent
commit
095706fd7c

+ 9 - 8
application/api/controller/Offline.php

@@ -29,11 +29,12 @@ class Offline extends Api
 {
 
     public function withdrawFee()
-    {
+    { 
         $resp   = [
             'usdt'                => '0', // 系统余额(U)
             'withdraw_min_amount' => getConfig('withdraw_min_amount'), // 最低提现U数量
-            'withdraw_fee_rate'   => getConfig('withdrawal_fee')       // 手续费比例
+            'withdrawal_next_fee' => getConfig('withdrawal_next_fee'), // 600以下手续费
+            'withdrawal_up_fee'   => getConfig('withdrawal_up_fee')    // 600以上手续费比例
         ];
         $this->success('', $resp);
     }
@@ -50,26 +51,26 @@ class Offline extends Api
         if(empty($sign)  || empty($address)){
             $this->error(__('Invalid parameters'));
         }
-        $real   = bcdiv($amount, getConfig('convert_rate'), 6); // 折合转换 U = 1
         $min    = getConfig('withdraw_min_amount');
-        $rate   = getConfig('withdrawal_fee');
         if ($amount <= 0) {
             $this->error(__('The withdrawal amount must be greater than 0'));
         } else if ($amount < $min) {
             $this->error(__('The withdrawal amount cannot be less than') . $min);
         }
         // 扣除手续费后
-        if ($rate > 0 && $rate < 1) { // 比例范围只在0-1之间
-            $real = bcmul($real, bcsub(1, $rate, 6), 6);
+        if($amount < config('withdraw_in_amount')){
+            $res_amount= bcsub($amount, getConfig('withdrawal_next_fee'),6); //扣除茶宝之后金额
+            $real      = bcdiv($res_amount, getConfig('convert_rate'), 6); // 折合转换 U = 1
+        } else{
+            $real   = bcdiv($amount, getConfig('convert_rate'), 6); // 折合转换 U = 1
+            $real   = bcmul($real, bcsub(1, getConfig('withdrawal_up_fee'), 6), 6); // 扣除手续费后
         }
         $uid = $this->auth->getTokenUserID();
-
         // 用户信息
         $user = (new UserModel())->getById($uid);
         if($user['is_withdraw']){
             $this->error(__('Withdrawal failed, please contact customer service.'));
         }
-
         // 验签
         $signMsg = "withdraw"; // 与前端约定的固定值
         if (!checkSign($signMsg, $sign, $address)) {

+ 2 - 1
application/config.php

@@ -318,5 +318,6 @@ return [
     'service_ratio'   => 0.05, //服务津贴
     'together_ratio'  => 0.05, //共创津贴
     'google_secret'   => 'EHAO77VUMH5XHFR6', //谷歌验证私钥
-    'min_rwa_price'   => 499, //Rwa最低价格统计数量
+    'min_rwa_price'   => 499, //Rwa最低价格统计数量,
+    'withdraw_in_amount' => 600, //提现金额手续费
 ];