zhunbeibus
This commit is contained in:
parent
8b18aec895
commit
850a3071af
@ -629,7 +629,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('匹配成功!状态已更新为“matched”。若要向用户显示收款账户,请继续点击“发送账户”按钮。');
|
||||
alert('匹配成功!状态已更新。若要向用户显示收款账户,请继续点击“发送账户”按钮。');
|
||||
} else {
|
||||
alert('错误: ' + res.error);
|
||||
}
|
||||
|
||||
@ -52,8 +52,8 @@ function getCount($db, $sql, $params) {
|
||||
|
||||
if ($admin['is_agent']) {
|
||||
$agent_id = $admin_id;
|
||||
$pending_recharge = getCount($db, "SELECT COUNT(*) FROM finance_requests r JOIN users u ON r.user_id = u.id WHERE r.type = 'recharge' AND r.status = '0' AND u.agent_id = ? AND UNIX_TIMESTAMP(r.created_at) > ?", [$agent_id, $cleared_recharge]);
|
||||
$pending_withdrawal = getCount($db, "SELECT COUNT(*) FROM finance_requests r JOIN users u ON r.user_id = u.id WHERE r.type = 'withdrawal' AND r.status = '0' AND u.agent_id = ? AND UNIX_TIMESTAMP(r.created_at) > ?", [$agent_id, $cleared_recharge]);
|
||||
$pending_recharge = getCount($db, "SELECT COUNT(*) FROM finance_requests r JOIN users u ON r.user_id = u.id WHERE r.type = 'recharge' AND r.status NOT IN ('3', '4') AND u.agent_id = ? AND UNIX_TIMESTAMP(r.created_at) > ?", [$agent_id, $cleared_recharge]);
|
||||
$pending_withdrawal = getCount($db, "SELECT COUNT(*) FROM finance_requests r JOIN users u ON r.user_id = u.id WHERE r.type = 'withdrawal' AND r.status NOT IN ('3', '4') AND u.agent_id = ? AND UNIX_TIMESTAMP(r.created_at) > ?", [$agent_id, $cleared_recharge]);
|
||||
$pending_kyc = getCount($db, "SELECT COUNT(*) FROM users WHERE kyc_status = 1 AND agent_id = ? AND UNIX_TIMESTAMP(created_at) > ?", [$agent_id, $cleared_kyc]);
|
||||
$active_binary = getCount($db, "SELECT COUNT(*) FROM binary_orders o JOIN users u ON o.user_id = u.id WHERE o.status = 'pending' AND u.agent_id = ? AND UNIX_TIMESTAMP(o.created_at) > ?", [$agent_id, $cleared_binary]);
|
||||
$active_spot = getCount($db, "SELECT COUNT(*) FROM spot_orders o JOIN users u ON o.user_id = u.id WHERE o.status = 0 AND u.agent_id = ? AND UNIX_TIMESTAMP(o.created_at) > ?", [$agent_id, $cleared_spot]);
|
||||
@ -61,8 +61,8 @@ if ($admin['is_agent']) {
|
||||
$new_messages = getCount($db, "SELECT COUNT(*) FROM messages m JOIN users u ON m.user_id = u.id WHERE m.sender = 'user' AND u.agent_id = ? AND UNIX_TIMESTAMP(m.created_at) > ?", [$agent_id, $cleared_messages]);
|
||||
$new_registrations = getCount($db, "SELECT COUNT(*) FROM users WHERE agent_id = ? AND UNIX_TIMESTAMP(created_at) > ?", [$agent_id, $cleared_users]);
|
||||
} else {
|
||||
$pending_recharge = getCount($db, "SELECT COUNT(*) FROM finance_requests WHERE type = 'recharge' AND status = '0' AND UNIX_TIMESTAMP(created_at) > ?", [$cleared_recharge]);
|
||||
$pending_withdrawal = getCount($db, "SELECT COUNT(*) FROM finance_requests WHERE type = 'withdrawal' AND status = '0' AND UNIX_TIMESTAMP(created_at) > ?", [$cleared_recharge]);
|
||||
$pending_recharge = getCount($db, "SELECT COUNT(*) FROM finance_requests WHERE type = 'recharge' AND status NOT IN ('3', '4') AND UNIX_TIMESTAMP(created_at) > ?", [$cleared_recharge]);
|
||||
$pending_withdrawal = getCount($db, "SELECT COUNT(*) FROM finance_requests WHERE type = 'withdrawal' AND status NOT IN ('3', '4') AND UNIX_TIMESTAMP(created_at) > ?", [$cleared_recharge]);
|
||||
$pending_kyc = getCount($db, "SELECT COUNT(*) FROM users WHERE kyc_status = 1 AND UNIX_TIMESTAMP(created_at) > ?", [$cleared_kyc]);
|
||||
$active_binary = getCount($db, "SELECT COUNT(*) FROM binary_orders WHERE status = 'pending' AND UNIX_TIMESTAMP(created_at) > ?", [$cleared_binary]);
|
||||
$active_spot = getCount($db, "SELECT COUNT(*) FROM spot_orders WHERE status = 0 AND UNIX_TIMESTAMP(created_at) > ?", [$cleared_spot]);
|
||||
|
||||
@ -21,8 +21,8 @@ if (!$user_id) {
|
||||
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 ('pending', 'matched') ORDER BY created_at DESC LIMIT 1");
|
||||
// Find the latest pending/matching/account_sent recharge for this user
|
||||
$stmt = $db->prepare("SELECT id FROM finance_requests WHERE user_id = ? AND type = 'recharge' AND status IN ('0', '1', '2', 'pending', 'matched', 'account_sent') 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 = 'matched', account_bank = ?, account_name = ?, account_number = ?, amount = ? WHERE id = ?");
|
||||
$stmt = $db->prepare("UPDATE finance_requests SET status = '1', 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 = 'matched', account_bank = ?, account_name = ?, account_number = ? WHERE id = ?");
|
||||
$stmt = $db->prepare("UPDATE finance_requests SET status = '1', 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 = 'account_sent', account_bank = ?, account_name = ?, account_number = ?, amount = ? WHERE id = ?");
|
||||
$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 = 'account_sent', account_bank = ?, account_name = ?, account_number = ? WHERE id = ?");
|
||||
$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 = 'account_sent' WHERE id = ?");
|
||||
$stmt = $db->prepare("UPDATE finance_requests SET status = '2' WHERE id = ?");
|
||||
$stmt->execute([$order_id]);
|
||||
}
|
||||
echo json_encode(['success' => true]);
|
||||
|
||||
@ -630,7 +630,7 @@ function renderRechargeUI(data) {
|
||||
<div class="mt-4"><button type="button" class="btn btn-primary w-100 rounded-pill py-2 fw-bold opacity-50" disabled style="background: #ff4d94 !important; border: none;">正在获取账户详情...</button></div>
|
||||
</div>
|
||||
</div>`;
|
||||
} else if (status === 'matched') {
|
||||
} else if (status === 'matched' || status === '1') {
|
||||
side.innerHTML = `
|
||||
<div class="text-center text-lg-start position-relative" style="z-index: 2;">
|
||||
<div class="mb-4 text-center">
|
||||
@ -653,7 +653,7 @@ function renderRechargeUI(data) {
|
||||
<div class="mt-4"><button type="button" class="btn btn-primary w-100 rounded-pill py-2 fw-bold opacity-50" disabled style="background: #ff4d94 !important; border: none;">正在获取账户详情...</button></div>
|
||||
</div>
|
||||
</div>`;
|
||||
} else if (status === 'account_sent') {
|
||||
} else if (status === 'account_sent' || status === '2') {
|
||||
const bank = data.account_bank || '---';
|
||||
const account = data.account_number || '---';
|
||||
const name = data.account_name || '---';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user