update wa official API

This commit is contained in:
WD - Dev
2025-10-07 21:01:15 +07:00
parent efca8f5f80
commit eb13c69431
55 changed files with 138040 additions and 1543 deletions
+39 -4
View File
@@ -1,3 +1,31 @@
<?php
function modifStatus($status) {
$status = strtoupper(trim($status));
switch ($status) {
case 'PROSES':
$class = 'badge badge-warning text-dark'; // kuning
break;
case 'TERKIRIM':
$class = 'badge badge-info'; // biru muda
break;
case 'DIBACA':
$class = 'badge badge-success'; // hijau
break;
case 'GAGAL':
$class = 'badge badge-danger'; // merah
break;
default:
$class = 'badge badge-secondary'; // abu-abu
break;
}
return '<span class="' . $class . '">' . htmlspecialchars($status) . '</span>';
}
?>
<!-- Main content -->
<section class="content" style="zoom: 90%;">
<div class="container-fluid">
@@ -63,7 +91,7 @@
$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 = $pdo->prepare("UPDATE master_pesan SET status = 'PENDING' WHERE status = 'GAGAL' AND api_key = :api_key AND waktu >= :mulaiulang AND gateway_type = 'unofficial'");
$updatePesan->execute([
'api_key' => $pakw['apikey_whatsapp'],
'mulaiulang' => $mulaiulang
@@ -96,6 +124,7 @@
<th>Nomor</th>
<th>Pesan</th>
<th>Url Image</th>
<th>Type Gateway</th>
<th>Status</th>
<th>Action</th>
</tr>
@@ -118,9 +147,15 @@
<td><?php echo $paket['nomor']; ?></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' || $paket['status'] == 'TERKIRIM') { ?>
<td style="text-align: center;"><?php echo ucwords($paket['gateway_type']); ?></td>
<td style="text-align: center;">
<?php
echo modifStatus($paket['status']);
echo (empty($paket['message_status'])) ? '' : '<br>' . $paket['message_status'] ;
?>
</td>
<td style="text-align: center;">
<?php if($paket['gateway_type'] == 'unofficial' AND ($paket['status'] == 'GAGAL' || $paket['status'] == 'TERKIRIM')) { ?>
<form method="post">
<input type="submit" name="ulangi<?php echo $paket['id']; ?>" class="btn btn-primary btn-sm" value="Ulangi">
</a>