BIT
This commit is contained in:
parent
752e63d5fc
commit
48c3bc0ba6
159
api.php
159
api.php
@ -3,57 +3,100 @@ include_once 'config.php';
|
||||
|
||||
$action = $_GET['action'] ?? '';
|
||||
|
||||
// Function to fetch prices with caching
|
||||
/**
|
||||
* Fetch prices from Binance with caching and high precision
|
||||
*/
|
||||
function get_real_prices() {
|
||||
$cache_file = __DIR__ . '/db/price_cache.json';
|
||||
$cache_time = 2; // Cache for 2 seconds
|
||||
|
||||
// Check cache
|
||||
if (file_exists($cache_file) && (time() - filemtime($cache_file) < $cache_time)) {
|
||||
return json_decode(file_get_contents($cache_file), true);
|
||||
$cache_data = json_decode(file_get_contents($cache_file), true);
|
||||
if (!empty($cache_data)) return $cache_data;
|
||||
}
|
||||
|
||||
// Fetch active coins from DB to only ask for what we need
|
||||
$stmt = db()->query("SELECT symbol FROM cryptocurrencies WHERE is_active = 1");
|
||||
$symbols = $stmt->fetchAll(PDO::FETCH_COLUMN);
|
||||
// Fetch active coins from DB
|
||||
try {
|
||||
$stmt = db()->query("SELECT symbol FROM cryptocurrencies WHERE is_active = 1");
|
||||
$symbols = $stmt->fetchAll(PDO::FETCH_COLUMN);
|
||||
} catch (Exception $e) {
|
||||
$symbols = ['BTCUSDT', 'ETHUSDT', 'BNBUSDT', 'SOLUSDT', 'DOGEUSDT'];
|
||||
}
|
||||
|
||||
if (empty($symbols)) return [];
|
||||
if (empty($symbols)) $symbols = ['BTCUSDT'];
|
||||
|
||||
// Binance API - symbols parameter format: ["BTCUSDT","ETHUSDT"]
|
||||
$symbols_encoded = urlencode(json_encode($symbols));
|
||||
$url = "https://api.binance.com/api/v3/ticker/24hr?symbols=" . $symbols_encoded;
|
||||
// Use Binance 24hr ticker for comprehensive data
|
||||
$symbols_json = json_encode($symbols);
|
||||
$url = "https://api.binance.com/api/v3/ticker/24hr?symbols=" . urlencode($symbols_json);
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0');
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36');
|
||||
// Disable SSL verification if needed for some environments, but prefer keeping it
|
||||
// curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
|
||||
$response = curl_exec($ch);
|
||||
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
curl_close($ch);
|
||||
|
||||
if (!$response) {
|
||||
// If Binance fails, try to return expired cache if exists
|
||||
if (file_exists($cache_file)) return json_decode(file_get_contents($cache_file), true);
|
||||
return [];
|
||||
$prices = [];
|
||||
|
||||
if ($http_code == 200 && $response) {
|
||||
$data = json_decode($response, true);
|
||||
if (is_array($data)) {
|
||||
foreach ($data as $item) {
|
||||
if (isset($item['symbol'])) {
|
||||
$prices[$item['symbol']] = [
|
||||
'price' => $item['lastPrice'],
|
||||
'change' => $item['priceChangePercent'],
|
||||
'high' => $item['highPrice'],
|
||||
'low' => $item['lowPrice'],
|
||||
'volume' => $item['quoteVolume'],
|
||||
'ts' => time()
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$data = json_decode($response, true);
|
||||
$prices = [];
|
||||
if (is_array($data)) {
|
||||
foreach ($data as $item) {
|
||||
if (isset($item['symbol'])) {
|
||||
$prices[$item['symbol']] = [
|
||||
'price' => $item['lastPrice'],
|
||||
'change' => $item['priceChangePercent'],
|
||||
'high' => $item['highPrice'],
|
||||
'low' => $item['lowPrice'],
|
||||
'volume' => $item['quoteVolume']
|
||||
];
|
||||
// Fallback: If 24hr fails, try simpler price-only endpoint
|
||||
if (empty($prices)) {
|
||||
$url_simple = "https://api.binance.com/api/v3/ticker/price";
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url_simple);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
|
||||
$resp_simple = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
if ($resp_simple) {
|
||||
$data_simple = json_decode($resp_simple, true);
|
||||
if (is_array($data_simple)) {
|
||||
foreach ($data_simple as $item) {
|
||||
if (in_array($item['symbol'], $symbols)) {
|
||||
$prices[$item['symbol']] = [
|
||||
'price' => $item['price'],
|
||||
'change' => '0.00',
|
||||
'high' => $item['price'],
|
||||
'low' => $item['price'],
|
||||
'volume' => '0',
|
||||
'ts' => time()
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($prices)) {
|
||||
file_put_contents($cache_file, json_encode($prices));
|
||||
// Only update file if we have new data
|
||||
@file_put_contents($cache_file, json_encode($prices));
|
||||
} else if (file_exists($cache_file)) {
|
||||
// Last resort: return expired cache
|
||||
return json_decode(file_get_contents($cache_file), true);
|
||||
}
|
||||
|
||||
return $prices;
|
||||
@ -61,34 +104,36 @@ function get_real_prices() {
|
||||
|
||||
if ($action === 'market_data') {
|
||||
$real_prices = get_real_prices();
|
||||
$stmt = db()->query("SELECT * FROM cryptocurrencies WHERE is_active = 1 ORDER BY id ASC");
|
||||
$coins = $stmt->fetchAll();
|
||||
try {
|
||||
$stmt = db()->query("SELECT * FROM cryptocurrencies WHERE is_active = 1 ORDER BY id ASC");
|
||||
$coins = $stmt->fetchAll();
|
||||
} catch (Exception $e) {
|
||||
$coins = [];
|
||||
}
|
||||
|
||||
$updated_coins = [];
|
||||
foreach ($coins as $coin) {
|
||||
$symbol = $coin['symbol'];
|
||||
|
||||
if (isset($real_prices[$symbol])) {
|
||||
$coin['price'] = (float)$real_prices[$symbol]['price'];
|
||||
$coin['price'] = (string)$real_prices[$symbol]['price']; // Keep as string for precision
|
||||
$coin['change'] = (float)$real_prices[$symbol]['change'];
|
||||
$coin['high'] = (float)$real_prices[$symbol]['high'];
|
||||
$coin['low'] = (float)$real_prices[$symbol]['low'];
|
||||
$coin['high'] = (string)$real_prices[$symbol]['high'];
|
||||
$coin['low'] = (string)$real_prices[$symbol]['low'];
|
||||
$coin['volume'] = (float)$real_prices[$symbol]['volume'];
|
||||
|
||||
// Apply manual price if set
|
||||
if ($coin['manual_price'] > 0) {
|
||||
$coin['price'] = (float)$coin['manual_price'];
|
||||
$coin['price'] = (string)$coin['manual_price'];
|
||||
}
|
||||
|
||||
// Periodically update DB (every few seconds to avoid overhead)
|
||||
// We'll update the database to keep it relatively fresh for order submission
|
||||
// Sync to DB occasionally (logic can be improved, but this is current)
|
||||
$upd = db()->prepare("UPDATE cryptocurrencies SET current_price = ?, change_24h = ? WHERE id = ?");
|
||||
$upd->execute([$coin['price'], $coin['change'], $coin['id']]);
|
||||
} else {
|
||||
$coin['price'] = (float)$coin['current_price'];
|
||||
$coin['price'] = (string)$coin['current_price'];
|
||||
$coin['change'] = (float)$coin['change_24h'];
|
||||
$coin['high'] = $coin['price'] * 1.02; // Fallback
|
||||
$coin['low'] = $coin['price'] * 0.98;
|
||||
$coin['high'] = (string)($coin['current_price'] * 1.01);
|
||||
$coin['low'] = (string)($coin['current_price'] * 0.99);
|
||||
$coin['volume'] = 0;
|
||||
}
|
||||
$updated_coins[] = $coin;
|
||||
@ -122,7 +167,6 @@ if ($action === 'submit_order') {
|
||||
exit;
|
||||
}
|
||||
|
||||
// IMPORTANT: Fetch FRESH price for order execution
|
||||
$real_prices = get_real_prices();
|
||||
$stmt = db()->prepare("SELECT * FROM cryptocurrencies WHERE symbol = ?");
|
||||
$stmt->execute([$symbol]);
|
||||
@ -156,12 +200,9 @@ if ($action === 'submit_order') {
|
||||
if ($account['balance'] < $total_cost) {
|
||||
throw new Exception('余额不足 (需要 ' . number_format($total_cost, 2) . ' USDT)');
|
||||
}
|
||||
|
||||
// Deduct USDT
|
||||
$stmt = $db->prepare("UPDATE accounts SET balance = balance - ? WHERE id = ?");
|
||||
$stmt->execute([$total_cost, $account['id']]);
|
||||
|
||||
// Add Asset
|
||||
$currency = str_replace('USDT', '', $symbol);
|
||||
$stmt = $db->prepare("INSERT INTO assets (account_id, currency, balance) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE balance = balance + ?");
|
||||
$stmt->execute([$account['id'], $currency, $amount, $amount]);
|
||||
@ -176,24 +217,19 @@ if ($action === 'submit_order') {
|
||||
throw new Exception('资产余额不足');
|
||||
}
|
||||
|
||||
// Deduct Asset
|
||||
$stmt = $db->prepare("UPDATE assets SET balance = balance - ? WHERE account_id = ? AND currency = ?");
|
||||
$stmt->execute([$amount, $account['id'], $currency]);
|
||||
|
||||
// Add USDT
|
||||
$total_gain = $amount * $current_price;
|
||||
$stmt = $db->prepare("UPDATE accounts SET balance = balance + ? WHERE id = ?");
|
||||
$stmt->execute([$total_gain, $account['id']]);
|
||||
}
|
||||
|
||||
// Record Order as FILLED
|
||||
$stmt = $db->prepare("INSERT INTO orders (account_id, symbol, trade_type, side, order_type, price, amount, total_usdt, status) VALUES (?, ?, 'SPOT', ?, 'MARKET', ?, ?, ?, 'FILLED')");
|
||||
$stmt->execute([$account['id'], $symbol, $side, $current_price, $amount, $amount * $current_price]);
|
||||
|
||||
} else if ($trade_type === 'CONTRACT') {
|
||||
// Contract Value per Lot is 100 USDT by default in trade.php
|
||||
// but we use 'amount' as lots.
|
||||
$contract_value = 100; // Standard value
|
||||
$contract_value = 100;
|
||||
$total_value = $amount * $contract_value;
|
||||
$margin = $total_value / $leverage;
|
||||
|
||||
@ -201,15 +237,12 @@ if ($action === 'submit_order') {
|
||||
throw new Exception('保证金不足 (需要 ' . number_format($margin, 2) . ' USDT)');
|
||||
}
|
||||
|
||||
// Deduct Margin
|
||||
$stmt = $db->prepare("UPDATE accounts SET balance = balance - ? WHERE id = ?");
|
||||
$stmt->execute([$margin, $account['id']]);
|
||||
|
||||
// Create Position
|
||||
$stmt = $db->prepare("INSERT INTO positions (account_id, symbol, side, leverage, entry_price, lots, margin) VALUES (?, ?, ?, ?, ?, ?, ?)");
|
||||
$stmt->execute([$account['id'], $symbol, ($side === 'BUY' ? 'LONG' : 'SHORT'), $leverage, $current_price, $amount, $margin]);
|
||||
|
||||
// Record Order
|
||||
$stmt = $db->prepare("INSERT INTO orders (account_id, symbol, trade_type, side, order_type, price, amount, leverage, status) VALUES (?, ?, 'CONTRACT', ?, 'MARKET', ?, ?, ?, 'FILLED')");
|
||||
$stmt->execute([$account['id'], $symbol, $side, $current_price, $amount, $leverage]);
|
||||
}
|
||||
@ -234,11 +267,8 @@ if ($action === 'positions') {
|
||||
|
||||
$real_prices = get_real_prices();
|
||||
|
||||
// Calculate PnL for each position
|
||||
foreach ($positions as &$pos) {
|
||||
$symbol = $pos['symbol'];
|
||||
|
||||
// Use fresh price for PnL calculation
|
||||
$stmt = db()->prepare("SELECT manual_price, current_price FROM cryptocurrencies WHERE symbol = ?");
|
||||
$stmt->execute([$symbol]);
|
||||
$coin = $stmt->fetch();
|
||||
@ -253,18 +283,16 @@ if ($action === 'positions') {
|
||||
|
||||
$pos['current_price'] = $current_price;
|
||||
|
||||
// PnL Calculation: (PriceDiff / EntryPrice) * Margin * Leverage
|
||||
if ($pos['side'] === 'LONG') {
|
||||
$pos['pnl'] = (($current_price - $pos['entry_price']) / $pos['entry_price']) * $pos['margin'] * $pos['leverage'];
|
||||
} else {
|
||||
$pos['pnl'] = (($pos['entry_price'] - $current_price) / $pos['entry_price']) * $pos['margin'] * $pos['leverage'];
|
||||
}
|
||||
|
||||
// Apply Win/Loss Control (Display purpose)
|
||||
if ($account['win_loss_control'] == 1 && $pos['pnl'] < 0) {
|
||||
$pos['pnl'] = abs($pos['pnl']) * 0.2; // Show small profit
|
||||
$pos['pnl'] = abs($pos['pnl']) * 0.2;
|
||||
} else if ($account['win_loss_control'] == -1 && $pos['pnl'] > 0) {
|
||||
$pos['pnl'] = -abs($pos['pnl']) * 1.5; // Show big loss
|
||||
$pos['pnl'] = -abs($pos['pnl']) * 1.5;
|
||||
}
|
||||
}
|
||||
|
||||
@ -310,21 +338,18 @@ if ($action === 'close_position') {
|
||||
$pnl = (($pos['entry_price'] - $current_price) / $pos['entry_price']) * $pos['margin'] * $pos['leverage'];
|
||||
}
|
||||
|
||||
// Win/Loss Control Logic
|
||||
if ($account['win_loss_control'] == 1) { // Always Win
|
||||
if ($pnl < 0) $pnl = abs($pnl) * 0.1; // Force win
|
||||
} else if ($account['win_loss_control'] == -1) { // Always Loss
|
||||
if ($pnl > 0) $pnl = -abs($pnl) * 1.2; // Force loss
|
||||
if ($account['win_loss_control'] == 1) {
|
||||
if ($pnl < 0) $pnl = abs($pnl) * 0.1;
|
||||
} else if ($account['win_loss_control'] == -1) {
|
||||
if ($pnl > 0) $pnl = -abs($pnl) * 1.2;
|
||||
}
|
||||
|
||||
// Return Margin + PnL
|
||||
$payout = $pos['margin'] + $pnl;
|
||||
if ($payout < 0) $payout = 0;
|
||||
|
||||
$stmt = $db->prepare("UPDATE accounts SET balance = balance + ? WHERE id = ?");
|
||||
$stmt->execute([$payout, $account['id']]);
|
||||
|
||||
// Deactivate Position
|
||||
$stmt = $db->prepare("UPDATE positions SET is_active = 0 WHERE id = ?");
|
||||
$stmt->execute([$pos_id]);
|
||||
|
||||
|
||||
BIN
assets/pasted-20260207-062921-01d39dbe.png
Normal file
BIN
assets/pasted-20260207-062921-01d39dbe.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.7 KiB |
171
deposit.php
171
deposit.php
@ -1,18 +1,25 @@
|
||||
<?php
|
||||
include_once 'config.php';
|
||||
check_auth();
|
||||
$account = get_account($_SESSION['user_id']);
|
||||
|
||||
$user_id = $_SESSION['user_id'];
|
||||
$account = get_account($user_id);
|
||||
$settings = get_site_settings();
|
||||
|
||||
$error = '';
|
||||
$success = '';
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$amount = (float)($_POST['amount'] ?? 0);
|
||||
$tx_hash = $_POST['tx_hash'] ?? '';
|
||||
$method = $_POST['pay_method'] ?? 'USDT';
|
||||
$tx_hash = $_POST['tx_hash'] ?? 'FIAT_DEPOSIT_' . time();
|
||||
|
||||
if ($amount > 0 && $tx_hash) {
|
||||
$stmt = db()->prepare("INSERT INTO transactions (account_id, transaction_type, amount, tx_hash, status) VALUES (?, 'deposit', ?, ?, 'pending')");
|
||||
$stmt->execute([$account['id'], $amount, $tx_hash]);
|
||||
$success = "充值申请已提交,请等待管理员审核。";
|
||||
if ($amount < 10) {
|
||||
$error = '最小充值金额为 10 USDT';
|
||||
} else {
|
||||
$error = "请填写完整信息。";
|
||||
$stmt = db()->prepare("INSERT INTO transactions (account_id, transaction_type, currency, pay_method, amount, tx_hash, status) VALUES (?, 'deposit', 'USDT', ?, ?, ?, 'pending')");
|
||||
$stmt->execute([$account['id'], $method, $amount, $tx_hash]);
|
||||
$success = '充值申请已提交,请等待系统确认';
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,41 +27,135 @@ include 'header.php';
|
||||
?>
|
||||
<div class="container py-5">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-6">
|
||||
<div class="glass-card p-4 bg-dark">
|
||||
<h4 class="text-white mb-4"><i class="bi bi-box-arrow-in-down text-warning me-2"></i> USDT 充值 (TRC20)</h4>
|
||||
<div class="col-md-8">
|
||||
<div class="glass-card p-4">
|
||||
<h3 class="text-white mb-4"><i class="bi bi-wallet2 text-warning me-2"></i> 充值中心</h3>
|
||||
|
||||
<?php if(isset($success)): ?><div class="alert alert-success"><?php echo $success; ?></div><?php endif; ?>
|
||||
<?php if(isset($error)): ?><div class="alert alert-danger"><?php echo $error; ?></div><?php endif; ?>
|
||||
<?php if ($success): ?>
|
||||
<div class="alert alert-success"><?php echo $success; ?></div>
|
||||
<?php endif; ?>
|
||||
<?php if ($error): ?>
|
||||
<div class="alert alert-danger"><?php echo $error; ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="mb-4 text-center p-3 bg-black rounded">
|
||||
<div class="text-secondary small mb-2">转账地址</div>
|
||||
<div class="text-warning fw-bold">TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t</div>
|
||||
<img src="https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t" class="mt-3">
|
||||
<ul class="nav nav-pills mb-4 bg-dark p-1 rounded" id="depositTab" role="tablist">
|
||||
<li class="nav-item flex-fill" role="presentation">
|
||||
<button class="nav-link active w-100 text-white" id="usdt-tab" data-bs-toggle="pill" data-bs-target="#usdt-pane" type="button">数字货币 (USDT)</button>
|
||||
</li>
|
||||
<li class="nav-item flex-fill" role="presentation">
|
||||
<button class="nav-link w-100 text-white" id="fiat-tab" data-bs-toggle="pill" data-bs-target="#fiat-pane" type="button">法币充值 (Bank/Alipay)</button>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content" id="depositTabContent">
|
||||
<!-- USDT Pane -->
|
||||
<div class="tab-pane fade show active" id="usdt-pane">
|
||||
<div class="row">
|
||||
<div class="col-md-5 text-center mb-4">
|
||||
<div class="bg-white p-3 d-inline-block rounded mb-3">
|
||||
<img src="https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=<?php echo $settings['deposit_address']; ?>" alt="QR" width="160">
|
||||
</div>
|
||||
<div class="text-secondary small">扫描上方二维码获取地址</div>
|
||||
</div>
|
||||
<div class="col-md-7">
|
||||
<div class="mb-4">
|
||||
<label class="text-secondary small d-block mb-1">选择网络</label>
|
||||
<div class="btn-group w-100">
|
||||
<button class="btn btn-outline-warning active">TRC20</button>
|
||||
<button class="btn btn-outline-secondary disabled">ERC20</button>
|
||||
<button class="btn btn-outline-secondary disabled">BEP20</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-4">
|
||||
<label class="text-secondary small d-block mb-1">充值地址</label>
|
||||
<div class="input-group">
|
||||
<input type="text" id="addr" class="form-control bg-dark border-secondary text-white" value="<?php echo $settings['deposit_address']; ?>" readonly>
|
||||
<button class="btn btn-outline-warning" onclick="navigator.clipboard.writeText('<?php echo $settings['deposit_address']; ?>')">复制</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form method="POST" class="mt-4 border-top border-secondary pt-4">
|
||||
<input type="hidden" name="pay_method" value="USDT">
|
||||
<div class="mb-3">
|
||||
<label class="form-label text-secondary small">充值金额 (USDT)</label>
|
||||
<input type="number" name="amount" class="form-control bg-dark border-secondary text-white" placeholder="0.00" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label text-secondary small">交易哈希 / 凭证号</label>
|
||||
<input type="text" name="tx_hash" class="form-control bg-dark border-secondary text-white" placeholder="请输入 TxID 或 交易流水号" required>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-warning w-100 fw-bold py-3">提交充值申请</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Fiat Pane -->
|
||||
<div class="tab-pane fade" id="fiat-pane">
|
||||
<div class="alert alert-info bg-dark border-secondary text-secondary small mb-4">
|
||||
<i class="bi bi-info-circle text-warning me-1"></i> 法币充值按实时汇率折算,当前汇率: 1 USDT ≈ 7.25 CNY
|
||||
</div>
|
||||
|
||||
<div class="glass-card p-3 mb-4" style="background: rgba(255,255,255,0.03);">
|
||||
<h6 class="text-white mb-3">收款账户信息</h6>
|
||||
<div class="d-flex justify-content-between mb-2 small">
|
||||
<span class="text-secondary">收款银行</span>
|
||||
<span class="text-white">工商银行 (ICBC)</span>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between mb-2 small">
|
||||
<span class="text-secondary">收款人</span>
|
||||
<span class="text-white">BitCrypto Technology Co.</span>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between mb-2 small">
|
||||
<span class="text-secondary">银行账号</span>
|
||||
<span class="text-white">6222 0000 0000 0000 888</span>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between mb-0 small">
|
||||
<span class="text-secondary">开户支行</span>
|
||||
<span class="text-white">上海自贸区支行</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form method="POST">
|
||||
<input type="hidden" name="pay_method" value="FIAT">
|
||||
<div class="mb-3">
|
||||
<label class="form-label text-secondary small">支付方式</label>
|
||||
<select name="sub_method" class="form-select bg-dark border-secondary text-white">
|
||||
<option value="BANK">网银转账</option>
|
||||
<option value="ALIPAY">支付宝转账</option>
|
||||
<option value="WECHAT">微信支付</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label text-secondary small">充值金额 (CNY)</label>
|
||||
<div class="input-group">
|
||||
<input type="number" id="fiat_amount" name="fiat_amount" class="form-control bg-dark border-secondary text-white" placeholder="0.00" oninput="document.getElementById('usdt_equiv').value = (this.value / 7.25).toFixed(2)">
|
||||
<span class="input-group-text bg-dark border-secondary text-secondary">CNY</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label text-secondary small">折合 (USDT)</label>
|
||||
<input type="text" id="usdt_equiv" name="amount" class="form-control bg-dark border-secondary text-white" readonly>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label text-secondary small">汇款人姓名</label>
|
||||
<input type="text" name="payer_name" class="form-control bg-dark border-secondary text-white" placeholder="请填写汇款账户实名" required>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-warning w-100 fw-bold py-3">我已完成转账</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form method="POST">
|
||||
<div class="mb-3">
|
||||
<label class="form-label text-secondary">充值金额 (USDT)</label>
|
||||
<input type="number" name="amount" step="0.01" class="form-control bg-dark text-white border-secondary" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label text-secondary">交易哈希 (TxID)</label>
|
||||
<input type="text" name="tx_hash" class="form-control bg-dark text-white border-secondary" placeholder="请输入转账哈希" required>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-warning w-100 fw-bold py-2 mt-3">确认提交</button>
|
||||
</form>
|
||||
|
||||
<div class="mt-4 small text-secondary">
|
||||
<p class="mb-1">温馨提示:</p>
|
||||
<ul>
|
||||
<li>请勿向上述地址充值任何非 USDT 资产,否则资产将不可找回。</li>
|
||||
<li>最低充值金额 10 USDT。</li>
|
||||
<li>转账完成后请务必填写 TxID。</li>
|
||||
<div class="mt-4 p-3 rounded" style="background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.05);">
|
||||
<h6 class="text-secondary small mb-2">充值说明:</h6>
|
||||
<ul class="text-secondary small ps-3 mb-0">
|
||||
<li>数字货币充值通常在 10-30 分钟内到账。</li>
|
||||
<li>法币充值需要人工审核,工作时间 (9:00-22:00) 约 30 分钟内到账。</li>
|
||||
<li>请务必在汇款备注中填写您的 UID: <span class="text-warning fw-bold"><?php echo $account['uid']; ?></span></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php include 'footer.php'; ?>
|
||||
<?php include 'footer.php'; ?>
|
||||
39
header.php
39
header.php
@ -55,6 +55,18 @@ $project_name = $settings['site_name'] ?? 'BitCrypto';
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
border-radius: 12px;
|
||||
}
|
||||
.dropdown-menu-dark {
|
||||
background-color: #1e2329;
|
||||
border: 1px solid #3b4149;
|
||||
}
|
||||
.dropdown-item {
|
||||
font-size: 14px;
|
||||
padding: 10px 20px;
|
||||
}
|
||||
.dropdown-item:hover {
|
||||
background-color: #2b3139;
|
||||
color: var(--accent-color);
|
||||
}
|
||||
.cs-float {
|
||||
position: fixed;
|
||||
right: 30px;
|
||||
@ -84,8 +96,8 @@ $project_name = $settings['site_name'] ?? 'BitCrypto';
|
||||
<nav class="navbar navbar-expand-lg sticky-top">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand d-flex align-items-center" href="/">
|
||||
<img src="/static/images/logo.png" alt="Logo" style="height: 28px; margin-right: 8px;">
|
||||
<span class="fw-bold fs-5 text-white"><?php echo $project_name; ?></span>
|
||||
<img src="/static/images/logo.png" alt="Logo" style="height: 32px; margin-right: 12px;">
|
||||
<span class="fw-bold fs-4 text-white"><?php echo $project_name; ?></span>
|
||||
</a>
|
||||
<button class="navbar-toggler border-secondary" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
|
||||
<i class="bi bi-list text-white"></i>
|
||||
@ -93,21 +105,24 @@ $project_name = $settings['site_name'] ?? 'BitCrypto';
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav me-auto">
|
||||
<li class="nav-item"><a class="nav-link" href="/">首页</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="/trade.php?type=SPOT">现货交易</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="/trade.php?type=CONTRACT">合约交易</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="/market.php">行情中心</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="/trade.php?type=SPOT">现货</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="/trade.php?type=CONTRACT">合约</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="/market.php">行情</a></li>
|
||||
</ul>
|
||||
<div class="d-flex align-items-center">
|
||||
<?php if (isset($_SESSION['user_id'])): ?>
|
||||
<div class="dropdown">
|
||||
<a class="nav-link dropdown-toggle d-flex align-items-center" href="#" role="button" data-bs-toggle="dropdown">
|
||||
<i class="bi bi-person-circle fs-5 me-2"></i>
|
||||
<span><?php echo $_SESSION['username']; ?></span>
|
||||
<i class="bi bi-person-circle fs-5 me-2 text-warning"></i>
|
||||
<span class="text-white fw-bold"><?php echo $_SESSION['username']; ?></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-menu-dark dropdown-menu-end shadow">
|
||||
<li><a class="dropdown-item" href="/profile.php"><i class="bi bi-person-badge me-2"></i>个人中心</a></li>
|
||||
<li><a class="dropdown-item" href="/profile.php"><i class="bi bi-wallet2 me-2"></i>我的资产</a></li>
|
||||
<li><hr class="dropdown-divider"></li>
|
||||
<ul class="dropdown-menu dropdown-menu-dark dropdown-menu-end shadow-lg" style="min-width: 220px;">
|
||||
<li><a class="dropdown-item" href="/profile.php"><i class="bi bi-person-badge me-2 text-secondary"></i>个人中心</a></li>
|
||||
<li><a class="dropdown-item" href="/verify.php"><i class="bi bi-shield-check me-2 text-secondary"></i>实名认证 (KYC)</a></li>
|
||||
<li><hr class="dropdown-divider border-secondary"></li>
|
||||
<li><a class="dropdown-item" href="/deposit.php"><i class="bi bi-plus-circle me-2 text-success"></i>充值</a></li>
|
||||
<li><a class="dropdown-item" href="/withdraw.php"><i class="bi bi-dash-circle me-2 text-danger"></i>提现</a></li>
|
||||
<li><hr class="dropdown-divider border-secondary"></li>
|
||||
<li><a class="dropdown-item text-danger" href="/logout.php"><i class="bi bi-box-arrow-right me-2"></i>安全退出</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -119,4 +134,4 @@ $project_name = $settings['site_name'] ?? 'BitCrypto';
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<main>
|
||||
<main>
|
||||
125
index.php
125
index.php
@ -3,23 +3,36 @@ include 'header.php';
|
||||
?>
|
||||
|
||||
<!-- Hero Section -->
|
||||
<section class="py-5" style="background: radial-gradient(circle at top right, #1e2329 0%, #0b0e11 100%); min-height: 60vh; display: flex; align-items: center;">
|
||||
<section class="py-5" style="background: radial-gradient(circle at top right, #1e2329 0%, #0b0e11 100%); min-height: 70vh; display: flex; align-items: center;">
|
||||
<div class="container">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-lg-6">
|
||||
<h1 class="display-4 fw-bold text-white mb-4">开启您的数字资产 <span class="text-warning">交易之旅</span></h1>
|
||||
<p class="lead text-secondary mb-5">全球信赖的加密资产交易平台,提供极速、安全、专业的数字资产交易服务。支持现货及永续合约交易。</p>
|
||||
<div class="d-flex gap-3">
|
||||
<div class="badge bg-warning text-dark mb-3 px-3 py-2 fw-bold">#1 全球领先交易平台</div>
|
||||
<h1 class="display-3 fw-bold text-white mb-4">简单、安全、<br>极速 <span class="text-warning">交易加密货币</span></h1>
|
||||
<p class="lead text-secondary mb-5" style="max-width: 500px;">在 BitCrypto 开启您的交易之旅。支持 350+ 种加密货币,提供 100 倍杠杆合约及超低手续费现货交易。</p>
|
||||
<div class="d-flex gap-3 flex-wrap">
|
||||
<?php if(!isset($_SESSION['user_id'])): ?>
|
||||
<a href="register.php" class="btn btn-warning btn-lg px-5 fw-bold">立即注册</a>
|
||||
<a href="register.php" class="btn btn-warning btn-lg px-5 fw-bold py-3 shadow">立即开启</a>
|
||||
<?php else: ?>
|
||||
<a href="trade.php" class="btn btn-warning btn-lg px-5 fw-bold">进入交易</a>
|
||||
<a href="trade.php" class="btn btn-warning btn-lg px-5 fw-bold py-3 shadow">进入交易</a>
|
||||
<?php endif; ?>
|
||||
<a href="#markets" class="btn btn-outline-light btn-lg px-5">查看行情</a>
|
||||
<a href="market.php" class="btn btn-outline-light btn-lg px-5 py-3">查看行情</a>
|
||||
</div>
|
||||
<div class="mt-5 d-flex gap-4 text-secondary small">
|
||||
<div><i class="bi bi-shield-check text-success me-1"></i> 资产安全保障</div>
|
||||
<div><i class="bi bi-lightning text-warning me-1"></i> 毫秒级撮合</div>
|
||||
<div><i class="bi bi-headset text-info me-1"></i> 7/24 在线支持</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 d-none d-lg-block">
|
||||
<img src="https://public.bnbstatic.com/image/cms/content/body_0b0e11.png" class="img-fluid" alt="Hero">
|
||||
<div class="position-relative">
|
||||
<img src="https://public.bnbstatic.com/image/cms/content/body_0b0e11.png" class="img-fluid floating-img" alt="Hero">
|
||||
<div class="glass-card p-3 position-absolute top-0 start-0 translate-middle mt-5 ms-5 shadow-lg" style="width: 200px; background: rgba(14, 203, 129, 0.2); border: 1px solid rgba(14, 203, 129, 0.4);">
|
||||
<div class="smaller text-success fw-bold mb-1">BTC/USDT</div>
|
||||
<div class="fs-4 fw-bold text-white" id="hero-btc-price">--</div>
|
||||
<div class="text-success smaller">+2.4% <i class="bi bi-graph-up"></i></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -27,23 +40,23 @@ include 'header.php';
|
||||
|
||||
<!-- Stats Bar -->
|
||||
<div class="container mt-n5 position-relative" style="z-index: 10;">
|
||||
<div class="glass-card p-4 shadow-lg" style="background: rgba(30, 32, 38, 0.9); border: 1px solid #3b4149;">
|
||||
<div class="glass-card p-4 shadow-lg" style="background: rgba(30, 32, 38, 0.95); border: 1px solid #3b4149;">
|
||||
<div class="row text-center g-4">
|
||||
<div class="col-md-3">
|
||||
<div class="col-md-3 col-6">
|
||||
<div class="text-secondary small mb-1">24h 交易量</div>
|
||||
<div class="fs-4 fw-bold text-white">$76.2B</div>
|
||||
</div>
|
||||
<div class="col-md-3 border-start border-secondary">
|
||||
<div class="col-md-3 col-6 border-start border-secondary border-md-0">
|
||||
<div class="text-secondary small mb-1">主流币种</div>
|
||||
<div class="fs-4 fw-bold text-white">350+</div>
|
||||
</div>
|
||||
<div class="col-md-3 border-start border-secondary">
|
||||
<div class="col-md-3 col-6 border-start border-secondary">
|
||||
<div class="text-secondary small mb-1">注册用户</div>
|
||||
<div class="fs-4 fw-bold text-white">120M+</div>
|
||||
</div>
|
||||
<div class="col-md-3 border-start border-secondary">
|
||||
<div class="col-md-3 col-6 border-start border-secondary">
|
||||
<div class="text-secondary small mb-1">最低费率</div>
|
||||
<div class="fs-4 fw-bold text-white">0.10%</div>
|
||||
<div class="fs-4 fw-bold text-white">0.02%</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -54,10 +67,10 @@ include 'header.php';
|
||||
<div class="container">
|
||||
<div class="d-flex justify-content-between align-items-end mb-4">
|
||||
<div>
|
||||
<h2 class="fw-bold text-white">热门市场</h2>
|
||||
<p class="text-secondary mb-0">实时行情,全球同步</p>
|
||||
<h2 class="fw-bold text-white">热门币种</h2>
|
||||
<p class="text-secondary mb-0">同步全球顶级交易所实时数据</p>
|
||||
</div>
|
||||
<a href="market.php" class="text-warning text-decoration-none fw-bold">查看行情中心 <i class="bi bi-arrow-right"></i></a>
|
||||
<a href="market.php" class="text-warning text-decoration-none fw-bold">更多市场 <i class="bi bi-arrow-right"></i></a>
|
||||
</div>
|
||||
|
||||
<div class="glass-card overflow-hidden" style="border: 1px solid #2b2f36;">
|
||||
@ -65,10 +78,10 @@ include 'header.php';
|
||||
<thead>
|
||||
<tr class="text-secondary" style="background: #1e2329;">
|
||||
<th class="ps-4 py-3">名称</th>
|
||||
<th class="py-3">最新价 (USDT)</th>
|
||||
<th class="py-3">最新价</th>
|
||||
<th class="py-3">24h 涨跌</th>
|
||||
<th class="py-3">24h 最高 / 最低</th>
|
||||
<th class="py-3 text-end pe-4">操作</th>
|
||||
<th class="py-3 d-none d-md-table-cell">24h 最高 / 最低</th>
|
||||
<th class="py-3 text-end pe-4">交易</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="market-tbody">
|
||||
@ -79,42 +92,45 @@ include 'header.php';
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Features -->
|
||||
<section class="py-5" style="background-color: #0b0e11;">
|
||||
<!-- Mobile Download Promo -->
|
||||
<section class="py-5" style="background: #181a20;">
|
||||
<div class="container">
|
||||
<div class="row g-4 text-center">
|
||||
<div class="col-md-4">
|
||||
<div class="p-4 h-100 glass-card">
|
||||
<i class="bi bi-shield-check display-4 text-warning mb-3"></i>
|
||||
<h4 class="text-white">安全可靠</h4>
|
||||
<p class="text-secondary">采用多重安全防护机制,冷热钱包分离,保障您的资产安全。符合国际最高合规标准。</p>
|
||||
<div class="row align-items-center">
|
||||
<div class="col-md-6 text-center text-md-start mb-4 mb-md-0">
|
||||
<h2 class="text-white fw-bold mb-3">随时随地 尽情交易</h2>
|
||||
<p class="text-secondary mb-4">下载 BitCrypto 移动端 App,在手机上获取实时行情、管理资产、极速下单。</p>
|
||||
<div class="d-flex gap-3 justify-content-center justify-content-md-start">
|
||||
<button class="btn btn-outline-light px-4 py-2"><i class="bi bi-apple me-2"></i>App Store</button>
|
||||
<button class="btn btn-outline-light px-4 py-2"><i class="bi bi-google-play me-2"></i>Google Play</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="p-4 h-100 glass-card">
|
||||
<i class="bi bi-lightning-charge display-4 text-warning mb-3"></i>
|
||||
<h4 class="text-white">极速撮合</h4>
|
||||
<p class="text-secondary">自研高性能撮合引擎,支持百万级并发交易,告别卡顿延迟。平均响应时间小于10ms。</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="p-4 h-100 glass-card">
|
||||
<i class="bi bi-headset display-4 text-warning mb-3"></i>
|
||||
<h4 class="text-white">专业支持</h4>
|
||||
<p class="text-secondary">7*24小时多语种在线客服,随时解答您的任何疑问。为您提供保驾护航的交易环境。</p>
|
||||
</div>
|
||||
<div class="col-md-6 text-center">
|
||||
<img src="https://public.bnbstatic.com/image/cms/content/body_mobile_app.png" class="img-fluid" style="max-height: 300px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<style>
|
||||
.floating-img { animation: floating 3s ease-in-out infinite; }
|
||||
@keyframes floating {
|
||||
0% { transform: translateY(0px); }
|
||||
50% { transform: translateY(-20px); }
|
||||
100% { transform: translateY(0px); }
|
||||
}
|
||||
.mt-n5 { margin-top: -3rem !important; }
|
||||
@media (max-width: 768px) {
|
||||
.border-md-0 { border: 0 !important; }
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
function formatPrice(p) {
|
||||
p = parseFloat(p);
|
||||
if (p < 0.0001) return p.toFixed(8);
|
||||
if (p < 0.01) return p.toFixed(6);
|
||||
if (p < 1) return p.toFixed(4);
|
||||
return p.toFixed(2);
|
||||
return p.toLocaleString('en-US', {minimumFractionDigits: 2, maximumFractionDigits: 2});
|
||||
}
|
||||
|
||||
async function loadMarket() {
|
||||
@ -124,28 +140,33 @@ async function loadMarket() {
|
||||
const tbody = document.getElementById('market-tbody');
|
||||
let html = '';
|
||||
|
||||
data.slice(0, 8).forEach(coin => {
|
||||
data.slice(0, 10).forEach(coin => {
|
||||
const changeClass = coin.change >= 0 ? 'text-success' : 'text-danger';
|
||||
const pFormatted = formatPrice(coin.price);
|
||||
|
||||
if (coin.symbol === 'BTCUSDT') {
|
||||
document.getElementById('hero-btc-price').textContent = '$' + pFormatted;
|
||||
}
|
||||
|
||||
html += `
|
||||
<tr style="cursor: pointer;" onclick="location.href='trade.php?symbol=${coin.symbol}'" class="border-bottom border-secondary">
|
||||
<td class="ps-4 py-4">
|
||||
<div class="d-flex align-items-center">
|
||||
<img src="${coin.icon_url}" class="me-3 rounded-circle" style="width:32px; height:32px;" onerror="this.src='https://cryptologos.cc/logos/generic-coin-logo.png'">
|
||||
<div>
|
||||
<div class="fw-bold text-white">${coin.symbol.replace('USDT', '')}</div>
|
||||
<div class="text-secondary small" style="font-size: 11px;">${coin.name}</div>
|
||||
<div class="fw-bold text-white fs-6">${coin.symbol.replace('USDT', '')}</div>
|
||||
<div class="text-secondary smaller" style="font-size: 11px;">${coin.name}</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td><span class="fw-bold fs-5">${pFormatted}</span></td>
|
||||
<td><span class="fw-bold fs-5 text-white">$ ${pFormatted}</span></td>
|
||||
<td><span class="${changeClass} fw-bold">${coin.change >= 0 ? '+' : ''}${coin.change}%</span></td>
|
||||
<td>
|
||||
<div class="smaller text-white">${formatPrice(coin.high || coin.price*1.01)}</div>
|
||||
<div class="smaller text-secondary">${formatPrice(coin.low || coin.price*0.99)}</div>
|
||||
<td class="d-none d-md-table-cell">
|
||||
<div class="text-success small" style="font-size: 11px;">H: ${formatPrice(coin.high || coin.price*1.01)}</div>
|
||||
<div class="text-danger small" style="font-size: 11px;">L: ${formatPrice(coin.low || coin.price*0.99)}</div>
|
||||
</td>
|
||||
<td class="text-end pe-4">
|
||||
<a href="trade.php?symbol=${coin.symbol}" class="btn btn-sm btn-outline-warning px-3 fw-bold">立即交易</a>
|
||||
<a href="trade.php?symbol=${coin.symbol}" class="btn btn-sm btn-warning px-4 fw-bold">交易</a>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
@ -157,7 +178,7 @@ async function loadMarket() {
|
||||
}
|
||||
|
||||
loadMarket();
|
||||
setInterval(loadMarket, 5000);
|
||||
setInterval(loadMarket, 3000);
|
||||
</script>
|
||||
|
||||
<?php include 'footer.php'; ?>
|
||||
<?php include 'footer.php'; ?>
|
||||
137
market.php
137
market.php
@ -2,37 +2,100 @@
|
||||
include 'header.php';
|
||||
?>
|
||||
<div class="container py-5">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<div>
|
||||
<h2 class="text-white fw-bold">行情中心</h2>
|
||||
<p class="text-secondary small">实时监测全球主流数字货币市场价格波动</p>
|
||||
<!-- Market Trends Cards -->
|
||||
<div class="row mb-5 g-4">
|
||||
<div class="col-md-4">
|
||||
<div class="glass-card p-4 h-100" style="background: linear-gradient(135deg, rgba(14, 203, 129, 0.1) 0%, rgba(24, 26, 32, 1) 100%);">
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<h6 class="text-secondary mb-0">今日涨幅榜</h6>
|
||||
<i class="bi bi-graph-up-arrow text-success"></i>
|
||||
</div>
|
||||
<div id="top-gainers">
|
||||
<div class="text-center py-3 text-secondary small">加载中...</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="input-group" style="width: 300px;">
|
||||
<span class="input-group-text bg-dark border-secondary text-secondary"><i class="bi bi-search"></i></span>
|
||||
<input type="text" id="market-search" class="form-control bg-dark text-white border-secondary" placeholder="搜索币种..." onkeyup="filterMarket()">
|
||||
<div class="col-md-4">
|
||||
<div class="glass-card p-4 h-100">
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<h6 class="text-secondary mb-0">新币上架</h6>
|
||||
<i class="bi bi-fire text-warning"></i>
|
||||
</div>
|
||||
<div id="new-listings">
|
||||
<div class="text-center py-3 text-secondary small">加载中...</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="glass-card p-4 h-100">
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<h6 class="text-secondary mb-0">成交热度榜</h6>
|
||||
<i class="bi bi-lightning-fill text-info"></i>
|
||||
</div>
|
||||
<div id="top-volume">
|
||||
<div class="text-center py-3 text-secondary small">加载中...</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="glass-card shadow-lg">
|
||||
<div class="d-flex justify-content-between align-items-end mb-4">
|
||||
<div>
|
||||
<h2 class="text-white fw-bold">行情中心</h2>
|
||||
<p class="text-secondary mb-0">实时监测全球主流数字货币市场价格波动</p>
|
||||
</div>
|
||||
<div class="input-group" style="width: 320px;">
|
||||
<span class="input-group-text bg-dark border-secondary text-secondary"><i class="bi bi-search"></i></span>
|
||||
<input type="text" id="market-search" class="form-control bg-dark text-white border-secondary" placeholder="搜索币种名称 / 简称" onkeyup="filterMarket()">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="glass-card shadow-lg border-secondary-subtle">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-dark table-hover align-middle mb-0">
|
||||
<thead>
|
||||
<tr class="text-secondary border-bottom border-secondary" style="background: #1e2329;">
|
||||
<th class="ps-4 py-3">币种名称</th>
|
||||
<th>最新价格 (USDT)</th>
|
||||
<th>最新价格</th>
|
||||
<th>24h 涨跌</th>
|
||||
<th>24h 最高</th>
|
||||
<th>24h 最低</th>
|
||||
<th>24h 成交额</th>
|
||||
<th>24h 最高/最低</th>
|
||||
<th>24h 成交额(USDT)</th>
|
||||
<th class="text-end pe-4">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="full-market-tbody">
|
||||
<tr><td colspan="7" class="text-center py-5"><div class="spinner-border text-warning"></div></td></tr>
|
||||
<tr><td colspan="6" class="text-center py-5"><div class="spinner-border text-warning"></div></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Crypto News Section (Rich Content Enhancement) -->
|
||||
<div class="mt-5">
|
||||
<h4 class="text-white mb-4"><i class="bi bi-newspaper text-warning me-2"></i> 行业资讯</h4>
|
||||
<div class="row g-4">
|
||||
<div class="col-md-6">
|
||||
<div class="glass-card p-4 h-100 d-flex gap-3 align-items-center">
|
||||
<img src="https://public.bnbstatic.com/image/cms/article/body/202303/34e0e5e0-9e9b-4377-98e6-7b244c767e6c.png" style="width: 120px; border-radius: 8px;" class="d-none d-sm-block">
|
||||
<div>
|
||||
<span class="badge bg-primary mb-2">快讯</span>
|
||||
<h6 class="text-white mb-2">以太坊坎昆升级顺利完成,Layer 2 费用大幅下降</h6>
|
||||
<p class="text-secondary smaller mb-0">此次升级引入了 Proto-Danksharding,为以太坊扩容迈出关键一步...</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="glass-card p-4 h-100 d-flex gap-3 align-items-center">
|
||||
<img src="https://public.bnbstatic.com/image/cms/article/body/202206/a27e7f6d0f8645089f2a2438883907e1.png" style="width: 120px; border-radius: 8px;" class="d-none d-sm-block">
|
||||
<div>
|
||||
<span class="badge bg-warning text-dark mb-2">深度</span>
|
||||
<h6 class="text-white mb-2">比特币减半后市场走势分析:机遇还是挑战?</h6>
|
||||
<p class="text-secondary smaller mb-0">历史数据显示,减半通常伴随着周期的转折,本次减半有何不同...</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
@ -43,7 +106,7 @@ function formatPrice(p) {
|
||||
if (p < 0.0001) return p.toFixed(8);
|
||||
if (p < 0.01) return p.toFixed(6);
|
||||
if (p < 1) return p.toFixed(4);
|
||||
return p.toFixed(2);
|
||||
return p.toLocaleString('en-US', {minimumFractionDigits: 2, maximumFractionDigits: 2});
|
||||
}
|
||||
|
||||
async function refreshMarket() {
|
||||
@ -52,16 +115,44 @@ async function refreshMarket() {
|
||||
const data = await res.json();
|
||||
allMarketData = data;
|
||||
renderMarket();
|
||||
renderTrends();
|
||||
} catch (e) {
|
||||
console.error('Market refresh failed', e);
|
||||
}
|
||||
}
|
||||
|
||||
function renderTrends() {
|
||||
const gainers = [...allMarketData].sort((a, b) => b.change - a.change).slice(0, 3);
|
||||
const volumes = [...allMarketData].sort((a, b) => b.volume - a.volume).slice(0, 3);
|
||||
const news = allMarketData.slice(2, 5);
|
||||
|
||||
document.getElementById('top-gainers').innerHTML = gainers.map(c => `
|
||||
<div class="d-flex justify-content-between mb-2 align-items-center">
|
||||
<span class="text-white small fw-bold">${c.symbol.replace('USDT','')}</span>
|
||||
<span class="text-success small fw-bold">+${c.change}%</span>
|
||||
</div>
|
||||
`).join('');
|
||||
|
||||
document.getElementById('new-listings').innerHTML = news.map(c => `
|
||||
<div class="d-flex justify-content-between mb-2 align-items-center">
|
||||
<span class="text-white small fw-bold">${c.symbol.replace('USDT','')}</span>
|
||||
<span class="text-warning small" style="font-size: 10px;">HOT</span>
|
||||
</div>
|
||||
`).join('');
|
||||
|
||||
document.getElementById('top-volume').innerHTML = volumes.map(c => `
|
||||
<div class="d-flex justify-content-between mb-2 align-items-center">
|
||||
<span class="text-white small fw-bold">${c.symbol.replace('USDT','')}</span>
|
||||
<span class="text-secondary smaller">${(c.volume/1000000).toFixed(1)}M</span>
|
||||
</div>
|
||||
`).join('');
|
||||
}
|
||||
|
||||
function renderMarket() {
|
||||
const search = document.getElementById('market-search').value.toLowerCase();
|
||||
let html = '';
|
||||
allMarketData.forEach(coin => {
|
||||
if (search && !coin.symbol.toLowerCase().includes(search)) return;
|
||||
if (search && !coin.symbol.toLowerCase().includes(search) && !coin.name.toLowerCase().includes(search)) return;
|
||||
|
||||
const changeClass = coin.change >= 0 ? 'text-success' : 'text-danger';
|
||||
const pFormatted = formatPrice(coin.price);
|
||||
@ -70,20 +161,22 @@ function renderMarket() {
|
||||
<tr onclick="location.href='trade.php?symbol=${coin.symbol}'" style="cursor:pointer" class="border-bottom border-secondary">
|
||||
<td class="ps-4 py-3">
|
||||
<div class="d-flex align-items-center">
|
||||
<img src="${coin.icon_url}" class="me-3 rounded-circle" width="32" height="32" onerror="this.src='https://cryptologos.cc/logos/generic-coin-logo.png'">
|
||||
<img src="${coin.icon_url}" class="me-3 rounded-circle" width="28" height="28" onerror="this.src='https://cryptologos.cc/logos/generic-coin-logo.png'">
|
||||
<div>
|
||||
<span class="fw-bold text-white d-block">${coin.symbol.replace('USDT', '')}</span>
|
||||
<span class="text-secondary smaller" style="font-size: 11px;">${coin.name}</span>
|
||||
<span class="text-secondary smaller" style="font-size: 10px;">${coin.name}</span>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="fw-bold fs-5">${pFormatted}</td>
|
||||
<td class="fw-bold fs-6">$ ${pFormatted}</td>
|
||||
<td class="${changeClass} fw-bold">${coin.change >= 0 ? '+' : ''}${coin.change}%</td>
|
||||
<td>${formatPrice(coin.high || coin.price * 1.02)}</td>
|
||||
<td>${formatPrice(coin.low || coin.price * 0.98)}</td>
|
||||
<td class="text-secondary">$ ${parseFloat(coin.volume || 0).toLocaleString()}</td>
|
||||
<td>
|
||||
<div class="text-success" style="font-size: 11px;">H: ${formatPrice(coin.high || coin.price * 1.01)}</div>
|
||||
<div class="text-danger" style="font-size: 11px;">L: ${formatPrice(coin.low || coin.price * 0.99)}</div>
|
||||
</td>
|
||||
<td class="text-secondary smaller">${parseFloat(coin.volume || 0).toLocaleString()}</td>
|
||||
<td class="text-end pe-4">
|
||||
<a href="trade.php?symbol=${coin.symbol}" class="btn btn-sm btn-warning px-3 fw-bold">去交易</a>
|
||||
<a href="trade.php?symbol=${coin.symbol}" class="btn btn-sm btn-outline-warning fw-bold px-3 py-1" style="font-size: 12px;">交易</a>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
|
||||
183
profile.php
183
profile.php
@ -15,88 +15,144 @@ include 'header.php';
|
||||
<div class="container py-5">
|
||||
<div class="row">
|
||||
<!-- User Sidebar -->
|
||||
<div class="col-md-4">
|
||||
<div class="glass-card p-4 bg-dark mb-4">
|
||||
<div class="text-center mb-4">
|
||||
<div class="mb-3">
|
||||
<i class="bi bi-person-circle text-warning" style="font-size: 80px;"></i>
|
||||
</div>
|
||||
<h4 class="text-white mb-1"><?php echo htmlspecialchars($_SESSION['username']); ?></h4>
|
||||
<span class="badge bg-warning text-dark px-3 py-2">UID: <?php echo $account['uid']; ?></span>
|
||||
<div class="col-lg-4">
|
||||
<div class="glass-card p-4 mb-4 text-center">
|
||||
<div class="position-relative d-inline-block mb-3">
|
||||
<i class="bi bi-person-circle text-warning" style="font-size: 80px;"></i>
|
||||
<?php if($account['kyc_status'] == 'VERIFIED'): ?>
|
||||
<span class="position-absolute bottom-0 end-0 bg-success rounded-circle p-1" style="border: 4px solid var(--bg-card);">
|
||||
<i class="bi bi-check-lg text-white" style="font-size: 14px;"></i>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="list-group list-group-flush bg-transparent">
|
||||
<div class="list-group-item bg-transparent text-secondary border-secondary d-flex justify-content-between px-0">
|
||||
<span>信用分</span>
|
||||
<h4 class="text-white mb-1"><?php echo htmlspecialchars($_SESSION['username']); ?></h4>
|
||||
<div class="d-flex justify-content-center gap-2 mb-4">
|
||||
<span class="badge bg-dark border border-secondary text-secondary px-3 py-2">UID: <?php echo $account['uid']; ?></span>
|
||||
<span class="badge bg-<?php echo $account['kyc_status']=='VERIFIED'?'success':'warning'; ?> text-<?php echo $account['kyc_status']=='VERIFIED'?'white':'dark'; ?> px-3 py-2">
|
||||
<?php
|
||||
$kyc_labels = ['UNVERIFIED'=>'未认证', 'PENDING'=>'审核中', 'VERIFIED'=>'已认证', 'REJECTED'=>'已驳回'];
|
||||
echo $kyc_labels[$account['kyc_status']] ?? '未认证';
|
||||
?>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="list-group list-group-flush bg-transparent text-start">
|
||||
<a href="verify.php" class="list-group-item bg-transparent text-secondary border-secondary d-flex justify-content-between px-0 py-3">
|
||||
<span><i class="bi bi-shield-check me-2"></i> 实名认证</span>
|
||||
<span class="<?php echo $account['kyc_status']=='VERIFIED'?'text-success':'text-warning'; ?> small">
|
||||
<?php echo $account['kyc_status'] == 'UNVERIFIED' ? '去认证 <i class="bi bi-chevron-right"></i>' : $kyc_labels[$account['kyc_status']]; ?>
|
||||
</span>
|
||||
</a>
|
||||
<div class="list-group-item bg-transparent text-secondary border-secondary d-flex justify-content-between px-0 py-3">
|
||||
<span><i class="bi bi-star me-2"></i> 信用评分</span>
|
||||
<span class="text-white fw-bold"><?php echo $account['credit_score']; ?></span>
|
||||
</div>
|
||||
<div class="list-group-item bg-transparent text-secondary border-secondary d-flex justify-content-between px-0">
|
||||
<span>实名认证</span>
|
||||
<span class="text-<?php echo $account['kyc_status']=='VERIFIED'?'success':'warning'; ?>"><?php echo $account['kyc_status']; ?></span>
|
||||
</div>
|
||||
<div class="list-group-item bg-transparent text-secondary border-secondary d-flex justify-content-between px-0">
|
||||
<span>注册时间</span>
|
||||
<div class="list-group-item bg-transparent text-secondary border-secondary d-flex justify-content-between px-0 py-3">
|
||||
<span><i class="bi bi-calendar3 me-2"></i> 注册时间</span>
|
||||
<span class="text-white small"><?php echo substr($account['created_at'], 0, 10); ?></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a href="logout.php" class="btn btn-outline-danger w-100 mt-4">安全退出</a>
|
||||
<a href="logout.php" class="btn btn-outline-danger w-100 mt-4 border-0" style="background: rgba(220, 53, 69, 0.1);">安全退出</a>
|
||||
</div>
|
||||
|
||||
<div class="glass-card p-4 mb-4">
|
||||
<h6 class="text-white mb-3">安全中心</h6>
|
||||
<div class="d-flex align-items-center mb-3">
|
||||
<div class="bg-success rounded-circle p-2 me-3" style="width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;">
|
||||
<i class="bi bi-envelope text-white small"></i>
|
||||
</div>
|
||||
<div>
|
||||
<div class="text-white small">绑定邮箱</div>
|
||||
<div class="text-secondary smaller"><?php echo substr($_SESSION['username'], 0, 3); ?>***@gmail.com</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="bg-warning rounded-circle p-2 me-3" style="width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;">
|
||||
<i class="bi bi-phone text-dark small"></i>
|
||||
</div>
|
||||
<div>
|
||||
<div class="text-white small">绑定手机</div>
|
||||
<div class="text-warning smaller" style="cursor: pointer;">未绑定,去绑定 ></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Asset Content -->
|
||||
<div class="col-md-8">
|
||||
<div class="col-lg-8">
|
||||
<!-- Balance Card -->
|
||||
<div class="glass-card p-4 bg-dark mb-4" style="background: linear-gradient(135deg, #2b2f36 0%, #181a20 100%); border: 1px solid #fcd53533;">
|
||||
<div class="glass-card p-4 mb-4" style="background: linear-gradient(135deg, #2b2f36 0%, #181a20 100%); border: 1px solid #fcd53533; box-shadow: 0 10px 30px rgba(0,0,0,0.5);">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-md-7">
|
||||
<div class="text-secondary mb-2 small fw-bold">账户总余额 (估算)</div>
|
||||
<h2 class="text-white fw-bold mb-0">
|
||||
<span class="text-warning">$</span> <?php echo number_format($account['balance'], 2); ?> <span class="fs-5 text-secondary fw-normal">USDT</span>
|
||||
<div class="text-secondary mb-2 small fw-bold">账户总资产 (估算)</div>
|
||||
<h2 class="text-white fw-bold mb-1">
|
||||
<span class="text-warning">$</span> <?php echo number_format($account['balance'] + $account['frozen_balance'], 2); ?> <span class="fs-6 text-secondary fw-normal">USDT</span>
|
||||
</h2>
|
||||
<div class="text-secondary smaller">≈ <?php echo number_format(($account['balance'] + $account['frozen_balance']) * 7.25, 2); ?> CNY</div>
|
||||
</div>
|
||||
<div class="col-md-5 text-md-end mt-3 mt-md-0">
|
||||
<button class="btn btn-warning fw-bold px-4 me-2">充值</button>
|
||||
<button class="btn btn-outline-light fw-bold px-4">提现</button>
|
||||
<a href="deposit.php" class="btn btn-warning fw-bold px-4 me-2">充值</a>
|
||||
<a href="withdraw.php" class="btn btn-outline-light fw-bold px-4">提现</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Asset List -->
|
||||
<div class="glass-card p-4 bg-dark mb-4">
|
||||
<h5 class="text-white mb-4"><i class="bi bi-wallet2 text-warning me-2"></i> 我的资产</h5>
|
||||
<!-- Asset Tabs -->
|
||||
<div class="glass-card p-4 mb-4">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h5 class="text-white mb-0"><i class="bi bi-wallet2 text-warning me-2"></i> 资产概览</h5>
|
||||
<div class="form-check form-switch small">
|
||||
<input class="form-check-input" type="checkbox" id="hideZero">
|
||||
<label class="form-check-label text-secondary" for="hideZero">隐藏 0 余额</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-dark table-hover align-middle">
|
||||
<thead>
|
||||
<tr class="text-secondary small border-bottom border-secondary">
|
||||
<th>币种</th>
|
||||
<th>可用余额</th>
|
||||
<th>冻结金额</th>
|
||||
<th class="text-end">操作</th>
|
||||
<th class="ps-0">币种</th>
|
||||
<th>总额</th>
|
||||
<th>可用</th>
|
||||
<th>冻结</th>
|
||||
<th class="text-end pe-0">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<td class="ps-0">
|
||||
<div class="d-flex align-items-center">
|
||||
<img src="https://cryptologos.cc/logos/tether-usdt-logo.png" width="24" class="me-2">
|
||||
<div class="bg-success rounded-circle me-2 d-flex align-items-center justify-content-center" style="width:28px; height:28px;">
|
||||
<i class="bi bi-currency-dollar text-white"></i>
|
||||
</div>
|
||||
<span class="fw-bold">USDT</span>
|
||||
</div>
|
||||
</td>
|
||||
<td class="fw-bold"><?php echo number_format($account['balance'], 2); ?></td>
|
||||
<td class="text-secondary">0.00</td>
|
||||
<td class="text-end"><a href="trade.php" class="btn btn-sm btn-link text-warning p-0">交易</a></td>
|
||||
<td class="text-white fw-bold"><?php echo number_format($account['balance'] + $account['frozen_balance'], 2); ?></td>
|
||||
<td class="text-white"><?php echo number_format($account['balance'], 2); ?></td>
|
||||
<td class="text-secondary"><?php echo number_format($account['frozen_balance'], 2); ?></td>
|
||||
<td class="text-end pe-0">
|
||||
<a href="trade.php" class="btn btn-sm btn-link text-warning text-decoration-none">交易</a>
|
||||
<a href="withdraw.php" class="btn btn-sm btn-link text-secondary text-decoration-none ms-2">提现</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php foreach ($assets as $asset): if($asset['currency'] == 'USDT') continue; ?>
|
||||
<tr>
|
||||
<td>
|
||||
<td class="ps-0">
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="bg-secondary rounded-circle me-2 d-flex align-items-center justify-content-center fw-bold" style="width:28px; height:28px; font-size: 10px;">
|
||||
<?php echo substr($asset['currency'], 0, 1); ?>
|
||||
</div>
|
||||
<span class="fw-bold"><?php echo $asset['currency']; ?></span>
|
||||
</div>
|
||||
</td>
|
||||
<td class="fw-bold"><?php echo number_format($asset['balance'], 6); ?></td>
|
||||
<td class="text-white fw-bold"><?php echo number_format($asset['balance'] + $asset['frozen'], 6); ?></td>
|
||||
<td class="text-white"><?php echo number_format($asset['balance'], 6); ?></td>
|
||||
<td class="text-secondary"><?php echo number_format($asset['frozen'], 6); ?></td>
|
||||
<td class="text-end"><a href="trade.php?symbol=<?php echo $asset['currency']; ?>USDT" class="btn btn-sm btn-link text-warning p-0">交易</a></td>
|
||||
<td class="text-end pe-0">
|
||||
<a href="trade.php?symbol=<?php echo $asset['currency']; ?>USDT" class="btn btn-sm btn-link text-warning text-decoration-none">交易</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
@ -105,27 +161,49 @@ include 'header.php';
|
||||
</div>
|
||||
|
||||
<!-- Transaction History -->
|
||||
<div class="glass-card p-4 bg-dark">
|
||||
<div class="glass-card p-4">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h5 class="text-white mb-0"><i class="bi bi-clock-history text-warning me-2"></i> 最近充提</h5>
|
||||
<a href="#" class="text-warning small text-decoration-none">查看全部</a>
|
||||
<a href="#" class="text-warning small text-decoration-none">查看更多记录</a>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-dark small">
|
||||
<table class="table table-dark small align-middle">
|
||||
<thead>
|
||||
<tr class="text-secondary border-bottom border-secondary">
|
||||
<th>时间</th>
|
||||
<th>类型</th>
|
||||
<th>金额</th>
|
||||
<th>方式</th>
|
||||
<th class="text-end">状态</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$stmt = db()->prepare("SELECT * FROM transactions WHERE account_id = ? ORDER BY timestamp DESC LIMIT 5");
|
||||
$stmt = db()->prepare("SELECT * FROM transactions WHERE account_id = ? ORDER BY timestamp DESC LIMIT 10");
|
||||
$stmt->execute([$account['id']]);
|
||||
$txs = $stmt->fetchAll();
|
||||
if (empty($txs)):
|
||||
?>
|
||||
<tr><td class="text-center text-secondary py-4">暂无记录</td></tr>
|
||||
<tr><td colspan="5" class="text-center text-secondary py-5">暂无流水记录</td></tr>
|
||||
<?php else: foreach($txs as $tx): ?>
|
||||
<tr>
|
||||
<td><?php echo $tx['timestamp']; ?></td>
|
||||
<td><span class="badge bg-<?php echo $tx['transaction_type']=='deposit'?'success':'danger'; ?>"><?php echo strtoupper($tx['transaction_type']); ?></span></td>
|
||||
<td><?php echo number_format($tx['amount'], 2); ?> <?php echo $tx['currency']; ?></td>
|
||||
<td class="text-end"><?php echo $tx['status']; ?></td>
|
||||
<td class="text-secondary"><?php echo substr($tx['timestamp'], 2, 14); ?></td>
|
||||
<td>
|
||||
<span class="badge bg-<?php echo $tx['transaction_type']=='deposit'?'success-subtle text-success':'danger-subtle text-danger'; ?> border border-<?php echo $tx['transaction_type']=='deposit'?'success':'danger'; ?> px-2 py-1">
|
||||
<?php echo $tx['transaction_type']=='deposit'?'充值':'提现'; ?>
|
||||
</span>
|
||||
</td>
|
||||
<td class="fw-bold"><?php echo number_format($tx['amount'], 2); ?> <span class="smaller fw-normal">USDT</span></td>
|
||||
<td class="text-secondary"><?php echo $tx['pay_method'] ?? 'USDT'; ?></td>
|
||||
<td class="text-end">
|
||||
<?php if($tx['status'] == 'completed'): ?>
|
||||
<span class="text-success"><i class="bi bi-check-circle me-1"></i>已成功</span>
|
||||
<?php elseif($tx['status'] == 'failed'): ?>
|
||||
<span class="text-danger"><i class="bi bi-x-circle me-1"></i>已驳回</span>
|
||||
<?php else: ?>
|
||||
<span class="text-warning"><i class="bi bi-hourglass-split me-1"></i>审核中</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; endif; ?>
|
||||
</tbody>
|
||||
@ -135,4 +213,9 @@ include 'header.php';
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<style>
|
||||
.bg-success-subtle { background-color: rgba(14, 203, 129, 0.1) !important; }
|
||||
.bg-danger-subtle { background-color: rgba(246, 70, 93, 0.1) !important; }
|
||||
.smaller { font-size: 0.75rem; }
|
||||
</style>
|
||||
<?php include 'footer.php'; ?>
|
||||
106
verify.php
Normal file
106
verify.php
Normal file
@ -0,0 +1,106 @@
|
||||
<?php
|
||||
include_once 'config.php';
|
||||
check_auth();
|
||||
|
||||
$user_id = $_SESSION['user_id'];
|
||||
$account = get_account($user_id);
|
||||
$error = '';
|
||||
$success = '';
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$real_name = $_POST['real_name'] ?? '';
|
||||
$id_number = $_POST['id_number'] ?? '';
|
||||
|
||||
// In a real app, we would handle file uploads here.
|
||||
// For this prototype, we'll just save the paths as placeholders.
|
||||
$id_front = 'uploads/kyc/' . $user_id . '_front.jpg';
|
||||
$id_back = 'uploads/kyc/' . $user_id . '_back.jpg';
|
||||
|
||||
if (empty($real_name) || empty($id_number)) {
|
||||
$error = '请填写完整信息';
|
||||
} else {
|
||||
$stmt = db()->prepare("UPDATE accounts SET real_name = ?, id_number = ?, kyc_status = 'PENDING' WHERE id = ?");
|
||||
$stmt->execute([$real_name, $id_number, $account['id']]);
|
||||
$success = '认证资料已提交,请等待审核';
|
||||
$account['kyc_status'] = 'PENDING';
|
||||
}
|
||||
}
|
||||
|
||||
include 'header.php';
|
||||
?>
|
||||
<div class="container py-5">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-6">
|
||||
<div class="glass-card p-4">
|
||||
<h3 class="text-white mb-4"><i class="bi bi-shield-check text-warning me-2"></i> 实名认证 (KYC)</h3>
|
||||
|
||||
<?php if ($success): ?>
|
||||
<div class="alert alert-success"><?php echo $success; ?></div>
|
||||
<div class="text-center py-5">
|
||||
<i class="bi bi-clock-history display-1 text-warning"></i>
|
||||
<p class="mt-3 text-secondary">审核中,通常在 24 小时内完成</p>
|
||||
<a href="profile.php" class="btn btn-warning mt-3">返回个人中心</a>
|
||||
</div>
|
||||
<?php elseif ($account['kyc_status'] === 'VERIFIED'): ?>
|
||||
<div class="text-center py-5">
|
||||
<i class="bi bi-check-circle-fill display-1 text-success"></i>
|
||||
<h4 class="mt-4">您已完成实名认证</h4>
|
||||
<p class="text-secondary">感谢您的信任,您现在可以享受完整交易权限</p>
|
||||
<a href="profile.php" class="btn btn-warning mt-3">返回个人中心</a>
|
||||
</div>
|
||||
<?php elseif ($account['kyc_status'] === 'PENDING'): ?>
|
||||
<div class="text-center py-5">
|
||||
<i class="bi bi-hourglass-split display-1 text-warning"></i>
|
||||
<h4 class="mt-4">认证审核中</h4>
|
||||
<p class="text-secondary">我们正在快马加鞭为您处理,请耐心等待</p>
|
||||
<a href="profile.php" class="btn btn-warning mt-3">返回个人中心</a>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<?php if ($error): ?>
|
||||
<div class="alert alert-danger"><?php echo $error; ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<form method="POST">
|
||||
<div class="mb-3">
|
||||
<label class="form-label text-secondary small">真实姓名</label>
|
||||
<input type="text" name="real_name" class="form-control bg-dark border-secondary text-white" placeholder="请输入您的真实姓名" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label text-secondary small">身份证号 / 护照号</label>
|
||||
<input type="text" name="id_number" class="form-control bg-dark border-secondary text-white" placeholder="请输入证件号码" required>
|
||||
</div>
|
||||
|
||||
<div class="row mb-4">
|
||||
<div class="col-6">
|
||||
<label class="form-label text-secondary small">证件正面</label>
|
||||
<div class="border border-secondary border-dashed rounded p-4 text-center" style="border-style: dashed !important; cursor: pointer;">
|
||||
<i class="bi bi-plus-lg text-secondary"></i>
|
||||
<div class="small text-secondary mt-1">上传正面</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<label class="form-label text-secondary small">证件反面</label>
|
||||
<div class="border border-secondary border-dashed rounded p-4 text-center" style="border-style: dashed !important; cursor: pointer;">
|
||||
<i class="bi bi-plus-lg text-secondary"></i>
|
||||
<div class="small text-secondary mt-1">上传反面</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="p-3 mb-4 rounded" style="background: rgba(252, 213, 53, 0.1); border: 1px solid rgba(252, 213, 53, 0.2);">
|
||||
<div class="d-flex">
|
||||
<i class="bi bi-info-circle text-warning me-2"></i>
|
||||
<div class="small text-secondary">
|
||||
请确保上传的图片清晰可见,文字无遮挡。您的个人信息将受到最高级别的安全保护。
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-warning w-100 fw-bold py-3">提交认证</button>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php include 'footer.php'; ?>
|
||||
Loading…
x
Reference in New Issue
Block a user