Update dari aaPanel
This commit is contained in:
+78
-3
@@ -1,5 +1,5 @@
|
||||
<!-- Main content -->
|
||||
<section class="content" style="zoom: 80%;">
|
||||
<section class="content" style="zoom: 90%;">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@@ -10,7 +10,80 @@
|
||||
<h3 class="card-title">Log Pesan</h3>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<ol class="float-sm-right mb-0">
|
||||
<a type="button" class="btn btn-secondary btn-sm" data-toggle="modal" data-target="#staticBackdrop">Kirim Ulang</a>
|
||||
</lo>
|
||||
</div>
|
||||
<div class="modal fade" id="staticBackdrop" data-backdrop="static" data-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<div class="modal-header bg-primary">
|
||||
<h5 class="modal-title" id="staticBackdropLabel">Kirim Ulang Pesan GAGAL Terakhir</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
// Query dengan PDO
|
||||
$stmt = $pdo->prepare("SELECT apikey_whatsapp FROM data_server WHERE id = :id");
|
||||
$stmt->execute(['id' => $SvId]);
|
||||
$pakw = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
$sekarang = date('Y-m-d H:i:s');
|
||||
?>
|
||||
<div class="modal-body">
|
||||
<div class="input-group mb-3">
|
||||
<select class="form-control" name="jamtam" required>
|
||||
<option value="1">1</option>
|
||||
<option value="3">3</option>
|
||||
<option value="6">6</option>
|
||||
<option value="12">12</option>
|
||||
<option value="24">24</option>
|
||||
<option value="36">36</option>
|
||||
</select>
|
||||
<span class="input-group-text" id="basic-addon2">Jam Terakhir Pesan Yang GAGAL Terkirim</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
<input type="submit" name="kirimulang" class="btn btn-primary" value="Submit">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
// Proses kirim ulang
|
||||
if (isset($_POST['kirimulang'])) {
|
||||
try {
|
||||
$jamtam = (int) $_POST['jamtam'];
|
||||
$mulaiulang = date('Y-m-d H:i:s', strtotime("$sekarang -$jamtam hours"));
|
||||
|
||||
// Update pesan yang gagal
|
||||
$updatePesan = $pdo->prepare("UPDATE master_pesan SET status = 'PENDING' WHERE status = 'GAGAL' AND api_key = :api_key AND waktu >= :mulaiulang");
|
||||
$updatePesan->execute([
|
||||
'api_key' => $pakw['apikey_whatsapp'],
|
||||
'mulaiulang' => $mulaiulang
|
||||
]);
|
||||
|
||||
// Hitung jumlah pesan yang diupdate
|
||||
$jumlahPesan = $updatePesan->rowCount();
|
||||
|
||||
if ($jumlahPesan > 0) {
|
||||
sweetAlert("$jumlahPesan pesan berhasil masuk antrian pengiriman ulang", "success");
|
||||
} else {
|
||||
sweetAlert("Tidak ada pesan GAGAL yang ditemukan dalam $jamtam jam terakhir", "warning");
|
||||
}
|
||||
|
||||
} catch (PDOException $e) {
|
||||
sweetAlert("Error: " . $e->getMessage(), "error");
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!-- END Modal Tambah -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.card-header -->
|
||||
@@ -19,6 +92,7 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nama Server</th>
|
||||
<th>Waktu</th>
|
||||
<th>Nomor</th>
|
||||
<th>Pesan</th>
|
||||
<th>Url Image</th>
|
||||
@@ -40,9 +114,10 @@
|
||||
echo $sv['nama_server'];
|
||||
?>
|
||||
</td>
|
||||
<td style="max-width: 200px;"><?php echo $paket['waktu']; ?></td>
|
||||
<td><?php echo $paket['nomor']; ?></td>
|
||||
<td><?php echo $paket['pesan']; ?></td>
|
||||
<td><?php echo $paket['url_file']; ?></td>
|
||||
<td style="max-width: 300px;"><?php echo $paket['pesan']; ?></td>
|
||||
<td style="max-width: 200px;"><?php echo $paket['url_file']; ?></td>
|
||||
<td><?php echo $paket['status']; ?></td>
|
||||
<td>
|
||||
<?php if($paket['status'] == 'GAGAL') { ?>
|
||||
|
||||
Reference in New Issue
Block a user