diff --git a/admin/backend_settings.php b/admin/backend_settings.php index b1d4f25..bae5fc6 100644 --- a/admin/backend_settings.php +++ b/admin/backend_settings.php @@ -137,7 +137,7 @@ ob_start();
-
+
使用说明
  • 网站名称:影响浏览器标签页标题。
  • diff --git a/admin/binary.php b/admin/binary.php index 4e0fac0..90720af 100644 --- a/admin/binary.php +++ b/admin/binary.php @@ -9,6 +9,28 @@ if (!hasPermission('view_orders')) { exit; } +// Auto-settle expired orders +$db->beginTransaction(); +try { + $stmt = $db->prepare("SELECT o.*, u.win_loss_control as user_control FROM binary_orders o JOIN users u ON o.user_id = u.id WHERE o.status = 'pending' AND DATE_ADD(o.created_at, INTERVAL o.duration SECOND) <= NOW()"); + $stmt->execute(); + $expired = $stmt->fetchAll(); + foreach ($expired as $o) { + $result = ($o['control_status'] == 1 || $o['user_control'] == 1) ? 'won' : (($o['control_status'] == 2 || $o['user_control'] == 2) ? 'lost' : ((rand(0, 100) > 50) ? 'won' : 'lost')); + $db->prepare("UPDATE binary_orders SET status = ?, settled_at = NOW() WHERE id = ?")->execute([$result, $o['id']]); + if ($result === 'won') { + $win_amount = $o['amount'] + ($o['amount'] * $o['profit_rate'] / 100); + $db->prepare("UPDATE user_balances SET available = available + ? WHERE user_id = ? AND symbol = 'USDT'")->execute([$win_amount, $o['user_id']]); + $db->prepare("INSERT INTO transactions (user_id, type, amount, symbol, status) VALUES (?, 'binary_win', ?, 'USDT', 'completed')")->execute([$o['user_id'], $win_amount]); + } else { + $db->prepare("INSERT INTO transactions (user_id, type, amount, symbol, status) VALUES (?, 'binary_loss', ?, 'USDT', 'completed')")->execute([$o['user_id'], $o['amount']]); + } + } + $db->commit(); +} catch (Exception $e) { + $db->rollBack(); +} + // Handle Control Update if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action'])) { if ($_POST['action'] === 'set_control') { @@ -78,8 +100,11 @@ $orders = $stmt->fetchAll();
    - - + + + diff --git a/admin/finance.php b/admin/finance.php index 15d1a6f..209549f 100644 --- a/admin/finance.php +++ b/admin/finance.php @@ -151,6 +151,11 @@ $requests = $stmt->fetchAll(); + +
    + ≈ +
    + diff --git a/admin/layout.php b/admin/layout.php index f685832..3dbd485 100644 --- a/admin/layout.php +++ b/admin/layout.php @@ -160,17 +160,29 @@ function renderAdminPage($content, $title = '后台管理') { - 充提管理 + + 充提管理 + 0 + - 秒合约管理 + + 财务明细 + + + 秒合约管理 + 0 + 永续合约 币币交易 - 实名认证 + + 实名认证 + 0 + @@ -191,6 +203,12 @@ function renderAdminPage($content, $title = '后台管理') {
欢迎您,
+
+ + + 0 + +
返回首页 登出
@@ -200,6 +218,99 @@ function renderAdminPage($content, $title = '后台管理') {
+ prepare($sql); +$stmt->execute($params); +$transactions = $stmt->fetchAll(); + +$types = [ + 'recharge' => '充值', + 'withdrawal' => '提现', + 'binary_win' => '秒合约盈利', + 'binary_loss' => '秒合约亏损', + 'contract_profit' => '合约盈利', + 'contract_loss' => '合约亏损', + 'spot_buy' => '币币买入', + 'spot_sell' => '币币卖出' +]; +?> + +
+
+ 返回 +

账变记录

+
+
+ +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ID用户信息类型币种金额时间状态
+
+ +
+ + + + + + + + + + + +
暂无账变记录
+
+ + diff --git a/api/admin_notifications.php b/api/admin_notifications.php new file mode 100644 index 0000000..d15bcd0 --- /dev/null +++ b/api/admin_notifications.php @@ -0,0 +1,57 @@ + false, 'error' => 'Unauthorized']); + exit; +} + +$db = db(); +$admin_id = $_SESSION['admin_id']; + +// Get admin info for agent check +$stmt = $db->prepare("SELECT is_agent FROM admins WHERE id = ?"); +$stmt->execute([$admin_id]); +$admin = $stmt->fetch(); + +$pending_recharge = 0; +$pending_withdrawal = 0; +$pending_kyc = 0; +$active_binary = 0; + +if ($admin['is_agent']) { + $pending_recharge = $db->prepare("SELECT COUNT(*) FROM finance_requests r JOIN users u ON r.user_id = u.id WHERE r.type = 'recharge' AND r.status = 'pending' AND u.agent_id = ?"); + $pending_recharge->execute([$admin_id]); + $pending_recharge = $pending_recharge->fetchColumn(); + + $pending_withdrawal = $db->prepare("SELECT COUNT(*) FROM finance_requests r JOIN users u ON r.user_id = u.id WHERE r.type = 'withdrawal' AND r.status = 'pending' AND u.agent_id = ?"); + $pending_withdrawal->execute([$admin_id]); + $pending_withdrawal = $pending_withdrawal->fetchColumn(); + + $pending_kyc = $db->prepare("SELECT COUNT(*) FROM users WHERE kyc_status = 'pending' AND agent_id = ?"); + $pending_kyc->execute([$admin_id]); + $pending_kyc = $pending_kyc->fetchColumn(); + + $active_binary = $db->prepare("SELECT COUNT(*) FROM binary_orders o JOIN users u ON o.user_id = u.id WHERE o.status = 'pending' AND u.agent_id = ?"); + $active_binary->execute([$admin_id]); + $active_binary = $active_binary->fetchColumn(); +} else { + $pending_recharge = $db->query("SELECT COUNT(*) FROM finance_requests WHERE type = 'recharge' AND status = 'pending'")->fetchColumn(); + $pending_withdrawal = $db->query("SELECT COUNT(*) FROM finance_requests WHERE type = 'withdrawal' AND status = 'pending'")->fetchColumn(); + $pending_kyc = $db->query("SELECT COUNT(*) FROM users WHERE kyc_status = 'pending'")->fetchColumn(); + $active_binary = $db->query("SELECT COUNT(*) FROM binary_orders WHERE status = 'pending'")->fetchColumn(); +} + +echo json_encode([ + 'success' => true, + 'counts' => [ + 'recharge' => (int)$pending_recharge, + 'withdrawal' => (int)$pending_withdrawal, + 'kyc' => (int)$pending_kyc, + 'binary' => (int)$active_binary, + 'total' => (int)$pending_recharge + (int)$pending_withdrawal + (int)$pending_kyc + (int)$active_binary + ] +]); diff --git a/api/binary.php b/api/binary.php index ae34189..987a1cb 100644 --- a/api/binary.php +++ b/api/binary.php @@ -103,6 +103,11 @@ if ($action === 'settle_order') { } else { $result = ($close_price < $order['entry_price']) ? 'won' : 'lost'; } + + // Handle Tie (usually loss in binary options, or can be refund) + if ($close_price == $order['entry_price']) { + $result = 'lost'; + } } // Force "Control Loss means deducting the order amount" diff --git a/api/finance.php b/api/finance.php index c1ce17c..157afe9 100644 --- a/api/finance.php +++ b/api/finance.php @@ -30,6 +30,38 @@ if ($action === 'get_orders') { $settlement = []; if ($tab === 'binary') { + // Auto-settle expired orders + $stmt = $db->prepare("SELECT o.*, u.win_loss_control as user_control FROM binary_orders o JOIN users u ON o.user_id = u.id WHERE o.user_id = ? AND o.status = 'pending' AND DATE_ADD(o.created_at, INTERVAL o.duration SECOND) <= NOW()"); + $stmt->execute([$user_id]); + $expired = $stmt->fetchAll(); + + foreach ($expired as $o) { + $order_id = $o['id']; + $result = ''; + // Simple settlement if we missed the real-time event + if ($o['control_status'] == 1 || $o['user_control'] == 1) $result = 'won'; + elseif ($o['control_status'] == 2 || $o['user_control'] == 2) $result = 'lost'; + else { + // Natural result fallback (randomized or tie-breaker if price history unavailable) + $result = (rand(0, 100) > 50) ? 'won' : 'lost'; + } + + $db->beginTransaction(); + try { + $db->prepare("UPDATE binary_orders SET status = ?, settled_at = NOW() WHERE id = ?")->execute([$result, $order_id]); + if ($result === 'won') { + $win_amount = $o['amount'] + ($o['amount'] * $o['profit_rate'] / 100); + $db->prepare("UPDATE user_balances SET available = available + ? WHERE user_id = ? AND symbol = 'USDT'")->execute([$win_amount, $user_id]); + $db->prepare("INSERT INTO transactions (user_id, type, amount, symbol, status) VALUES (?, 'binary_win', ?, 'USDT', 'completed')")->execute([$user_id, $win_amount]); + } else { + $db->prepare("INSERT INTO transactions (user_id, type, amount, symbol, status) VALUES (?, 'binary_loss', ?, 'USDT', 'completed')")->execute([$user_id, $o['amount']]); + } + $db->commit(); + } catch (Exception $e) { + $db->rollBack(); + } + } + $stmt = $db->prepare("SELECT * FROM binary_orders WHERE user_id = ? ORDER BY created_at DESC"); $stmt->execute([$user_id]); $orders = $stmt->fetchAll(); @@ -45,13 +77,12 @@ if ($action === 'get_orders') { 'amount' => $o['amount'], 'pnl' => $o['status'] === 'won' ? ($o['amount'] * $o['profit_rate'] / 100) : ($o['status'] === 'lost' ? -$o['amount'] : 0), 'total' => $o['status'] === 'won' ? ($o['amount'] + ($o['amount'] * $o['profit_rate'] / 100)) : ($o['status'] === 'lost' ? '0.00' : '---'), - 'status' => ucfirst($o['status']), + 'status' => ($o['status'] === 'won' ? 'Profit' : ($o['status'] === 'lost' ? 'Loss' : 'Executing')), 'profitRate' => $o['profit_rate'] ]; if ($o['status'] === 'pending') { $row['status'] = 'Executing'; $row['totalSeconds'] = $o['duration']; - // Calculate seconds left $elapsed = time() - strtotime($o['created_at']); $row['secondsLeft'] = max(0, $o['duration'] - $elapsed); if ($row['secondsLeft'] > 0) $open[] = $row; @@ -112,14 +143,16 @@ if ($action === 'recharge') { $symbol = $_POST['symbol'] ?? 'USDT'; $method = $_POST['method'] ?? 'Crypto'; $tx_hash = $_POST['tx_hash'] ?? ''; + $fiat_amount = isset($_POST['fiat_amount']) ? (float)$_POST['fiat_amount'] : null; + $fiat_currency = $_POST['fiat_currency'] ?? null; if ($amount <= 0) { echo json_encode(['success' => false, 'error' => 'Invalid amount']); exit; } - $stmt = $db->prepare("INSERT INTO finance_requests (user_id, type, amount, symbol, payment_method, tx_hash, status) VALUES (?, 'recharge', ?, ?, ?, ?, 'pending')"); - $stmt->execute([$user_id, $amount, $symbol, $method, $tx_hash]); + $stmt = $db->prepare("INSERT INTO finance_requests (user_id, type, amount, symbol, payment_method, tx_hash, fiat_amount, fiat_currency, status) VALUES (?, 'recharge', ?, ?, ?, ?, ?, ?, 'pending')"); + $stmt->execute([$user_id, $amount, $symbol, $method, $tx_hash, $fiat_amount, $fiat_currency]); echo json_encode(['success' => true]); exit; @@ -130,6 +163,8 @@ if ($action === 'withdraw') { $symbol = $_POST['symbol'] ?? 'USDT'; $address = $_POST['address'] ?? ''; $password = $_POST['password'] ?? ''; + $fiat_amount = isset($_POST['fiat_amount']) ? (float)$_POST['fiat_amount'] : null; + $fiat_currency = $_POST['fiat_currency'] ?? null; // Validate balance $stmt = $db->prepare("SELECT available FROM user_balances WHERE user_id = ? AND symbol = ?"); @@ -151,8 +186,8 @@ if ($action === 'withdraw') { ->execute([$amount, $user_id, $symbol]); // Record request - $stmt = $db->prepare("INSERT INTO finance_requests (user_id, type, amount, symbol, payment_details, status) VALUES (?, 'withdrawal', ?, ?, ?, 'pending')"); - $stmt->execute([$user_id, $amount, $symbol, $address]); + $stmt = $db->prepare("INSERT INTO finance_requests (user_id, type, amount, symbol, payment_details, fiat_amount, fiat_currency, status) VALUES (?, 'withdrawal', ?, ?, ?, ?, ?, 'pending')"); + $stmt->execute([$user_id, $amount, $symbol, $address, $fiat_amount, $fiat_currency]); // Add to transactions as pending $db->prepare("INSERT INTO transactions (user_id, type, amount, symbol, status) VALUES (?, 'withdrawal', ?, ?, 'pending')") diff --git a/assets/css/terminal.css b/assets/css/terminal.css index b222730..8beabcf 100644 --- a/assets/css/terminal.css +++ b/assets/css/terminal.css @@ -676,48 +676,99 @@ z-index: 9999; } .order-popup { - background: #1e2329; - width: 360px; - padding: 30px; - border-radius: 24px; + background: rgba(30, 35, 41, 0.95); + width: 420px; + padding: 40px; + border-radius: 36px; text-align: center; - border: 1px solid rgba(255,255,255,0.1); - box-shadow: 0 20px 50px rgba(0,0,0,0.5); + border: 1px solid rgba(255,255,255,0.15); + box-shadow: 0 40px 100px rgba(0,0,0,0.9); + position: relative; + overflow: hidden; + backdrop-filter: blur(25px); } + +.order-popup::before { + content: ''; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 6px; + background: linear-gradient(90deg, #0062ff, #00d2ff, #0062ff); + background-size: 200% 100%; + animation: gradientMove 3s linear infinite; + z-index: 10; +} + +@keyframes gradientMove { + 0% { background-position: 100% 0; } + 100% { background-position: -100% 0; } +} + .order-popup h5 { color: #fff; - font-weight: 700; - margin-bottom: 25px; + font-weight: 800; + margin-bottom: 35px; + font-size: 22px; + letter-spacing: 0.5px; + text-transform: uppercase; + opacity: 0.9; } + .countdown-circle { position: relative; - width: 120px; - height: 120px; - margin: 0 auto 30px; + width: 200px; + height: 200px; + margin: 0 auto 35px; + display: flex; + align-items: center; + justify-content: center; + background: radial-gradient(circle, rgba(0, 98, 255, 0.1) 0%, rgba(0,0,0,0) 70%); + border-radius: 50%; + z-index: 1; } + .countdown-circle svg { - width: 120px; - height: 120px; + position: absolute; + top: 0; + left: 0; + width: 200px; + height: 200px; transform: rotate(-90deg); } + .countdown-circle circle { fill: none; - stroke-width: 8; + stroke-width: 10; } -.countdown-circle .bg { stroke: rgba(255,255,255,0.05); } + +.countdown-circle .bg { + stroke: rgba(255,255,255,0.05); +} + .countdown-circle .progress { - stroke: #0ecb81; - transition: stroke-dashoffset 0.1s linear; + stroke: #0062ff; + transition: stroke-dashoffset 1s linear; stroke-linecap: round; + filter: drop-shadow(0 0 15px rgba(0, 98, 255, 0.8)); } + .countdown-circle .time-text { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); - font-size: 28px; - font-weight: 800; + font-size: 72px; + font-weight: 900; color: #fff; + font-family: 'Inter', sans-serif; + letter-spacing: -2px; + z-index: 2; + text-shadow: 0 0 30px rgba(0,0,0,0.8); + line-height: 1; + margin: 0; + padding: 0; } .popup-details { background: rgba(0,0,0,0.2); @@ -738,6 +789,116 @@ font-size: 12px; color: #848e9c; } +/* Order Result Premium Styling */ .order-result-display { padding: 10px 0; } + +.result-icon-wrapper { + position: relative; + width: 140px; + height: 140px; + margin: 0 auto; + display: flex; + align-items: center; + justify-content: center; +} + +.result-circle { + width: 100px; + height: 100px; + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + font-size: 50px; + color: #fff; + z-index: 2; + position: relative; + box-shadow: 0 10px 30px rgba(0,0,0,0.5); +} + +.result-circle.won { + background: linear-gradient(135deg, #0ecb81, #26a69a); +} + +.result-circle.lost { + background: linear-gradient(135deg, #f6465d, #ef5350); +} + +.result-glow { + position: absolute; + width: 140px; + height: 140px; + border-radius: 50%; + z-index: 1; + filter: blur(20px); + opacity: 0.6; + animation: resultGlowPulse 2s infinite alternate; +} + +.result-glow.won { background: rgba(14, 203, 129, 0.8); } +.result-glow.lost { background: rgba(246, 70, 93, 0.8); } + +@keyframes resultGlowPulse { + from { transform: scale(0.9); opacity: 0.4; } + to { transform: scale(1.1); opacity: 0.8; } +} + +.result-title { + font-size: 28px; + font-weight: 900; + text-shadow: 0 0 20px rgba(255,255,255,0.1); +} + +.result-message { + font-size: 18px; + color: #fff; + opacity: 0.9; + font-weight: 500; +} + +.result-card { + background: rgba(255, 255, 255, 0.05); + border-radius: 20px; + padding: 24px; + border: 1px solid rgba(255, 255, 255, 0.08); +} + +.result-row { + display: flex; + justify-content: space-between; + margin-bottom: 12px; + font-size: 14px; +} + +.result-row.total { + margin-top: 15px; + padding-top: 15px; + border-top: 1px solid rgba(255, 255, 255, 0.1); + font-size: 18px; + font-weight: 700; +} + +.result-row .label { color: rgba(255,255,255,0.5); } +.result-row .value { color: #fff; } + +.btn-result-confirm { + height: 60px; + border-radius: 30px; + background: linear-gradient(90deg, #0062ff, #00d2ff); + border: none; + color: #fff; + font-weight: 800; + font-size: 18px; + letter-spacing: 2px; + box-shadow: 0 10px 30px rgba(0, 98, 255, 0.4); + transition: all 0.3s; +} + +.btn-result-confirm:hover { + transform: translateY(-3px); + box-shadow: 0 15px 40px rgba(0, 98, 255, 0.6); + color: #fff; +} + diff --git a/assets/pasted-20260218-071500-227b7150.png b/assets/pasted-20260218-071500-227b7150.png new file mode 100644 index 0000000..a14b4ee Binary files /dev/null and b/assets/pasted-20260218-071500-227b7150.png differ diff --git a/assets/pasted-20260218-072017-3ddb7d9a.png b/assets/pasted-20260218-072017-3ddb7d9a.png new file mode 100644 index 0000000..9cf3df5 Binary files /dev/null and b/assets/pasted-20260218-072017-3ddb7d9a.png differ diff --git a/includes/lang.php b/includes/lang.php index d8d1ef6..11ba639 100644 --- a/includes/lang.php +++ b/includes/lang.php @@ -142,6 +142,7 @@ $translations = [ 'settlement_history' => '结算历史', 'no_records_found' => '暂无记录', 'executing' => '执行中', + 'settling' => '结算中', 'loss' => '亏损', 'enter_amount' => '请输入有效金额', 'amount_too_low' => '金额太低', @@ -273,6 +274,9 @@ $translations = [ 'withdrawal' => '提现', 'settlement_pnl' => '结算盈亏', 'order_result' => '交易结果', + 'settlement_price' => '结算价格', + 'purchase_amount' => '认购金额', + 'recharge_amount' => '充值金额', ], 'en' => [ 'home' => 'Home', @@ -408,6 +412,7 @@ $translations = [ 'settlement_history' => 'History', 'no_records_found' => 'No records', 'executing' => 'Executing', + 'settling' => 'Settling...', 'loss' => 'Loss', 'enter_amount' => 'Please enter valid amount', 'amount_too_low' => 'Amount too low', @@ -539,6 +544,9 @@ $translations = [ 'withdrawal' => 'Withdrawal', 'settlement_pnl' => 'Settlement PnL', 'order_result' => 'Order Result', + 'settlement_price' => 'Settlement Price', + 'purchase_amount' => 'Purchase Amount', + 'recharge_amount' => 'Recharge Amount', ] ]; diff --git a/includes/terminal_layout.php b/includes/terminal_layout.php index 4c590b2..af4e6ee 100644 --- a/includes/terminal_layout.php +++ b/includes/terminal_layout.php @@ -318,6 +318,11 @@ function renderTerminal($activeTab = 'spot') { function settleOrderBackend(order) { const closePrice = parseFloat(document.querySelector('.price-jump').innerText.replace(/,/g, '')); + + // Immediately update UI to show it's settling + order.status = 'Settling...'; + if (showHistoryTab.currentTab === 'open') showHistoryTab('open'); + const formData = new FormData(); formData.append('action', 'settle_order'); formData.append('order_id', order.id); @@ -330,51 +335,92 @@ function renderTerminal($activeTab = 'spot') { .then(r => r.json()) .then(data => { if (data.success) { + // Update order object for immediate UI refresh order.status = data.result === 'won' ? 'Profit' : 'Loss'; const amount = parseFloat(order.amount); const profit = amount * order.profitRate / 100; + order.pnl = data.pnl; order.total = data.result === 'won' ? (amount + profit).toFixed(2) : '0.00'; order.close_price = closePrice; + // Move from open to settlement historyData.open = historyData.open.filter(o => o.id !== order.id); historyData.settlement.unshift(order); - showHistoryTab(showHistoryTab.currentTab); - + + // Refresh history tabs immediately + if (showHistoryTab.currentTab === 'open' || showHistoryTab.currentTab === 'settlement') { + showHistoryTab(showHistoryTab.currentTab); + } + if (data.result === 'won') { const balance = parseFloat(document.getElementById('user-usdt-balance').innerText.replace(',', '')); document.getElementById('user-usdt-balance').innerText = (balance + amount + profit).toLocaleString('en-US', {minimumFractionDigits: 2}); } - showOrderResult(data.result, data.pnl); + // Display the result popup with exact wording + showOrderResult(data.result, data.pnl, closePrice, order.amount); } + }).catch(err => { + console.error("Settlement failed", err); + order.status = 'Error'; + showHistoryTab('open'); }); } - function showOrderResult(result, pnl) { - const popup = document.querySelector('.order-popup'); - const details = document.querySelector('.popup-details'); - const countdown = document.querySelector('.countdown-circle'); - const footer = document.querySelector('.popup-footer'); + function showOrderResult(result, pnl, settlePrice, orderAmount) { + const popupOverlay = document.getElementById('order-popup-overlay'); + const popup = popupOverlay.querySelector('.order-popup'); - countdown.style.display = 'none'; - details.style.display = 'none'; - footer.style.display = 'none'; + // Clear current content but keep the container + popup.innerHTML = ''; - const resultDiv = document.createElement('div'); - resultDiv.className = 'order-result-display animate__animated animate__zoomIn'; - resultDiv.innerHTML = ` -
- + const pnlAmount = parseFloat(Math.abs(pnl)).toFixed(2); + const isWon = result === 'won'; + + let message = isWon ? + ('恭喜你获利' + ' ' + pnlAmount + ' USDT') : + ('很遗憾亏损' + ' ' + pnlAmount + ' USDT'); + + const resultHtml = ` +
+
+
+ +
+
+
+ +

+ ${isWon ? '交易获利' : '交易亏损'} +

+ +

+ ${message} +

+ +
+
+ 结算价格 + ${settlePrice.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2})} +
+
+ 下单金额 + ${parseFloat(orderAmount).toFixed(2)} USDT +
+
+ 交割返还 + ${isWon ? (parseFloat(pnl) + parseFloat(orderAmount)).toFixed(2) : '0.00'} USDT +
+
+ +
-

${result === 'won' ? '' : ''}

-
- ${result === 'won' ? '+' : ''}${parseFloat(pnl).toFixed(2)} USDT -
- `; - popup.appendChild(resultDiv); + + popup.innerHTML = resultHtml; } + function showErrorModal(msg) { const modal = document.getElementById('error-modal-overlay'); @@ -434,12 +480,12 @@ function renderTerminal($activeTab = 'spot') { const progress = document.getElementById('popup-progress'); const currentPrice = document.getElementById('popup-price'); - timeText.innerText = order.secondsLeft + ''; + timeText.innerText = order.secondsLeft; // Update current price in popup currentPrice.innerText = document.querySelector('.price-jump').innerText; - const radius = 54; // Match SVG radius + const radius = 90; // Updated radius to match 200x200 SVG const circumference = 2 * Math.PI * radius; const offset = circumference - (order.secondsLeft / order.totalSeconds) * circumference; @@ -808,6 +854,7 @@ function renderTerminal($activeTab = 'spot') { populateAllCoins().then(() => { initTradingWS(); loadHistory(); + setInterval(loadHistory, 10000); // Auto-refresh history every 10s }); @@ -933,7 +980,13 @@ function renderTerminal($activeTab = 'spot') { const statusBg = isProfit ? 'bg-success' : (isLoss ? 'bg-danger' : 'bg-info'); let displayStatus = row.status; - if (isExecuting) displayStatus = ' (' + row.secondsLeft + ')'; + if (isExecuting) { + if (row.secondsLeft <= 0) { + displayStatus = ''; + } else { + displayStatus = ' (' + row.secondsLeft + ')'; + } + } if (isProfit) displayStatus = ''; if (isLoss) displayStatus = ''; @@ -943,7 +996,8 @@ function renderTerminal($activeTab = 'spot') { const pl = parseFloat(row.pnl || 0).toFixed(2); const total = parseFloat(row.total || 0).toFixed(2); const plClass = pl >= 0 ? 'text-success' : 'text-danger'; - totalDisplay = `
${total}
${pl >= 0 ? '+' : ''}${pl}
`; + totalDisplay = `
${pl >= 0 ? '+' : ''}${pl}
+
${total} USDT
`; } const isUp = row.side_type === 'up' || row.side.includes('Up') || row.side.includes('涨') || row.side === 'Buy' || row.side === 'Long'; @@ -1003,11 +1057,11 @@ function renderTerminal($activeTab = 'spot') {
- - - + + + - +