|
|
@@ -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)) {
|