diff --git a/admin/customer_service.php b/admin/customer_service.php index 9dbfd45..9272e2c 100644 --- a/admin/customer_service.php +++ b/admin/customer_service.php @@ -633,7 +633,7 @@ async function notifyMatchSuccess() { const r = await fetch('/api/admin_recharge.php?action=match_success', { method: 'POST', body: fd }); const res = await r.json(); if (res.success) { - alert('匹配成功状态已更新'); + alert('匹配成功!状态已更新为“匹配中”。若要向用户显示收款账户,请继续点击“发送账户”按钮。'); } else { alert('错误: ' + res.error); } @@ -647,33 +647,25 @@ async function sendPaymentInfo() { const account = document.getElementById('pay-account').value.trim(); const amount = document.getElementById('pay-amount').value.trim(); - if (!bank || !name || !account || !amount) { + if (!bank || !name || !account) { alert('请完整填写收款信息'); return; } - // First save the info (match success) then send it (status 2) const fd = new URLSearchParams(); fd.append('user_id', selectedUser); fd.append('bank', bank); fd.append('name', name); fd.append('account', account); - fd.append('amount', amount); + if (amount) fd.append('amount', amount); try { - // Step 1: Save info and set status 1 - let r = await fetch('/api/admin_recharge.php?action=match_success', { method: 'POST', body: fd }); - let res = await r.json(); - if (!res.success) { - alert('保存信息失败: ' + res.error); - return; - } - - // Step 2: Set status 2 - r = await fetch('/api/admin_recharge.php?action=send_account', { method: 'POST', body: fd }); - res = await r.json(); + console.log('Sending account info...', { bank, name, account, amount }); + const r = await fetch('/api/admin_recharge.php?action=send_account', { method: 'POST', body: fd }); + const res = await r.json(); if (res.success) { + console.log('Account sent successfully'); if (paymentModal) paymentModal.hide(); // Clear inputs document.getElementById('pay-bank').value = ''; @@ -681,11 +673,13 @@ async function sendPaymentInfo() { document.getElementById('pay-account').value = ''; document.getElementById('pay-amount').value = ''; document.getElementById('pay-note').value = ''; - alert('账户信息已保存,系统将通过订单状态自动更新用户页面'); + alert('账户信息已发送,用户页面将立即显示收款账户'); } else { + console.error('Send failed:', res.error); alert('发送失败: ' + res.error); } } catch(err) { + console.error('Network error:', err); alert('网络请求失败'); } } diff --git a/api/admin_recharge.php b/api/admin_recharge.php index d325a68..f3aa5bc 100644 --- a/api/admin_recharge.php +++ b/api/admin_recharge.php @@ -47,8 +47,23 @@ try { echo json_encode(['success' => true]); } elseif ($action === 'send_account') { - $stmt = $db->prepare("UPDATE finance_requests SET status = 2 WHERE id = ?"); - $stmt->execute([$order_id]); + $bank = $_POST['bank'] ?? ''; + $name = $_POST['name'] ?? ''; + $account = $_POST['account'] ?? ''; + $amount = isset($_POST['amount']) ? (float)$_POST['amount'] : null; + + 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->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->execute([$bank, $name, $account, $order_id]); + } + } else { + $stmt = $db->prepare("UPDATE finance_requests SET status = 2 WHERE id = ?"); + $stmt->execute([$order_id]); + } echo json_encode(['success' => true]); } else { diff --git a/api/recharge_status.php b/api/recharge_status.php index 14c9dda..0d51ba2 100644 --- a/api/recharge_status.php +++ b/api/recharge_status.php @@ -1,6 +1,9 @@ '发生未知错误', 'rate_fetch_failed' => '获取汇率失败(服务商问题)', 'matching_account' => '正在为您匹配充值账户', - 'matching_desc' => '系统正在为您匹配充值账户,请耐心等待 匹配期间请勿刷新页面或重复提交订单 若超过倒计时仍未匹配成功,请及时联系在线客服', - 'security_instructions' => '安全说明', - 'security_tip_1' => '请在倒计时结束前完成充值', - 'security_tip_2' => '转账时请务必备注您的用户ID', - 'security_tip_3' => '如有任何疑问请及时联系客服', - 'safe_payment' => '安全支付', - 'instant_confirmation' => '即时确认', - 'remaining_time' => '剩余时间', - 'account_matched' => '匹配成功', - 'account_matched_desc' => '匹配成功,请按页面信息完成单笔全额转账 转账完成后请将凭证提交给在线客服 核实通过后系统自动入账', + 'matching_desc' => '系统正在为您分配专属收款账户,请耐心等待。 匹配成功后,页面将自动更新收款信息。 请勿关闭当前页面。', + 'matched_successfully' => '匹配成功', + 'matched_desc_short' => '您的充值订单已匹配成功。 客服正在为您发送收款账户信息,请稍候。 页面将自动显示收款账户,请勿刷新或关闭页面。', + 'recharge_final_title' => '请按照以下账户信息进行转账', + 'recharge_final_notice' => '请严格按照页面展示的收款账户信息进行转账。 请勿分笔转账或修改信息,转账完成后,请点击“完成转账”按钮。 转账完成后请提交转账凭证给在线客服,方便第一时间为你确认到账。', 'bank_name' => '银行名称', 'payee_name' => '收款姓名', 'account_number' => '收款账户', diff --git a/recharge.php b/recharge.php index fef0d52..77dd668 100644 --- a/recharge.php +++ b/recharge.php @@ -454,6 +454,11 @@ $bep20_addr = $settings['usdt_bep20_address'] ?? '0x742d35Cc6634C0532925a3b844Bc