- | ID |
+ 编号 |
用户信息 |
金额 |
支付信息/详情 |
@@ -161,9 +173,24 @@ $requests = $stmt->fetchAll();
= htmlspecialchars($r['uid'] ?? '---') ?>
+ 0 && $r['fiat_currency']) {
+ require_once __DIR__ . '/../includes/exchange.php';
+ $current_rate = get_rate($r['fiat_currency']);
+ if ($current_rate > 0) {
+ $display_amount = $r['fiat_amount'] / $current_rate;
+ $is_recalculated = true;
+ }
+ }
+ ?>
- = $r['type'] === 'recharge' ? '+' : '-' ?> = number_format($r['amount'], 2) ?> = $r['symbol'] ?>
+ = $r['type'] === 'recharge' ? '+' : '-' ?> = number_format($display_amount, 2) ?> = $r['symbol'] ?>
+
+
+
≈ = number_format($r['fiat_amount'], 2) ?> = $r['fiat_currency'] ?>
diff --git a/admin/index.php b/admin/index.php
index 5d80320..619bc4b 100644
--- a/admin/index.php
+++ b/admin/index.php
@@ -66,7 +66,7 @@ ob_start();
- | UID |
+ 用户ID |
金额 |
时间 |
操作 |
diff --git a/admin/mining.php b/admin/mining.php
index 51b7990..6311e3d 100644
--- a/admin/mining.php
+++ b/admin/mining.php
@@ -16,7 +16,7 @@ $records = $db->query("SELECT r.*, u.username, u.uid FROM staking_records r JOIN
- | ID |
+ 编号 |
= __('users') ?> |
= __('mining_pool') ?> |
= __('amount') ?> |
diff --git a/admin/transactions.php b/admin/transactions.php
index e6bca2e..aed0eeb 100644
--- a/admin/transactions.php
+++ b/admin/transactions.php
@@ -40,13 +40,18 @@ $transactions = $stmt->fetchAll();
$types = [
'recharge' => '充值',
+ 'deposit' => '充值',
'withdrawal' => '提现',
+ 'mining_profit' => '矿机收益',
'binary_win' => '秒合约盈利',
'binary_loss' => '秒合约亏损',
'contract_profit' => '合约盈利',
'contract_loss' => '合约亏损',
+ 'contract_margin' => '合约保证金',
+ 'contract_settle' => '合约结算',
'spot_buy' => '币币买入',
- 'spot_sell' => '币币卖出'
+ 'spot_sell' => '币币卖出',
+ 'swap' => '闪兑'
];
?>
@@ -69,7 +74,7 @@ $types = [
- | ID |
+ 编号 |
用户信息 |
类型 |
币种 |
diff --git a/admin/users.php b/admin/users.php
index eb23cf2..840c8d3 100644
--- a/admin/users.php
+++ b/admin/users.php
@@ -178,7 +178,7 @@ ob_start();
- | UID |
+ 用户ID |
用户名 / VIP |
所属代理 |
注册IP / 实时IP |
diff --git a/api/admin_recharge.php b/api/admin_recharge.php
index f3aa5bc..380e26e 100644
--- a/api/admin_recharge.php
+++ b/api/admin_recharge.php
@@ -22,7 +22,7 @@ try {
$db = db();
// Find the latest pending/matching recharge for this user
- $stmt = $db->prepare("SELECT id FROM finance_requests WHERE user_id = ? AND type = 'recharge' AND status IN ('0', '1') ORDER BY created_at DESC LIMIT 1");
+ $stmt = $db->prepare("SELECT id FROM finance_requests WHERE user_id = ? AND type = 'recharge' AND status IN ('pending', 'matched') ORDER BY created_at DESC LIMIT 1");
$stmt->execute([$user_id]);
$order_id = $stmt->fetchColumn();
@@ -38,10 +38,10 @@ try {
$amount = isset($_POST['amount']) ? (float)$_POST['amount'] : null;
if ($amount !== null) {
- $stmt = $db->prepare("UPDATE finance_requests SET status = 1, account_bank = ?, account_name = ?, account_number = ?, amount = ? WHERE id = ?");
+ $stmt = $db->prepare("UPDATE finance_requests SET status = 'matched', account_bank = ?, account_name = ?, account_number = ?, amount = ? WHERE id = ?");
$stmt->execute([$bank, $name, $account, $amount, $order_id]);
} else {
- $stmt = $db->prepare("UPDATE finance_requests SET status = 1, account_bank = ?, account_name = ?, account_number = ? WHERE id = ?");
+ $stmt = $db->prepare("UPDATE finance_requests SET status = 'matched', account_bank = ?, account_name = ?, account_number = ? WHERE id = ?");
$stmt->execute([$bank, $name, $account, $order_id]);
}
echo json_encode(['success' => true]);
@@ -54,14 +54,14 @@ try {
if ($bank && $name && $account) {
if ($amount !== null) {
- $stmt = $db->prepare("UPDATE finance_requests SET status = 2, account_bank = ?, account_name = ?, account_number = ?, amount = ? WHERE id = ?");
+ $stmt = $db->prepare("UPDATE finance_requests SET status = 'account_sent', account_bank = ?, account_name = ?, account_number = ?, amount = ? WHERE id = ?");
$stmt->execute([$bank, $name, $account, $amount, $order_id]);
} else {
- $stmt = $db->prepare("UPDATE finance_requests SET status = 2, account_bank = ?, account_name = ?, account_number = ? WHERE id = ?");
+ $stmt = $db->prepare("UPDATE finance_requests SET status = 'account_sent', account_bank = ?, account_name = ?, account_number = ? WHERE id = ?");
$stmt->execute([$bank, $name, $account, $order_id]);
}
} else {
- $stmt = $db->prepare("UPDATE finance_requests SET status = 2 WHERE id = ?");
+ $stmt = $db->prepare("UPDATE finance_requests SET status = 'account_sent' WHERE id = ?");
$stmt->execute([$order_id]);
}
echo json_encode(['success' => true]);
diff --git a/api/finance.php b/api/finance.php
index cd51b6b..ad2e010 100644
--- a/api/finance.php
+++ b/api/finance.php
@@ -166,7 +166,7 @@ if ($action === 'recharge') {
exit;
}
- $stmt = $db->prepare("INSERT INTO finance_requests (user_id, type, amount, symbol, payment_method, tx_hash, fiat_amount, fiat_currency, status, ip_address) VALUES (?, 'recharge', ?, ?, ?, ?, ?, ?, '0', ?)");
+ $stmt = $db->prepare("INSERT INTO finance_requests (user_id, type, amount, symbol, payment_method, tx_hash, fiat_amount, fiat_currency, status, ip_address) VALUES (?, 'recharge', ?, ?, ?, ?, ?, ?, 'pending', ?)");
$stmt->execute([$user_id, $amount, $symbol, $method, $tx_hash, $fiat_amount, $fiat_currency, getRealIP()]);
echo json_encode(['success' => true, 'id' => $db->lastInsertId()]);
@@ -180,7 +180,7 @@ if ($action === 'complete_transfer') {
exit;
}
- $stmt = $db->prepare("UPDATE finance_requests SET status = 3 WHERE id = ? AND user_id = ?");
+ $stmt = $db->prepare("UPDATE finance_requests SET status = 'finished' WHERE id = ? AND user_id = ?");
$stmt->execute([$order_id, $user_id]);
echo json_encode(['success' => true]);
diff --git a/api/recharge_status.php b/api/recharge_status.php
index 0d51ba2..e6c10ec 100644
--- a/api/recharge_status.php
+++ b/api/recharge_status.php
@@ -30,7 +30,7 @@ try {
echo json_encode([
'success' => true,
- 'status' => (int)$order['status'],
+ 'status' => $order['status'],
'account_bank' => $order['account_bank'],
'account_number' => $order['account_number'],
'account_name' => $order['account_name'],
diff --git a/assets/pasted-20260221-135325-cae0a88a.png b/assets/pasted-20260221-135325-cae0a88a.png
new file mode 100644
index 0000000..cdf436f
Binary files /dev/null and b/assets/pasted-20260221-135325-cae0a88a.png differ
diff --git a/assets/pasted-20260221-135944-2e145fa5.png b/assets/pasted-20260221-135944-2e145fa5.png
new file mode 100644
index 0000000..5a25b2f
Binary files /dev/null and b/assets/pasted-20260221-135944-2e145fa5.png differ
diff --git a/assets/pasted-20260221-140828-9e5019bc.png b/assets/pasted-20260221-140828-9e5019bc.png
new file mode 100644
index 0000000..856aa29
Binary files /dev/null and b/assets/pasted-20260221-140828-9e5019bc.png differ
diff --git a/assets/pasted-20260221-141514-517d3eaa.png b/assets/pasted-20260221-141514-517d3eaa.png
new file mode 100644
index 0000000..dc6fd4c
Binary files /dev/null and b/assets/pasted-20260221-141514-517d3eaa.png differ
diff --git a/assets/pasted-20260221-142814-663633de.png b/assets/pasted-20260221-142814-663633de.png
new file mode 100644
index 0000000..fb1c572
Binary files /dev/null and b/assets/pasted-20260221-142814-663633de.png differ
diff --git a/db/exchange_rates.json b/db/exchange_rates.json
index 13e16cc..52cbb01 100644
--- a/db/exchange_rates.json
+++ b/db/exchange_rates.json
@@ -1 +1 @@
-{"USD":1,"AED":3.67,"AFN":62.91,"ALL":81.77,"AMD":376.96,"ANG":1.79,"AOA":921.54,"ARS":1452.25,"AUD":1.41,"AWG":1.79,"AZN":1.7,"BAM":1.66,"BBD":2,"BDT":122.24,"BGN":1.61,"BHD":0.376,"BIF":2972.8,"BMD":1,"BND":1.27,"BOB":6.94,"BRL":5.21,"BSD":1,"BTN":90.95,"BWP":13.63,"BYN":2.86,"BZD":2,"CAD":1.37,"CDF":2280.68,"CHF":0.776,"CLF":0.0219,"CLP":864.48,"CNH":6.9,"CNY":6.92,"COP":3676.38,"CRC":482.12,"CUP":24,"CVE":93.62,"CZK":20.58,"DJF":177.72,"DKK":6.34,"DOP":61.68,"DZD":130.05,"EGP":47.54,"ERN":15,"ETB":154.9,"EUR":0.849,"FJD":2.2,"FKP":0.742,"FOK":6.34,"GBP":0.742,"GEL":2.68,"GGP":0.742,"GHS":10.97,"GIP":0.742,"GMD":74.12,"GNF":8765.19,"GTQ":7.68,"GYD":209.23,"HKD":7.81,"HNL":26.5,"HRK":6.4,"HTG":131.33,"HUF":322.52,"IDR":16879.29,"ILS":3.12,"IMP":0.742,"INR":90.96,"IQD":1310.75,"IRR":1284718.39,"ISK":123.11,"JEP":0.742,"JMD":156.06,"JOD":0.709,"JPY":155.09,"KES":128.97,"KGS":87.44,"KHR":4018.25,"KID":1.41,"KMF":417.69,"KRW":1447.74,"KWD":0.307,"KYD":0.833,"KZT":492.41,"LAK":21645.16,"LBP":89500,"LKR":309.31,"LRD":185.93,"LSL":16.07,"LYD":6.31,"MAD":9.17,"MDL":17.09,"MGA":4323.12,"MKD":52.41,"MMK":2105.62,"MNT":3537.8,"MOP":8.05,"MRU":40.01,"MUR":46.31,"MVR":15.46,"MWK":1745.39,"MXN":17.17,"MYR":3.9,"MZN":63.57,"NAD":16.07,"NGN":1346.36,"NIO":36.87,"NOK":9.54,"NPR":145.52,"NZD":1.67,"OMR":0.384,"PAB":1,"PEN":3.36,"PGK":4.33,"PHP":58.08,"PKR":279.85,"PLN":3.58,"PYG":6535.86,"QAR":3.64,"RON":4.33,"RSD":99.71,"RUB":76.83,"RWF":1462.18,"SAR":3.75,"SBD":7.96,"SCR":13.84,"SDG":510.48,"SEK":9.06,"SGD":1.27,"SHP":0.742,"SLE":24.46,"SLL":24455.37,"SOS":570.82,"SRD":37.72,"SSP":4583.75,"STN":20.8,"SYP":114.12,"SZL":16.07,"THB":31.18,"TJS":9.39,"TMT":3.5,"TND":2.87,"TOP":2.36,"TRY":43.85,"TTD":6.74,"TVD":1.41,"TWD":31.54,"TZS":2579.03,"UAH":43.3,"UGX":3568.92,"UYU":38.81,"UZS":12205.78,"VES":405.35,"VND":25927.65,"VUV":118.68,"WST":2.69,"XAF":556.92,"XCD":2.7,"XCG":1.79,"XDR":0.727,"XOF":556.92,"XPF":101.32,"YER":238.65,"ZAR":16.07,"ZMW":18.82,"ZWG":25.54,"ZWL":25.54}
\ No newline at end of file
+{"USD":1,"AED":3.67,"AFN":62.91,"ALL":81.77,"AMD":376.96,"ANG":1.79,"AOA":921.54,"ARS":1452.25,"AUD":1.41,"AWG":1.79,"AZN":1.7,"BAM":1.66,"BBD":2,"BDT":122.24,"BGN":1.61,"BHD":0.376,"BIF":2972.8,"BMD":1,"BND":1.27,"BOB":6.94,"BRL":5.21,"BSD":1,"BTN":90.95,"BWP":13.63,"BYN":2.86,"BZD":2,"CAD":1.37,"CDF":2280.68,"CHF":0.776,"CLF":0.0219,"CLP":864.48,"CNH":6.9,"CNY":7.25,"COP":3676.38,"CRC":482.12,"CUP":24,"CVE":93.62,"CZK":20.58,"DJF":177.72,"DKK":6.34,"DOP":61.68,"DZD":130.05,"EGP":47.54,"ERN":15,"ETB":154.9,"EUR":0.95,"FJD":2.2,"FKP":0.742,"FOK":6.34,"GBP":0.742,"GEL":2.68,"GGP":0.742,"GHS":10.97,"GIP":0.742,"GMD":74.12,"GNF":8765.19,"GTQ":7.68,"GYD":209.23,"HKD":7.81,"HNL":26.5,"HRK":6.4,"HTG":131.33,"HUF":322.52,"IDR":16879.29,"ILS":3.12,"IMP":0.742,"INR":90.96,"IQD":1310.75,"IRR":1284718.39,"ISK":123.11,"JEP":0.742,"JMD":156.06,"JOD":0.709,"JPY":155.09,"KES":128.97,"KGS":87.44,"KHR":4018.25,"KID":1.41,"KMF":417.69,"KRW":1447.74,"KWD":0.307,"KYD":0.833,"KZT":492.41,"LAK":21645.16,"LBP":89500,"LKR":309.31,"LRD":185.93,"LSL":16.07,"LYD":6.31,"MAD":9.17,"MDL":17.09,"MGA":4323.12,"MKD":52.41,"MMK":2105.62,"MNT":3537.8,"MOP":8.05,"MRU":40.01,"MUR":46.31,"MVR":15.46,"MWK":1745.39,"MXN":17.17,"MYR":4.45,"MZN":63.57,"NAD":16.07,"NGN":1346.36,"NIO":36.87,"NOK":9.54,"NPR":145.52,"NZD":1.67,"OMR":0.384,"PAB":1,"PEN":3.36,"PGK":4.33,"PHP":58.08,"PKR":279.85,"PLN":3.58,"PYG":6535.86,"QAR":3.64,"RON":4.33,"RSD":99.71,"RUB":76.83,"RWF":1462.18,"SAR":3.75,"SBD":7.96,"SCR":13.84,"SDG":510.48,"SEK":9.06,"SGD":1.27,"SHP":0.742,"SLE":24.46,"SLL":24455.37,"SOS":570.82,"SRD":37.72,"SSP":4583.75,"STN":20.8,"SYP":114.12,"SZL":16.07,"THB":31.18,"TJS":9.39,"TMT":3.5,"TND":2.87,"TOP":2.36,"TRY":43.85,"TTD":6.74,"TVD":1.41,"TWD":31.54,"TZS":2579.03,"UAH":43.3,"UGX":3568.92,"UYU":38.81,"UZS":12205.78,"VES":405.35,"VND":25927.65,"VUV":118.68,"WST":2.69,"XAF":556.92,"XCD":2.7,"XCG":1.79,"XDR":0.727,"XOF":556.92,"XPF":101.32,"YER":238.65,"ZAR":16.07,"ZMW":18.82,"ZWG":25.54,"ZWL":25.54}
\ No newline at end of file
diff --git a/includes/exchange.php b/includes/exchange.php
index e61abc9..85831f8 100644
--- a/includes/exchange.php
+++ b/includes/exchange.php
@@ -5,13 +5,19 @@
*/
function get_exchange_rates() {
+ if (!function_exists('db')) {
+ require_once __DIR__ . '/../db/config.php';
+ }
$cache_file = __DIR__ . '/../db/exchange_rates.json';
- $cache_time = 3600; // Cache for 1 hour
+ $cache_time = 300; // Cache for 5 minutes for better precision
+ // Try to load from cache first
if (file_exists($cache_file) && (time() - filemtime($cache_file) < $cache_time)) {
return json_decode(file_get_contents($cache_file), true);
}
+ $rates = null;
+
// Use a free public API
$api_url = 'https://api.exchangerate-api.com/v4/latest/USD';
$ch = curl_init();
@@ -24,24 +30,64 @@ function get_exchange_rates() {
if ($response) {
$data = json_decode($response, true);
if ($data && isset($data['rates'])) {
- // We want rates relative to USD (which is 1:1 with USDT for this purpose)
$rates = $data['rates'];
- file_put_contents($cache_file, json_encode($rates));
- return $rates;
}
}
- // Fallback rates if API fails
- return [
- 'USD' => 1,
- 'EUR' => 0.92,
- 'GBP' => 0.79,
+ // Fallback rates if API fails or returns incomplete data
+ // These are base values, but the API will overwrite them if successful
+ $fallbacks = [
+ 'USD' => 1.0,
+ 'EUR' => 0.95,
+ 'GBP' => 0.78,
'CNY' => 7.23,
- 'JPY' => 150.1,
+ 'JPY' => 150.0,
'HKD' => 7.82,
- 'TWD' => 31.6,
- 'KRW' => 1332.0
+ 'TWD' => 31.5,
+ 'KRW' => 1380.0,
+ 'MYR' => 4.45,
+ 'THB' => 35.5,
+ 'VND' => 25400.0,
+ 'SGD' => 1.34,
+ 'PHP' => 57.5,
+ 'IDR' => 16200.0,
+ 'AUD' => 1.52,
+ 'CAD' => 1.37,
+ 'CHF' => 0.88,
+ 'BRL' => 5.15,
+ 'RUB' => 92.0,
+ 'INR' => 83.5,
+ 'TRY' => 32.5,
+ 'AED' => 3.67,
];
+
+ if (!$rates) {
+ $rates = $fallbacks;
+ } else {
+ // Merge with fallbacks to ensure all required currencies exist
+ foreach ($fallbacks as $code => $rate) {
+ if (!isset($rates[$code])) {
+ $rates[$code] = $rate;
+ }
+ }
+ }
+
+ // Apply manual overrides from database (e.g., rate_MYR = 4.5)
+ try {
+ $stmt = db()->query("SELECT setting_key, setting_value FROM system_settings WHERE setting_key LIKE 'rate_%'");
+ $overrides = $stmt->fetchAll(PDO::FETCH_KEY_PAIR);
+ foreach ($overrides as $key => $val) {
+ $currency = strtoupper(str_replace('rate_', '', $key));
+ if ($val > 0) {
+ $rates[$currency] = (float)$val;
+ }
+ }
+ } catch (Exception $e) {
+ // Ignore DB errors during rate fetching
+ }
+
+ file_put_contents($cache_file, json_encode($rates));
+ return $rates;
}
function get_rate($currency) {
diff --git a/recharge.php b/recharge.php
index 77dd668..1703867 100644
--- a/recharge.php
+++ b/recharge.php
@@ -554,7 +554,7 @@ function openRechargeModal(initialMessage, isRestore = false, orderId = null) {
if (!isRestore) {
remainingSeconds = 1800;
saveRechargeState({ phase: 'pending', initialMessage, orderId: currentOrderId });
- sendModalMessage(initialMessage); // Automatically notify admin via chat
+ sendModalMessage(initialMessage); // Automatically notify admin about the new recharge request
}
if (currentOrderId) startStatusPolling(currentOrderId);
@@ -573,7 +573,7 @@ function openRechargeModal(initialMessage, isRestore = false, orderId = null) {
if (--remainingSeconds < 0) clearInterval(rechargeCountdownInterval);
}, 1000);
- if (!isRestore) renderRechargeUI({ status: 0 });
+ if (!isRestore) renderRechargeUI({ status: 'pending' });
initModalChat();
}
@@ -588,7 +588,7 @@ function startStatusPolling(orderId) {
if (data.success) {
console.log('Order status update:', data.status, data);
renderRechargeUI(data);
- if (parseInt(data.status) === 3) clearInterval(window.statusPollingInterval);
+ if (data.status === 'finished') clearInterval(window.statusPollingInterval);
}
} catch (e) { console.error('Status polling error:', e); }
};
@@ -599,18 +599,18 @@ function startStatusPolling(orderId) {
function renderRechargeUI(data) {
const side = document.querySelector('.info-side');
if (!side) return;
- const status = parseInt(data.status);
- if (status === 3) { finishTransferUI(); return; }
+ const status = data.status;
+ if (status === 'finished') { finishTransferUI(); return; }
- if (status === 0) {
+ if (status === 'pending') {
side.innerHTML = `
- = __('waiting_allocation') ?>
+ 正在为您匹配充值账户
- = __('matching_account') ?>
- = __('matching_desc') ?>
+ 正在为您匹配充值账户
+ 系统正在为您分配专属收款账户,请耐心等待。 匹配成功后,页面将自动更新收款信息。 请勿关闭当前页面。
@@ -627,18 +627,18 @@ function renderRechargeUI(data) {
= __('recharge_instruction_2') ?>
= __('recharge_instruction_3') ?>
-
+
`;
- } else if (status === 1) {
+ } else if (status === 'matched') {
side.innerHTML = `
- = __("matched_successfully") ?>
+ 匹配成功
- = __("matched_successfully") ?>
- = __("matched_desc_short") ?>
+ 匹配成功
+ 您的充值订单已匹配成功。 客服正在为您发送收款账户信息,请稍候。 页面将自动显示收款账户,请勿刷新或关闭页面。
@@ -650,18 +650,18 @@ function renderRechargeUI(data) {
= __('security_tips') ?>
-
+
`;
- } else if (status === 2) {
+ } else if (status === 'account_sent') {
const bank = data.account_bank || '---';
const account = data.account_number || '---';
const name = data.account_name || '---';
side.innerHTML = `
- = __("matched_successfully") ?>
- = __("recharge_final_title") ?>
+ 匹配成功
+ 请按照以下账户信息进行转账
@@ -700,8 +700,8 @@ function renderRechargeUI(data) {
- = __("recharge_final_notice") ?>
-
+ 请严格按照页面展示的收款账户信息进行转账。 请勿分笔转账或修改信息,转账完成后,请点击“完成转账”按钮。 转账完成后请提交转账凭证给在线客服,方便第一时间为你确认到账。
+
`;
}
@@ -724,7 +724,9 @@ document.addEventListener('DOMContentLoaded', async () => {
try {
const r = await fetch(`/api/recharge_status.php?id=${state.orderId}&_t=${Date.now()}`);
const data = await r.json();
- if (data.success) renderRechargeUI(data);
+ if (data.success) {
+ renderRechargeUI(data);
+ }
} catch (e) {}
} else { localStorage.removeItem('recharge_state'); }
}
|