diff --git a/admin/chat_iframe.php b/admin/chat_iframe.php index 0a6a3ca..59ec7c0 100644 --- a/admin/chat_iframe.php +++ b/admin/chat_iframe.php @@ -25,36 +25,19 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['action'])) { $name = $_POST['account_name'] ?? ''; $number = $_POST['account_number'] ?? ''; $remarks = $_POST['remarks'] ?? ''; - $info = "🏦 银行名称:$bank\n👤 收款姓名:$name\n💳 收款账号:$number\n📝 备注说明:$remarks"; - $pdo->prepare("UPDATE fiat_orders SET status = 'matched', bank_account_info = ? WHERE id = ?")->execute([$info, $oid]); - - // Send the info as a chat message $pdo->prepare("INSERT INTO messages (user_id, sender, message) VALUES (?, 'admin', ?)")->execute([$user_id, $info]); - - $notif = "✅ 匹配成功!收款账户已下发。请在页面强制弹窗中查看详细信息并进行转账。"; - $pdo->prepare("INSERT INTO messages (user_id, sender, message) VALUES (?, 'admin', ?)")->execute([$user_id, $notif]); + $pdo->prepare("INSERT INTO messages (user_id, sender, message) VALUES (?, 'admin', ?)")->execute([$user_id, "✅ 匹配成功!收款账户已下发。"]); } elseif ($_POST['action'] == 'complete') { - $stmt = $pdo->prepare("SELECT amount, currency, exchange_rate FROM fiat_orders WHERE id = ?"); + $stmt = $pdo->prepare("SELECT amount, currency FROM fiat_orders WHERE id = ?"); $stmt->execute([$oid]); $order = $stmt->fetch(); - $amt = $order['amount']; - $cur = $order['currency']; - - $fiat_rates = get_fiat_rates(); - $real_time_rate = $fiat_rates[$cur] ?? $order['exchange_rate']; - $usdt_amt = ($real_time_rate > 0) ? ($amt / $real_time_rate) : $amt; - - $pdo->prepare("UPDATE users SET balance = balance + ? WHERE id = ?")->execute([$usdt_amt, $user_id]); - $pdo->prepare("UPDATE fiat_orders SET status = 'completed', usdt_amount = ?, exchange_rate = ? WHERE id = ?") - ->execute([$usdt_amt, $real_time_rate, $oid]); - - $notif = "🎉 充值已确认到账!\n金额:" . number_format($amt, 2) . " $cur\n实时汇率:1 USDT = " . number_format($real_time_rate, 4) . " $cur\n入账:" . number_format($usdt_amt, 2) . " USDT"; - $pdo->prepare("INSERT INTO messages (user_id, sender, message) VALUES (?, 'admin', ?)")->execute([$user_id, $notif]); + $pdo->prepare("UPDATE users SET balance = balance + ? WHERE id = ?")->execute([$order['amount'], $user_id]); + $pdo->prepare("UPDATE fiat_orders SET status = 'completed' WHERE id = ?")->execute([$oid]); + $pdo->prepare("INSERT INTO messages (user_id, sender, message) VALUES (?, 'admin', ?)")->execute([$user_id, "🎉 充值已确认到账!"]); } elseif ($_POST['action'] == 'reject') { $pdo->prepare("UPDATE fiat_orders SET status = 'rejected' WHERE id = ?")->execute([$oid]); - $pdo->prepare("INSERT INTO messages (user_id, sender, message) VALUES (?, 'admin', ?)")->execute([$user_id, "❌ 您的充值申请 #$oid 已被拒绝。"]); } } @@ -62,15 +45,9 @@ $user = $pdo->prepare("SELECT * FROM users WHERE id = ?"); $user->execute([$user_id]); $userData = $user->fetch(); -$messages = $pdo->prepare("SELECT * FROM messages WHERE user_id = ? ORDER BY created_at ASC"); -$messages->execute([$user_id]); -$msgs = $messages->fetchAll(); - $orders = $pdo->prepare("SELECT * FROM fiat_orders WHERE user_id = ? AND status IN ('matching', 'submitting', 'matched') ORDER BY id DESC"); $orders->execute([$user_id]); $pending_orders = $orders->fetchAll(); - -$current_rates = get_fiat_rates(); ?> @@ -78,164 +55,117 @@ $current_rates = get_fiat_rates();
-
- - UID: - IP: -
-
-
余额: USDT
-
+ (UID: ) + Balance: USDT
-
- -
-
待处理充值
+
+ +
0) ? ($o['amount'] / $live_rate) : $o['amount']; ?>
-
-
-
-
USDT (汇率: )
-
- - - +
+ +
- - -
+ + - - - - - + + + +
-
- -
-
+
- 查看凭证 - -
-
- - - -
-
- - - -
-
+ View Proof + +
+ + + +
+
+ + + +
- +
- -
- - -
- - -
- -
- -
- - - - - - -
-
+ + +
- +
- \ No newline at end of file diff --git a/admin/kyc.php b/admin/kyc.php index 0a937e9..dc9aad9 100644 --- a/admin/kyc.php +++ b/admin/kyc.php @@ -41,9 +41,20 @@ $pending_kyc_count = count($pending_kyc_list); .tab { padding: 12px 20px; cursor: pointer; font-weight: 600; color: #707a8a; position: relative; } .tab.active { color: var(--primary); } .tab.active::after { content: ''; position: absolute; bottom: -1px; left: 0; right: 0; height: 3px; background: var(--primary); border-radius: 3px 3px 0 0; } + + #detail-modal { position: fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.8); display:none; align-items:center; justify-content:center; z-index:9999; } + .modal-content { background:white; padding:30px; border-radius:12px; max-width:600px; width:90%; } +
+ +
+
-
-

提现申请管理

-
条记录
-
+

提现申请管理

- -
- - + - + - @@ -140,29 +138,33 @@ $pending_kyc = $pdo->query("SELECT COUNT(*) FROM users WHERE kyc_status = 1")->f - - - - + + + + - @@ -172,4 +174,4 @@ $pending_kyc = $pdo->query("SELECT COUNT(*) FROM users WHERE kyc_status = 1")->f - + \ No newline at end of file diff --git a/api/get_messages.php b/api/get_messages.php index 5c784c5..f53d9d7 100644 --- a/api/get_messages.php +++ b/api/get_messages.php @@ -22,21 +22,39 @@ if (isset($_GET['action']) && $_GET['action'] === 'count_unread') { // Support both regular user and admin polling for specific user $user_id = isset($_GET['user_id']) ? $_GET['user_id'] : $_SESSION['user_id']; +// If fetch_all is provided, return all messages for this user +if (isset($_GET['fetch_all'])) { + $stmt = $pdo->prepare("SELECT * FROM messages WHERE user_id = ? ORDER BY id ASC"); + $stmt->execute([$user_id]); + $msgs = $stmt->fetchAll(PDO::FETCH_ASSOC); + echo json_encode(['success' => true, 'data' => $msgs]); + exit; +} + // If last_id is provided, return new messages since then if (isset($_GET['last_id'])) { $last_id = (int)$_GET['last_id']; $stmt = $pdo->prepare("SELECT * FROM messages WHERE user_id = ? AND id > ? ORDER BY id ASC"); $stmt->execute([$user_id, $last_id]); $msgs = $stmt->fetchAll(PDO::FETCH_ASSOC); - echo json_encode(['data' => $msgs]); + echo json_encode(['success' => true, 'data' => $msgs]); exit; } -// Default action: return count and last_id +// Default action: return count and last_id, and if requested, full data $stmt = $pdo->prepare("SELECT COUNT(*), MAX(id) FROM messages WHERE user_id = ?"); $stmt->execute([$user_id]); $res = $stmt->fetch(); $count = $res[0]; $last_id = $res[1]; -echo json_encode(['count' => (int)$count, 'last_id' => (int)$last_id]); \ No newline at end of file +$stmt = $pdo->prepare("SELECT * FROM messages WHERE user_id = ? ORDER BY id DESC LIMIT 20"); +$stmt->execute([$user_id]); +$msgs = $stmt->fetchAll(PDO::FETCH_ASSOC); + +echo json_encode([ + 'success' => true, + 'count' => (int)$count, + 'last_id' => (int)$last_id, + 'data' => $msgs +]); \ No newline at end of file diff --git a/api/place_option_order.php b/api/place_option_order.php index 006b1cc..7efa3aa 100644 --- a/api/place_option_order.php +++ b/api/place_option_order.php @@ -20,11 +20,11 @@ $opening_price = (float)($data['opening_price'] ?? 0); // Updated Validate duration and profit rates as per user request // 60s/8%、90s/12%、120s/15%、180s/20%、300s/32% $valid_durations = [ - 60 => ['profit' => 0.08, 'min' => 10], - 90 => ['profit' => 0.12, 'min' => 10], - 120 => ['profit' => 0.15, 'min' => 10], - 180 => ['profit' => 0.20, 'min' => 10], - 300 => ['profit' => 0.32, 'min' => 10], + 60 => ['profit' => 0.08, 'min' => 100], + 90 => ['profit' => 0.12, 'min' => 5000], + 120 => ['profit' => 0.15, 'min' => 30000], + 180 => ['profit' => 0.20, 'min' => 100000], + 300 => ['profit' => 0.32, 'min' => 300000], ]; if (!isset($valid_durations[$duration])) { @@ -36,7 +36,7 @@ $profit_rate = $valid_durations[$duration]['profit']; $min_amount = $valid_durations[$duration]['min']; if ($amount < $min_amount) { - echo json_encode(['success' => false, 'error' => "Minimum amount is {$min_amount} USDT"]); + echo json_encode(['success' => false, 'error' => "Minimum amount for {$duration}S is {$min_amount} USDT"]); exit; } @@ -65,4 +65,4 @@ try { } catch (Exception $e) { $db->rollBack(); echo json_encode(['success' => false, 'error' => $e->getMessage()]); -} \ No newline at end of file +} diff --git a/assets/pasted-20260213-072223-7880d61d.png b/assets/pasted-20260213-072223-7880d61d.png new file mode 100644 index 0000000..08320d8 Binary files /dev/null and b/assets/pasted-20260213-072223-7880d61d.png differ diff --git a/chat.php b/chat.php index acf8018..7ebbfba 100644 --- a/chat.php +++ b/chat.php @@ -8,12 +8,6 @@ if (!isset($_SESSION['user_id'])) { $user_id = $_SESSION['user_id']; $pdo = db(); -// Check for active recharge order to force stay -$stmt = $pdo->prepare("SELECT id, status, bank_account_info, proof_image FROM fiat_orders WHERE user_id = ? AND status IN ('matching', 'matched', 'submitting') ORDER BY id DESC LIMIT 1"); -$stmt->execute([$user_id]); -$active_recharge = $stmt->fetch(); -$is_forced = !!$active_recharge; - // Fetch user info $stmt = $pdo->prepare("SELECT uid, username FROM users WHERE id = ?"); $stmt->execute([$user_id]); @@ -28,51 +22,28 @@ if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { // Fetch greeting message $stmt = $pdo->prepare("SELECT value FROM settings WHERE name = 'chat_greeting'"); $stmt->execute(); -$greeting = $stmt->fetchColumn() ?: '您好!欢迎咨询 NovaEx 官方客服,请问有什么可以帮您?'; +$greeting = $stmt->fetchColumn() ?: 'Hello! Welcome to NovaEx official support. How can we help you today?'; -// Fetch messages -$stmt = $pdo->prepare("SELECT * FROM messages WHERE user_id = ? ORDER BY created_at ASC"); -$stmt->execute([$user_id]); -$messages = $stmt->fetchAll(); - -// Mark admin messages as read -$stmt = $pdo->prepare("UPDATE messages SET is_read = 1 WHERE user_id = ? AND sender = 'admin'"); -$stmt->execute([$user_id]); +// Handle POST request via AJAX +if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['message'])) { + $msg = trim($_POST['message']); + if ($msg !== '') { + $stmt = $pdo->prepare("INSERT INTO messages (user_id, sender, message) VALUES (?, 'user', ?)"); + $stmt->execute([$user_id, $msg]); + echo json_encode(['success' => true]); + } + exit; +} ?>
@@ -84,9 +55,9 @@ $stmt->execute([$user_id]);
-

NovaEx 官方客服

+

NovaEx Support

- 在线 (Online) + Online
@@ -97,197 +68,97 @@ $stmt->execute([$user_id]); -
- - -
-
- -
- 系统消息 -
- - -
-
- - - - - -
- -
- +
+ +
Connecting to support...
- -
-
- 已匹配账户,请在转账后上传凭证并点击确认完成。 -
- -
- -
-
- - -
+ + - + - - - - - -
- 凭证已上传,等待客服审核... -
- -
-
- - - -
-
\ No newline at end of file diff --git a/chat_iframe.php b/chat_iframe.php index 9c85eb6..d417f8d 100644 --- a/chat_iframe.php +++ b/chat_iframe.php @@ -9,7 +9,6 @@ if (!isset($_SESSION['user_id'])) { $user_id = $_SESSION['user_id']; $db = db(); -// Handle message sending via AJAX if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['message'])) { $msg = trim($_POST['message']); if ($msg !== '') { @@ -19,11 +18,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['message'])) { } exit; } - -// Fetch messages for initial load -$stmt = $db->prepare("SELECT * FROM messages WHERE user_id = ? ORDER BY created_at ASC"); -$stmt->execute([$user_id]); -$messages = $stmt->fetchAll(); ?> @@ -31,28 +25,20 @@ $messages = $stmt->fetchAll(); -
- -
- - -
- -
+
@@ -61,39 +47,42 @@ $messages = $stmt->fetchAll(); - - + \ No newline at end of file diff --git a/footer.php b/footer.php index 4649981..0111540 100644 --- a/footer.php +++ b/footer.php @@ -58,7 +58,7 @@
ID用户 (UID)用户 金额 币种提现详情详情 状态申请时间 操作
#
UID:
() -
- +
+ + + + + +
- +
-
+ - - + +
- 已处理 + --
- - -
-
-
+
+
--
+
--
- - -
-
- Price / Amount -
-
-
--
-
+
+ H: --L: --V: --
-