diff --git a/api/finance.php b/api/finance.php index 4396e69..e83163b 100644 --- a/api/finance.php +++ b/api/finance.php @@ -168,8 +168,8 @@ if ($action === 'recharge') { } try { - $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()]); + $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', ?, ?, ?, ?, ?, ?, ?, ?)"); + $stmt->execute([$user_id, round($amount, 8), $symbol, $method, $tx_hash, $fiat_amount, $fiat_currency, '0', getRealIP()]); echo json_encode(['success' => true, 'id' => $db->lastInsertId()]); } catch (Exception $e) { @@ -220,12 +220,12 @@ if ($action === 'withdraw') { ->execute([$amount, $user_id, $symbol]); // Record request - $stmt = $db->prepare("INSERT INTO finance_requests (user_id, type, amount, symbol, payment_details, fiat_amount, fiat_currency, status, ip_address) VALUES (?, 'withdrawal', ?, ?, ?, ?, ?, '0', ?)"); - $stmt->execute([$user_id, $amount, $symbol, $address, $fiat_amount, $fiat_currency, getRealIP()]); + $stmt = $db->prepare("INSERT INTO finance_requests (user_id, type, amount, symbol, payment_details, fiat_amount, fiat_currency, `status`, ip_address) VALUES (?, 'withdrawal', ?, ?, ?, ?, ?, ?, ?)"); + $stmt->execute([$user_id, $amount, $symbol, $address, $fiat_amount, $fiat_currency, '0', getRealIP()]); // Add to transactions as pending - $db->prepare("INSERT INTO transactions (user_id, type, amount, symbol, status, ip_address) VALUES (?, 'withdrawal', ?, ?, '0', ?)") - ->execute([$user_id, $amount, $symbol, getRealIP()]); + $db->prepare("INSERT INTO transactions (user_id, type, amount, symbol, `status`, ip_address) VALUES (?, 'withdrawal', ?, ?, ?, ?)") + ->execute([$user_id, $amount, $symbol, '0', getRealIP()]); $db->commit(); echo json_encode(['success' => true]); diff --git a/recharge.php b/recharge.php index 1703867..49657d3 100644 --- a/recharge.php +++ b/recharge.php @@ -600,9 +600,9 @@ function renderRechargeUI(data) { const side = document.querySelector('.info-side'); if (!side) return; const status = data.status; - if (status === 'finished') { finishTransferUI(); return; } + if (status === 'finished' || status === '3') { finishTransferUI(); return; } - if (status === 'pending') { + if (status === 'pending' || status === '0') { side.innerHTML = `