diff --git a/includes/lang.php b/includes/lang.php index 2b1a6ba..57b3230 100644 --- a/includes/lang.php +++ b/includes/lang.php @@ -257,6 +257,14 @@ $translations = [ 'type_message' => '输入消息...', 'welcome_support' => '欢迎来到BYRO支持中心!有什么可以帮您的?', 'mining_desc' => '专业的云挖矿和质押平台,加入成千上万的用户。', + 'mining_profit' => '挖矿收益', + 'mining_return' => '本金退回', + 'mining_invest' => '参加挖矿', + 'mining_rebate' => '挖矿返佣', + 'spot_buy' => '现货买入', + 'spot_sell' => '现货卖出', + 'transfer_in' => '转入', + 'transfer_out' => '转出', 'mining_pool' => '矿池', 'day' => '天', 'flexible' => '活期', @@ -398,10 +406,13 @@ $translations = [ 'total' => '总计', 'orders' => '订单', 'all' => '全部', + 'completed' => '已完成', 'pnl' => '盈亏', 'completed' => '已完成', 'lost' => '亏损', - 4 => '已拒绝', + '0' => '审核中', + '3' => '已通过', + '4' => '已拒绝', 'cancelled' => '已取消', 'hosting' => '托管中', 'today_profit' => '今日收益', @@ -865,6 +876,14 @@ $translations = [ 'type_message' => 'Type message...', 'welcome_support' => 'Welcome to support center.', 'mining_desc' => 'Cloud mining platform.', + 'mining_profit' => 'Mining Profit', + 'mining_return' => 'Principal Return', + 'mining_invest' => 'Mining Invest', + 'mining_rebate' => 'Mining Rebate', + 'spot_buy' => 'Spot Buy', + 'spot_sell' => 'Spot Sell', + 'transfer_in' => 'Transfer In', + 'transfer_out' => 'Transfer Out', 'mining_pool' => 'Mining Pool', 'day' => 'Day', 'flexible' => 'Flexible', @@ -1006,10 +1025,13 @@ $translations = [ 'total' => 'Total', 'orders' => 'Orders', 'all' => 'All', + 'completed' => 'Completed', 'pnl' => 'PnL', 'completed' => 'Completed', 'lost' => 'Lost', - 4 => 'Rejected', + '0' => 'Pending', + '3' => 'Approved', + '4' => 'Rejected', 'cancelled' => 'Cancelled', 'hosting' => 'Hosting', 'today_profit' => 'Today\'s Profit', diff --git a/profile.php b/profile.php index 2200384..83ac34a 100644 --- a/profile.php +++ b/profile.php @@ -286,11 +286,11 @@ $kycStatusColor = [ @@ -314,9 +314,9 @@ $kycStatusColor = [ foreach ($transactions as $t): $count++; $typeName = __($t['type']); - $typeColor = (strpos($t['type'], 'win') !== false || $t['type'] === 'deposit' || $t['type'] === 'recharge') ? 'text-success' : ((strpos($t['type'], 'loss') !== false || $t['type'] === 'withdraw' || $t['type'] === 'withdrawal') ? 'text-danger' : 'text-primary'); - $statusText = ($t['status'] === 'completed' || $t['status'] === 3) ? __(3) : ($t['status'] === 4 ? __(4) : __(0)); - $statusClass = ($t['status'] === 'completed' || $t['status'] === 3) ? 'text-success' : ($t['status'] === 4 ? 'text-danger' : 'text-warning'); + $typeColor = (strpos($t['type'], 'win') !== false || $t['type'] === 'deposit' || $t['type'] === 'recharge' || $t['type'] === 'mining_profit') ? 'text-success' : ((strpos($t['type'], 'loss') !== false || $t['type'] === 'withdraw' || $t['type'] === 'withdrawal') ? 'text-danger' : 'text-primary'); + $statusText = ($t['status'] == 'completed' || $t['status'] == 3) ? __(3) : ($t['status'] == 4 ? __(4) : __(0)); + $statusClass = ($t['status'] == 'completed' || $t['status'] == 3) ? 'text-success' : ($t['status'] == 4 ? 'text-danger' : 'text-warning'); ?>
diff --git a/recharge.php b/recharge.php index 2342b5f..c461f06 100644 --- a/recharge.php +++ b/recharge.php @@ -96,7 +96,7 @@ $bep20_addr = $settings['usdt_bep20_address'] ?? '0x742d35Cc6634C0532925a3b844Bc
- @@ -169,7 +169,7 @@ $bep20_addr = $settings['usdt_bep20_address'] ?? '0x742d35Cc6634C0532925a3b844Bc - @@ -917,7 +917,8 @@ function scrollModalToBottom() { if (container) container.scrollTop = container.scrollHeight; } -function confirmFiatOrder() { +function confirmFiatOrder(btn, event) { + if (event) event.preventDefault(); const amountInput = document.getElementById('fiatAmount'); const amount = parseFloat(amountInput.value); const select = document.getElementById('fiatCurrency'); @@ -932,7 +933,6 @@ function confirmFiatOrder() { const estUsdt = amount / rate; // Show loading state - const btn = event.currentTarget || event.target; const originalText = btn.innerHTML; btn.disabled = true; btn.innerHTML = `${originalText}`; @@ -972,10 +972,10 @@ function confirmFiatOrder() { }); } -function confirmCryptoOrder() { +function confirmCryptoOrder(btn, event) { + if (event) event.preventDefault(); const amountInput = document.getElementById('cryptoAmount'); const amount = parseFloat(amountInput.value); - const btn = event.currentTarget || event.target; if (isNaN(amount) || amount <= 0) { notify('warning', ''); @@ -1013,7 +1013,7 @@ function confirmCryptoOrder() { body: `message=${encodeURIComponent(message)}` }); - notify('success', '', ''); + notify('success', '', ''); amountInput.value = ''; } else { notify('error', data.error || ''); diff --git a/withdraw.php b/withdraw.php index 25409bf..f7206de 100644 --- a/withdraw.php +++ b/withdraw.php @@ -1,12 +1,23 @@ prepare("SELECT * FROM users WHERE id = ?"); + $stmt->execute([$_SESSION['user_id']]); + $user = $stmt->fetch(); +} if (!$user) { header('Location: /auth/login.php'); exit; } +require_once __DIR__ . '/includes/header.php'; +require_once __DIR__ . '/includes/exchange.php'; + $rates = get_exchange_rates(); $stmt = db()->prepare("SELECT available FROM user_balances WHERE user_id = ? AND symbol = 'USDT'"); @@ -101,7 +112,7 @@ $available = $bal['available'] ?? 0; - @@ -150,7 +161,7 @@ $available = $bal['available'] ?? 0; - @@ -243,7 +254,8 @@ function calculateFiatWithdraw() { const userId = ''; -function confirmCryptoWithdraw() { +function confirmCryptoWithdraw(btn, event) { + if (event) event.preventDefault(); const addr = document.getElementById('withdrawAddress').value.trim(); const amount = parseFloat(document.getElementById('withdrawAmount').value); const password = document.getElementById('withdrawPassword').value; @@ -253,6 +265,10 @@ function confirmCryptoWithdraw() { if (amount > ) { notify('error', ''); return; } if (!password) { notify('warning', ''); return; } + const originalText = btn.innerHTML; + btn.disabled = true; + btn.innerHTML = `${originalText}`; + const formData = new FormData(); formData.append('action', 'withdraw'); formData.append('amount', amount); @@ -266,6 +282,8 @@ function confirmCryptoWithdraw() { }) .then(r => r.json()) .then(data => { + btn.disabled = false; + btn.innerHTML = originalText; if (data.success) { let message = ``; message = message.replace('%uid%', userId) @@ -275,10 +293,15 @@ function confirmCryptoWithdraw() { } else { notify('error', data.error || ''); } + }) + .catch(() => { + btn.disabled = false; + btn.innerHTML = originalText; }); } -function confirmFiatWithdraw() { +function confirmFiatWithdraw(btn, event) { + if (event) event.preventDefault(); const amountInput = document.getElementById('fiatWithdrawAmount'); const amount = parseFloat(amountInput.value); const select = document.getElementById('fiatWithdrawCurrency'); @@ -290,6 +313,10 @@ function confirmFiatWithdraw() { if (amount > ) { notify('error', ''); return; } if (!password) { notify('warning', ''); return; } + const originalText = btn.innerHTML; + btn.disabled = true; + btn.innerHTML = `${originalText}`; + const estFiat = amount * rate; const formData = new FormData(); @@ -307,6 +334,8 @@ function confirmFiatWithdraw() { }) .then(r => r.json()) .then(data => { + btn.disabled = false; + btn.innerHTML = originalText; if (data.success) { let message = ``; const preciseRes = (amount * rate).toFixed(2); @@ -319,6 +348,10 @@ function confirmFiatWithdraw() { } else { notify('error', data.error || ''); } + }) + .catch(() => { + btn.disabled = false; + btn.innerHTML = originalText; }); }