update cara upload gambar
This commit is contained in:
+62
-1
@@ -120,7 +120,68 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
echo json_encode(['success' => false, 'error' => 'Mikrotik tidak terhubung']);
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
elseif ($tabel === 'tagihan') {
|
||||
|
||||
$sql = "
|
||||
SELECT
|
||||
a.id,
|
||||
a.transaction_id,
|
||||
a.transaction_data,
|
||||
b.apikey_payment_gateway,
|
||||
b.url_payment_gateway
|
||||
FROM
|
||||
tagihan a
|
||||
LEFT JOIN
|
||||
data_server b
|
||||
ON a.id_data_server = b.id
|
||||
WHERE
|
||||
a.id = :id
|
||||
AND a.transaction_id != ''
|
||||
AND a.transaction_status = 'ACTIVE'
|
||||
AND a.transaction_data != ''
|
||||
AND b.payment_gateway = 'flip'
|
||||
AND b.status_payment_gateway = 'ACTIVE'
|
||||
";
|
||||
|
||||
$stmt = $pdo->prepare($sql);
|
||||
$stmt->execute([':id' => $id]);
|
||||
$data = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($data && !empty($data['transaction_data'])) {
|
||||
require "../payment/flip/Flip/Transaction.php";
|
||||
|
||||
$data2 = json_decode($data['transaction_data'], true);
|
||||
if (json_last_error() === JSON_ERROR_NONE && !empty($data2['link_id'])) {
|
||||
$flip = new FlipPaymentGateway($data['apikey_payment_gateway'], $data['url_payment_gateway']);
|
||||
|
||||
$flip->editBill(
|
||||
$data2['link_id'],
|
||||
'INACTIVE',
|
||||
$data2['title'] ?? '',
|
||||
$data2['amount'] ?? 0
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "DELETE FROM tagihan WHERE id = ?";
|
||||
$stmt = $pdo->prepare($sql);
|
||||
$stmt->bindParam(1, $id, PDO::PARAM_INT);
|
||||
|
||||
if ($stmt->execute()) {
|
||||
$deletedCount = $stmt->rowCount();
|
||||
$response = [
|
||||
'success' => true,
|
||||
'deleted_count' => $deletedCount,
|
||||
'deleted_items' => [
|
||||
['table' => 'data yang anda hapus', 'count' => $deletedCount]
|
||||
]
|
||||
];
|
||||
} else {
|
||||
$response = ['success' => false, 'error' => 'Gagal menghapus data'];
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Menyiapkan perintah SQL untuk menghapus data dari tabel lain
|
||||
$sql = "DELETE FROM $tabel WHERE id = ?";
|
||||
$stmt = $pdo->prepare($sql);
|
||||
|
||||
Reference in New Issue
Block a user