Autosave: 20260221-114057

This commit is contained in:
Flatlogic Bot 2026-02-21 11:40:57 +00:00
parent f954adc14c
commit 8579468ad0
4 changed files with 77 additions and 22 deletions

View File

@ -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',

View File

@ -286,11 +286,11 @@ $kycStatusColor = [
<?php foreach ($transactions as $t):
$typeColor = 'text-primary';
$typeName = __($t['type']);
if (strpos($t['type'], 'win') !== false || $t['type'] === 'deposit' || $t['type'] === 'binary_win' || $t['type'] === 'recharge') $typeColor = 'text-success';
if (strpos($t['type'], 'win') !== false || $t['type'] === 'deposit' || $t['type'] === 'binary_win' || $t['type'] === 'recharge' || $t['type'] === 'mining_profit') $typeColor = 'text-success';
elseif (strpos($t['type'], 'loss') !== false || $t['type'] === 'withdraw' || $t['type'] === 'withdrawal' || $t['type'] === 'binary_loss') $typeColor = 'text-danger';
$prefix = ($t['type'] === 'binary_win' || $t['type'] === 'deposit' || $t['type'] === 'recharge' || $t['type'] === 'contract_settle') ? '+' : (($t['type'] === 'binary_loss' || $t['type'] === 'withdraw' || $t['type'] === 'withdrawal' || $t['type'] === 'contract_margin') ? '-' : '');
$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');
$prefix = (strpos($t['type'], 'win') !== false || $t['type'] === 'deposit' || $t['type'] === 'recharge' || $t['type'] === 'contract_settle' || $t['type'] === 'mining_profit') ? '+' : ((strpos($t['type'], 'loss') !== false || $t['type'] === 'withdraw' || $t['type'] === 'withdrawal' || $t['type'] === 'contract_margin') ? '-' : '');
$statusText = ($t['status'] == 'completed' || $t['status'] == 3) ? __(3) : ($t['status'] == 4 ? __(4) : __(0));
$statusClass = ($t['status'] == 'completed' || $t['status'] == 2 || $t['status'] == 3) ? 'text-success' : ($t['status'] == 4 ? 'text-danger' : 'text-warning');
?>
<tr class="border-secondary">
<td class="ps-4 py-3" style="width: 25%;"><span class="<?= $typeColor ?> fw-bold"><?= $typeName ?></span></td>
@ -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');
?>
<div class="p-3 mb-2 rounded-4 bg-black bg-opacity-20 border border-secondary border-opacity-50">
<div class="d-flex justify-content-between align-items-start mb-2">

View File

@ -96,7 +96,7 @@ $bep20_addr = $settings['usdt_bep20_address'] ?? '0x742d35Cc6634C0532925a3b844Bc
</div>
</div>
<button type="button" class="btn btn-primary w-100 py-3 rounded-pill fw-bold shadow-lg" onclick="confirmFiatOrder()">
<button type="button" class="btn btn-primary w-100 py-3 rounded-pill fw-bold shadow-lg" onclick="confirmFiatOrder(this, event)">
<?= __('confirm_order') ?>
</button>
</form>
@ -169,7 +169,7 @@ $bep20_addr = $settings['usdt_bep20_address'] ?? '0x742d35Cc6634C0532925a3b844Bc
</div>
</div>
<button type="button" class="btn btn-primary w-100 py-3 rounded-pill fw-bold shadow-lg" onclick="confirmCryptoOrder()">
<button type="button" class="btn btn-primary w-100 py-3 rounded-pill fw-bold shadow-lg" onclick="confirmCryptoOrder(this, event)">
<?= __('i_have_paid') ?>
</button>
@ -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 = `<span class="spinner-border spinner-border-sm me-2"></span>${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', '<?= __("enter_amount") ?>');
@ -1013,7 +1013,7 @@ function confirmCryptoOrder() {
body: `message=${encodeURIComponent(message)}`
});
notify('success', '<?= __("recharge_request_submitted") ?>', '<?= __("recharge_request_submitted_text") ?>');
notify('success', '<?= __("recharge_success_title") ?>', '<?= __("recharge_success_text") ?>');
amountInput.value = '';
} else {
notify('error', data.error || '<?= __("request_failed") ?>');

View File

@ -1,12 +1,23 @@
<?php
require_once __DIR__ . '/includes/header.php';
require_once __DIR__ . '/includes/exchange.php';
require_once __DIR__ . '/db/config.php';
require_once __DIR__ . '/includes/lang.php';
if (session_status() === PHP_SESSION_NONE) session_start();
$user = null;
if (isset($_SESSION['user_id'])) {
$stmt = db()->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;
</div>
</div>
<button type="button" class="btn btn-warning w-100 py-3 rounded-pill fw-bold shadow-lg text-dark" onclick="confirmCryptoWithdraw()">
<button type="button" class="btn btn-warning w-100 py-3 rounded-pill fw-bold shadow-lg text-dark" onclick="confirmCryptoWithdraw(this, event)">
<?= __('confirm') ?>
</button>
</form>
@ -150,7 +161,7 @@ $available = $bal['available'] ?? 0;
</div>
</div>
<button type="button" class="btn btn-warning w-100 py-3 rounded-pill fw-bold shadow-lg text-dark" onclick="confirmFiatWithdraw()">
<button type="button" class="btn btn-warning w-100 py-3 rounded-pill fw-bold shadow-lg text-dark" onclick="confirmFiatWithdraw(this, event)">
<?= __('confirm') ?>
</button>
</form>
@ -243,7 +254,8 @@ function calculateFiatWithdraw() {
const userId = '<?= $user['uid'] ?? $user['id'] ?>';
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 > <?= $available ?>) { notify('error', '<?= __("insufficient_balance") ?>'); return; }
if (!password) { notify('warning', '<?= __("enter_password") ?>'); return; }
const originalText = btn.innerHTML;
btn.disabled = true;
btn.innerHTML = `<span class="spinner-border spinner-border-sm me-2"></span>${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 = `<?= __('withdraw_msg_crypto') ?>`;
message = message.replace('%uid%', userId)
@ -275,10 +293,15 @@ function confirmCryptoWithdraw() {
} else {
notify('error', data.error || '<?= __('request_failed') ?>');
}
})
.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 > <?= $available ?>) { notify('error', '<?= __("insufficient_balance") ?>'); return; }
if (!password) { notify('warning', '<?= __("enter_password") ?>'); return; }
const originalText = btn.innerHTML;
btn.disabled = true;
btn.innerHTML = `<span class="spinner-border spinner-border-sm me-2"></span>${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 = `<?= __('withdraw_msg_fiat') ?>`;
const preciseRes = (amount * rate).toFixed(2);
@ -319,6 +348,10 @@ function confirmFiatWithdraw() {
} else {
notify('error', data.error || '<?= __('request_failed') ?>');
}
})
.catch(() => {
btn.disabled = false;
btn.innerHTML = originalText;
});
}