Pisah server penyimpanan dan update payment gateway
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +1,11 @@
|
|||||||
NO ACTION => 2 <-> cc.net Limit_Tgl_5<br>NO ACTION => 3 <-> nsn utama Limit_Tgl_10<br>NO ACTION => 3 <-> ciangsana Limit_Tgl_15<br>NO ACTION => 4 <-> fast.net Limit_Tgl_12<br>NO ACTION => 5 <-> bima net Limit Tagihan Tgl 15<br>NO ACTION => 6 <-> kingnet Limit Tgl 15<br>NO ACTION => 8 <-> diamond.net Limit_Tgl_15<br>NO ACTION => 9 <-> 22 p.net Limit_Tgl_15<br>NO ACTION => 10 <-> nettizen Tagihan Limit tgl 15<br>NO ACTION => 12 <-> Tagihan_Limit_Tgl5<br>NO ACTION => 15 <-> Tag_NTA2 Limit Tgl 10<br>NO ACTION => 16 <-> Tagihan Limit Tgl 10<br>NO ACTION => 13 <-> Limit Tanggal 26 (Infinnet)<br>NO ACTION => 18 <-> BUM-Limit-Tgl-5<br>BUAT TAGIHAN => 14 <-> Kh_Limit Tanggal 25 Start : 2025-10-13 - Last : 2025-10-18<br>NO ACTION => 17 <-> Tagihan Limit Tgl 10<br>NO ACTION => 17 <-> Tagihan Limit Tgl 15<br>NO ACTION => 20 <-> IVVI-10<br>NO ACTION => 20 <-> IVVI-20<br>BUAT TAGIHAN => 20 <-> IVVI-30 Start : 2025-10-17 - Last : 2025-10-20<br>NO ACTION => 21 <-> QONNET<br>NO ACTION => 21 <-> QONNET2<br>NO ACTION => 25 <-> Tagihan Limit Tgl 5<br>NO ACTION => 23 <-> Limit Tanggal 5<br>NO ACTION => 26 <-> Limit Tanggal 10<br>NO ACTION => 24 <-> Tagihan30<br>NO ACTION => 23 <-> limit tanggal 19<br>NO ACTION => 31 <-> 23-ISOLIR<br>NO ACTION => 33 <-> usolir-10<br>NO ACTION => 37 <-> paket 140 ribu<br>NO ACTION => 28 <-> PAKET-100K<br>NO ACTION => 28 <-> PAKET-150K<br>NO ACTION => 28 <-> PAKET-200K<br>NO ACTION => 28 <-> PAKET-300K<br>NO ACTION => 42 <-> meldina-20<br>NO ACTION => 41 <-> lippy-20<br>NO ACTION => 43 <-> Tagihan_Limit_tgl_13<br>NO ACTION => 46 <-> Limit Tgl 10<br>BUAT TAGIHAN => 35 <-> PAKET 1 DEVICE Start : 2025-10-17 - Last : 2025-10-19<br>BUAT TAGIHAN => 35 <-> PAKET 2 DEVICE Start : 2025-10-17 - Last : 2025-10-19<br>BUAT TAGIHAN => 35 <-> PAKET 3 DEVICE Start : 2025-10-17 - Last : 2025-10-19<br>BUAT TAGIHAN => 35 <-> PAKET 4 DEVICE Start : 2025-10-17 - Last : 2025-10-19<br>BUAT TAGIHAN => 35 <-> PAKET 5 DEVICE [1/80] Start : 2025-10-17 - Last : 2025-10-19<br>BUAT TAGIHAN => 35 <-> PAKET 5 DEVICE [1/70] Start : 2025-10-17 - Last : 2025-10-19<br>BUAT TAGIHAN => 35 <-> PAKET 6 DEVICE [1/80] Start : 2025-10-17 - Last : 2025-10-19<br>BUAT TAGIHAN => 35 <-> PAKET 6 DEVICE [1/70] Start : 2025-10-17 - Last : 2025-10-19<br>BUAT TAGIHAN => 35 <-> PAKET 7 DEVICE Start : 2025-10-17 - Last : 2025-10-19<br>BUAT TAGIHAN => 35 <-> PAKET 8 DEVICE Start : 2025-10-17 - Last : 2025-10-19<br>NO ACTION => 44 <-> Isolir_20<br>NO ACTION => 53 <-> PAKET BRONZE <br>NO ACTION => 54 <-> Muhamad rouf<br>NO ACTION => 53 <-> PAKET PLATINUM 5MBs<br>NO ACTION => 53 <-> PAKET GLOD 7 MBs<br>NO ACTION => 53 <-> PAKET GLOD+ 10 MBs<br>NO ACTION => 59 <-> Isolir_21<br>BUAT TAGIHAN => 46 <-> Limit tgl 30 Start : 2025-10-18 - Last : 2025-10-19<br>NO ACTION => 61 <-> Isolir_20<br>NO ACTION => 55 <-> Dcn_CO_Isolir<br>NO ACTION => 62 <-> limit tanggal 5<br>NO ACTION => 55 <-> Dcn_GB_Isolir<br>NO ACTION => 49 <-> TAGIHAN TANGGAL 20<br>NO ACTION => 19 <-> TAGIHAN-TGL1<br>NO ACTION => 49 <-> TAGIHAN TANGGAL 1<br>NO ACTION => 66 <-> Tagihan Isolir Tgl 1<br>NO ACTION => 67 <-> Tag Netborhood Limit Tgl 10<br>NO ACTION => 73 <-> Tagihan01-05<br>NO ACTION => 74 <-> tto Limit_Tgl_10<br>NO ACTION => 75 <-> too_Limit_Tgl_10<br>NO ACTION => 76 <-> GAS NET limit_tgl_10<br>NO ACTION => 77 <-> DamarisNet<br>NO ACTION => 22 <-> rumahan<br>NO ACTION => 68 <-> limit tgl 5<br>
|
REMAND => 2 <-> cc.net Limit_Tgl_5<br>REMAND => 3 <-> nsn utama Limit_Tgl_10<br>NO ACTION => 3 <-> ciangsana Limit_Tgl_15<br>NO ACTION => 4 <-> fast.net Limit_Tgl_12<br>NO ACTION => 5 <-> bima net Limit Tagihan Tgl 15<br>NO ACTION => 6 <-> kingnet Limit Tgl 15<br>NO ACTION => 8 <-> diamond.net Limit_Tgl_15<br>NO ACTION => 9 <-> 22 p.net Limit_Tgl_15<br>KIRIM TAGIHAN => 10 <-> nettizen Tagihan Limit tgl 15<br>NO ACTION => 12 <-> DNY - Tagihan_Limit_Tgl5<br>REMAND => 15 <-> Tag_NTA2 Limit Tgl 10<br>REMAND => 16 <-> NTA1 - Tagihan Limit Tgl 10<br>PHP Fatal error: Uncaught Exception: DateTime::__construct(): Failed to parse time string (2025-12-33) at position 9 (3): Unexpected character in /www/wwwroot/bilspro/config/cronjob_tagihan.php:31
|
||||||
|
Stack trace:
|
||||||
|
#0 /www/wwwroot/bilspro/config/cronjob_tagihan.php(31): DateTime->__construct()
|
||||||
|
#1 {main}
|
||||||
|
thrown in /www/wwwroot/bilspro/config/cronjob_tagihan.php on line 31
|
||||||
|
|
||||||
|
Fatal error: Uncaught Exception: DateTime::__construct(): Failed to parse time string (2025-12-33) at position 9 (3): Unexpected character in /www/wwwroot/bilspro/config/cronjob_tagihan.php:31
|
||||||
|
Stack trace:
|
||||||
|
#0 /www/wwwroot/bilspro/config/cronjob_tagihan.php(31): DateTime->__construct()
|
||||||
|
#1 {main}
|
||||||
|
thrown in /www/wwwroot/bilspro/config/cronjob_tagihan.php on line 31
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ try {
|
|||||||
if ($now == $pset['kirim_tagihan'] AND $time >= '6') {
|
if ($now == $pset['kirim_tagihan'] AND $time >= '6') {
|
||||||
echo "KIRIM TAGIHAN => " . $pset['id_data_server'] . " <-> " . $pset['nama'] . "<br>";
|
echo "KIRIM TAGIHAN => " . $pset['id_data_server'] . " <-> " . $pset['nama'] . "<br>";
|
||||||
|
|
||||||
$stmt = $pdo->prepare("SELECT * FROM v_tagihan WHERE status = 'buat' AND id_profile_tagihan = :id_profile_tagihan LIMIT 20");
|
$stmt = $pdo->prepare("SELECT * FROM v_tagihan WHERE status = 'buat' AND id_profile_tagihan = :id_profile_tagihan LIMIT 50");
|
||||||
$stmt->bindParam(':id_profile_tagihan', $pset['id'], PDO::PARAM_INT);
|
$stmt->bindParam(':id_profile_tagihan', $pset['id'], PDO::PARAM_INT);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$tags = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
$tags = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
@@ -221,7 +221,7 @@ try {
|
|||||||
elseif ($skr2 >= $starttime && $skr2 <= $lasttime) {
|
elseif ($skr2 >= $starttime && $skr2 <= $lasttime) {
|
||||||
echo "BUAT TAGIHAN => " . $pset['id_data_server'] . " <-> " . $pset['nama'] . " Start : " . $tgl92 . " - Last : " . $sendtag . "<br>";
|
echo "BUAT TAGIHAN => " . $pset['id_data_server'] . " <-> " . $pset['nama'] . " Start : " . $tgl92 . " - Last : " . $sendtag . "<br>";
|
||||||
|
|
||||||
$stmt = $pdo->prepare("SELECT * FROM pelanggan WHERE status = 'aktif' AND id_profile_tagihan = :id");
|
$stmt = $pdo->prepare("SELECT * FROM pelanggan WHERE status = 'aktif' AND mulai_pembayaran <= CURDATE() AND id_profile_tagihan = :id");
|
||||||
$stmt->bindParam(':id', $pset['id'], PDO::PARAM_INT);
|
$stmt->bindParam(':id', $pset['id'], PDO::PARAM_INT);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$pelanggan = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
$pelanggan = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
@@ -291,10 +291,14 @@ try {
|
|||||||
|
|
||||||
$keterangan = "Tagihan Layanan Internet bulan " . formatIndo($limit_tag, 'F Y');
|
$keterangan = "Tagihan Layanan Internet bulan " . formatIndo($limit_tag, 'F Y');
|
||||||
$status = 'buat';
|
$status = 'buat';
|
||||||
|
|
||||||
|
$namaclean = preg_replace('/[^a-zA-Z\s]/', '', $pecah1['nama']);
|
||||||
|
$namaclean = ucwords(strtolower(trim($namaclean)));
|
||||||
|
$transaction_title = "Tagihan " . formatIndo($limit_tag, 'F Y') . ' an ' . $namaclean . ' id ' . $pecah1['akun'];
|
||||||
|
|
||||||
$stmt = $pdo->prepare("INSERT INTO tagihan
|
$stmt = $pdo->prepare("INSERT INTO tagihan
|
||||||
(id_data_server, id_pelanggan, id_profile_paket, id_profile_tagihan, nominal_tagihan, jumlah_tagihan, ppn, total_tagihan, kode_unik, verifikasi_tagihan, keterangan, limit_pembayaran, status)
|
(id_data_server, id_pelanggan, id_profile_paket, id_profile_tagihan, nominal_tagihan, jumlah_tagihan, ppn, total_tagihan, kode_unik, verifikasi_tagihan, keterangan, limit_pembayaran, status, transaction_title)
|
||||||
VALUES (:id_data_server, :id_pelanggan, :id_profile_paket, :id_profile_tagihan, :nominal_tagihan, :jumlah_tagihan, :ppn, :total_tagihan, :kode_unik, :verifikasi_tagihan, :keterangan, :limit_pembayaran, :status)
|
VALUES (:id_data_server, :id_pelanggan, :id_profile_paket, :id_profile_tagihan, :nominal_tagihan, :jumlah_tagihan, :ppn, :total_tagihan, :kode_unik, :verifikasi_tagihan, :keterangan, :limit_pembayaran, :status, :transaction_title)
|
||||||
");
|
");
|
||||||
$stmt->execute([
|
$stmt->execute([
|
||||||
':id_data_server' => $id_data_server,
|
':id_data_server' => $id_data_server,
|
||||||
@@ -310,6 +314,7 @@ try {
|
|||||||
':keterangan' => $keterangan,
|
':keterangan' => $keterangan,
|
||||||
':limit_pembayaran' => $limit_tag,
|
':limit_pembayaran' => $limit_tag,
|
||||||
':status' => $status,
|
':status' => $status,
|
||||||
|
':transaction_title' => $transaction_title,
|
||||||
]);
|
]);
|
||||||
$last_id = $pdo->lastInsertId();
|
$last_id = $pdo->lastInsertId();
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,349 @@
|
|||||||
|
<?php
|
||||||
|
require('fpdf/fpdf.php');
|
||||||
|
|
||||||
|
class BA_Template extends FPDF
|
||||||
|
{
|
||||||
|
protected $content;
|
||||||
|
protected $isFirstPage = true;
|
||||||
|
protected $B = 0;
|
||||||
|
protected $I = 0;
|
||||||
|
protected $U = 0;
|
||||||
|
|
||||||
|
public function __construct($content)
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
$this->content = $content;
|
||||||
|
$this->SetMargins(20, 25, 20);
|
||||||
|
$this->AddPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================
|
||||||
|
// ✅ WriteHTML() — mendukung <b><i><u><br><p> + justify tanpa pecah kalimat
|
||||||
|
// ===========================================================
|
||||||
|
function WriteHTML($html)
|
||||||
|
{
|
||||||
|
$html = str_replace("\n", ' ', $html);
|
||||||
|
$html = preg_replace('/\s+/', ' ', $html);
|
||||||
|
|
||||||
|
// Pisah berdasarkan tag HTML
|
||||||
|
$a = preg_split('/<(.*)>/U', $html, -1, PREG_SPLIT_DELIM_CAPTURE);
|
||||||
|
|
||||||
|
$buffer = ''; // simpan teks inline sementara
|
||||||
|
|
||||||
|
foreach ($a as $i => $e) {
|
||||||
|
if ($i % 2 == 0) {
|
||||||
|
// Konten teks biasa
|
||||||
|
$buffer .= html_entity_decode($e, ENT_QUOTES, 'UTF-8');
|
||||||
|
} else {
|
||||||
|
// Tag HTML
|
||||||
|
if ($e[0] == '/') {
|
||||||
|
// Tag tutup
|
||||||
|
$tag = strtoupper(substr($e, 1));
|
||||||
|
if (in_array($tag, ['B', 'I', 'U'])) {
|
||||||
|
$this->SetStyle($tag, false);
|
||||||
|
} elseif ($tag == 'P') {
|
||||||
|
if (trim($buffer) != '') {
|
||||||
|
$this->MultiCell(0, 6, trim($buffer), 0, 'J');
|
||||||
|
$buffer = '';
|
||||||
|
}
|
||||||
|
$this->Ln(6);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Tag buka
|
||||||
|
$a2 = explode(' ', $e);
|
||||||
|
$tag = strtoupper(array_shift($a2));
|
||||||
|
$attr = [];
|
||||||
|
foreach ($a2 as $v) {
|
||||||
|
if (preg_match('/([^=]*)=["\']?([^"\']*)/', $v, $a3))
|
||||||
|
$attr[strtoupper($a3[1])] = $a3[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array($tag, ['B', 'I', 'U'])) {
|
||||||
|
$this->SetStyle($tag, true);
|
||||||
|
} elseif ($tag == 'BR') {
|
||||||
|
// Flush teks sebelum ganti baris
|
||||||
|
if (trim($buffer) != '') {
|
||||||
|
$this->MultiCell(0, 6, trim($buffer), 0, 'J');
|
||||||
|
$buffer = '';
|
||||||
|
}
|
||||||
|
$this->Ln(6);
|
||||||
|
} elseif ($tag == 'P') {
|
||||||
|
// Flush sebelum paragraf baru
|
||||||
|
if (trim($buffer) != '') {
|
||||||
|
$this->MultiCell(0, 6, trim($buffer), 0, 'J');
|
||||||
|
$buffer = '';
|
||||||
|
}
|
||||||
|
$this->Ln(6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// flush sisa buffer terakhir
|
||||||
|
if (trim($buffer) != '') {
|
||||||
|
$this->MultiCell(0, 6, trim($buffer), 0, 'J');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================
|
||||||
|
// SetStyle untuk <b><i><u>
|
||||||
|
// ===========================================================
|
||||||
|
function SetStyle($tag, $enable)
|
||||||
|
{
|
||||||
|
$this->$tag += ($enable ? 1 : -1);
|
||||||
|
$style = '';
|
||||||
|
foreach (['B', 'I', 'U'] as $s) {
|
||||||
|
if ($this->$s > 0) $style .= $s;
|
||||||
|
}
|
||||||
|
$this->SetFont('', $style);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================
|
||||||
|
// HEADER
|
||||||
|
// ===========================================================
|
||||||
|
function Header()
|
||||||
|
{
|
||||||
|
$header = $this->content['header'];
|
||||||
|
|
||||||
|
if (file_exists('controller/surat_pdf/bg-pdf.png')) {
|
||||||
|
$this->Image('controller/surat_pdf/bg-pdf.png', 0, 0, 210, 297);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->isFirstPage) {
|
||||||
|
if (!empty($header['imglogo']) && file_exists($header['imglogo'])) {
|
||||||
|
$this->Image($header['imglogo'], 25, 5, 45);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->SetY(12);
|
||||||
|
$this->SetFont('Arial', 'B', 12);
|
||||||
|
$this->SetTextColor(255, 102, 0);
|
||||||
|
$this->Cell(0, 7, strtoupper($header['nama_perusahaan']), 0, 1, 'R');
|
||||||
|
|
||||||
|
$this->SetFont('Arial', '', 10);
|
||||||
|
$this->SetTextColor(80, 80, 80);
|
||||||
|
$this->SetX(130);
|
||||||
|
$this->Cell(0, 5, $header['kantor'], 0, 1, 'R');
|
||||||
|
$this->Ln(1);
|
||||||
|
|
||||||
|
$iconSize = 4;
|
||||||
|
$lineHeight = 5.5;
|
||||||
|
$lineKosong = ' ';
|
||||||
|
$startX = 160;
|
||||||
|
|
||||||
|
$this->SetFont('Arial', '', 9);
|
||||||
|
$this->SetTextColor(90, 90, 90);
|
||||||
|
|
||||||
|
// Telp
|
||||||
|
$this->SetX(120);
|
||||||
|
$this->Cell(0, $lineHeight, $header['telp'] . $lineKosong, 0, 0, 'R');
|
||||||
|
if (file_exists('controller/surat_pdf/icon-phone.png')) {
|
||||||
|
$this->Image('controller/surat_pdf/icon-phone.png', $startX + 25, $this->GetY() + 0.5, $iconSize);
|
||||||
|
}
|
||||||
|
$this->Ln($lineHeight);
|
||||||
|
|
||||||
|
// Email
|
||||||
|
$this->SetX(120);
|
||||||
|
$this->Cell(0, $lineHeight, $header['email'] . $lineKosong, 0, 0, 'R');
|
||||||
|
if (file_exists('controller/surat_pdf/icon-mail.png')) {
|
||||||
|
$this->Image('controller/surat_pdf/icon-mail.png', $startX + 25, $this->GetY() + 0.5, $iconSize);
|
||||||
|
}
|
||||||
|
$this->Ln($lineHeight);
|
||||||
|
|
||||||
|
// Website
|
||||||
|
$this->SetX(120);
|
||||||
|
$this->Cell(0, $lineHeight, $header['website'] . $lineKosong, 0, 0, 'R');
|
||||||
|
if (file_exists('controller/surat_pdf/icon-web.png')) {
|
||||||
|
$this->Image('controller/surat_pdf/icon-web.png', $startX + 25, $this->GetY() + 0.5, $iconSize);
|
||||||
|
}
|
||||||
|
$this->Ln($lineHeight);
|
||||||
|
|
||||||
|
$this->SetDrawColor(128, 128, 128);
|
||||||
|
$this->SetLineWidth(0.7);
|
||||||
|
$this->Line(21, 45, 130, 45);
|
||||||
|
$this->SetDrawColor(255, 102, 0);
|
||||||
|
$this->Line(132, 45, 189, 45);
|
||||||
|
$this->Ln(12);
|
||||||
|
|
||||||
|
$this->isFirstPage = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================
|
||||||
|
// FOOTER
|
||||||
|
// ===========================================================
|
||||||
|
function Footer()
|
||||||
|
{
|
||||||
|
$footer = $this->content['footer'];
|
||||||
|
$this->SetY(-15);
|
||||||
|
$this->SetFont('Arial', 'I', 8);
|
||||||
|
$this->SetTextColor(100, 100, 100);
|
||||||
|
$this->Cell(0, 10, ($footer['text'] ?? 'Surat') . ' | Halaman ' . $this->PageNo(), 0, 0, 'R');
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================
|
||||||
|
// Section Title
|
||||||
|
// ===========================================================
|
||||||
|
function SectionTitle($title)
|
||||||
|
{
|
||||||
|
$this->Ln(5);
|
||||||
|
$this->SetFont('Arial', '', 11);
|
||||||
|
$this->SetTextColor(255, 102, 0);
|
||||||
|
$this->Cell(0, 8, strtoupper($title), 0, 1, 'L');
|
||||||
|
$this->SetTextColor(0, 0, 0);
|
||||||
|
$this->Ln(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================
|
||||||
|
// Body Content
|
||||||
|
// ===========================================================
|
||||||
|
function BodyContent()
|
||||||
|
{
|
||||||
|
$body = $this->content['body'];
|
||||||
|
|
||||||
|
if (!empty($body['bodyHead']['text'])) {
|
||||||
|
$this->SetFont('Arial', '', 11);
|
||||||
|
$this->WriteHTML($body['bodyHead']['text']);
|
||||||
|
$this->Ln(5);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($body['bodyData'] as $key => $value) {
|
||||||
|
$this->SetX(30);
|
||||||
|
$this->SetFont('Arial', 'B', 11);
|
||||||
|
$this->Cell(50, 8, $key, 0, 0);
|
||||||
|
$this->SetFont('Arial', '', 11);
|
||||||
|
$this->MultiCell(0, 8, ': ' . $value, 0, 'L');
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($body['bodyNote'] as $note) {
|
||||||
|
$this->SectionTitle($note['judul']);
|
||||||
|
$this->SetFont('Arial', '', 11);
|
||||||
|
$this->WriteHTML($note['text']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$ttd = $body['bodyTTD'];
|
||||||
|
$this->Ln(15);
|
||||||
|
$this->Cell(0, 6, 'Hormat Kami,', 0, 1, 'L');
|
||||||
|
$this->Ln(20);
|
||||||
|
|
||||||
|
if (!empty($ttd['imgttd']) && file_exists($ttd['imgttd'])) {
|
||||||
|
$this->Image($ttd['imgttd'], 20, $this->GetY() - 20, 35);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->SetFont('Arial', 'B', 11);
|
||||||
|
$this->Cell(0, 6, $ttd['nama'], 0, 1, 'L');
|
||||||
|
$this->SetFont('Arial', '', 10);
|
||||||
|
$this->Cell(0, 6, $ttd['jabatan'], 0, 1, 'L');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ==========================================================
|
||||||
|
// 🔸 TEMPLATE + FUNCTION
|
||||||
|
// ==========================================================
|
||||||
|
function getTemplate($tempalateName)
|
||||||
|
{
|
||||||
|
if ($tempalateName == 'ba_pemasangan') {
|
||||||
|
$template = [
|
||||||
|
'header' => [
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
'body' => [
|
||||||
|
'bodyHead' => [
|
||||||
|
'text' => 'Terimakasih, Anda Telah Berlangganan Layanan Internet di {{1}}<br>Berikut Konfirmasi Detail Data sbb :'
|
||||||
|
],
|
||||||
|
|
||||||
|
'bodyData' => [
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
'bodyNote' => [
|
||||||
|
[
|
||||||
|
'judul' => 'CATATAN PENTING',
|
||||||
|
'text' => 'Untuk biaya pemasangan {{1}},- dibayar setelah pemasangan kepada teknisi. Tidak ada biaya tambahan, jika ada mohon laporkan kepada kami. Pembayaran bulanan dimulai bulan {{2}}. Internet dari tanggal {{3}} adalah gratis.<br>Kami menggunakan sistem pembayaran PRABAYAR, di mana pembayaran bulan {{4}} digunakan untuk layanan bulan tersebut. Wajib berlangganan minimal 6 bulan, jika berhenti sebelum 6 bulan akan dikenakan denda maksimal Rp. 500.000 (disesuaikan). Semua telah dijelaskan oleh teknisi dan diverifikasi oleh tim admin.'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'judul' => 'CARA PEMBAYARAN',
|
||||||
|
'text' => 'Pembayaran dapat dilakukan dengan mengklik tombol "Bayar Sekarang" atau melalui tautan yang dikirimkan pada pesan tagihan WhatsApp Official kami mulai bulan {{1}}.'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'judul' => 'LAYANAN PELANGGAN',
|
||||||
|
'text' => 'Jika ada kendala, silahkan hubungi Customer Service kami melalui WhatsApp : 081211610233 Dengan menyebutkan Nomor Layanan : {{1}} (tertera di stiker modem).'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'judul' => 'TENTANG KAMI',
|
||||||
|
'text' => 'PT. LINTAS JARINGAN NUSANTARA Kantor Layanan Cikembar adalah Penyedia Layanan Internet berbasis Fiber Optic dan Wireless. Kami melayani Corporate, Rumahan, serta Agency Hotspot Unlimited Kuota dengan berbagai pilihan paket menarik dan harga terjangkau. Selain itu kami juga menyediakan jasa setting jaringan LAN, Fiber Optic, Wireless, Web Designer, CCTV, dan lain sebagainya. Kami berkomitmen memberikan pelayanan terbaik, cepat, dan berkualitas kepada seluruh pelanggan kami.'
|
||||||
|
]
|
||||||
|
],
|
||||||
|
|
||||||
|
'bodyTTD' => [
|
||||||
|
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'footer' => [
|
||||||
|
'text' => 'PT. LINTAS JARINGAN NUSANTARA'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
elseif ($tempalateName == 'ba_perbaikan') {
|
||||||
|
$template = [
|
||||||
|
'header' => [
|
||||||
|
'imglogo' => 'assets/logo.png',
|
||||||
|
'nama_perusahaan' => 'PT. LINTAS JARINGAN NUSANTARA',
|
||||||
|
'kantor' => 'Jl. Raya Sukamaju No. 77, Cimahi',
|
||||||
|
'telp' => '0813-5678-9876',
|
||||||
|
'email' => 'support@lnj.co.id',
|
||||||
|
'website' => 'www.lnj.co.id',
|
||||||
|
],
|
||||||
|
'footer' => [
|
||||||
|
'text' => 'Dokumen Berita Acara Perbaikan',
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$template = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $template;
|
||||||
|
}
|
||||||
|
|
||||||
|
function mergeTemplateWithData($data)
|
||||||
|
{
|
||||||
|
$template = getTemplate($data['template_name']);
|
||||||
|
$result = $data;
|
||||||
|
|
||||||
|
// Header override
|
||||||
|
$result['header'] = array_merge($template['header'], $data['header']);
|
||||||
|
|
||||||
|
// BodyHead: replace {{1}}, {{2}} dst dengan parameter
|
||||||
|
if (!empty($template['body']['bodyHead']['text'])) {
|
||||||
|
$text = $template['body']['bodyHead']['text'];
|
||||||
|
$params = $data['body']['bodyHead']['parameter'] ?? [];
|
||||||
|
foreach ($params as $i => $val) {
|
||||||
|
$text = str_replace('{{' . ($i + 1) . '}}', $val, $text);
|
||||||
|
}
|
||||||
|
$result['body']['bodyHead']['text'] = $text;
|
||||||
|
}
|
||||||
|
|
||||||
|
// BodyData ambil dari data
|
||||||
|
$result['body']['bodyData'] = $data['body']['bodyData'];
|
||||||
|
|
||||||
|
// BodyNote
|
||||||
|
foreach ($template['body']['bodyNote'] as $i => $note) {
|
||||||
|
$text = $note['text'];
|
||||||
|
$params = $data['body']['bodyNote'][$i]['parameter'] ?? [];
|
||||||
|
foreach ($params as $p => $v) {
|
||||||
|
$text = str_replace('{{' . ($p + 1) . '}}', $v, $text);
|
||||||
|
}
|
||||||
|
$result['body']['bodyNote'][$i]['text'] = $text;
|
||||||
|
}
|
||||||
|
|
||||||
|
// BodyTTD override data (jika ada gambar)
|
||||||
|
$result['body']['bodyTTD'] = array_merge($template['body']['bodyTTD'], $data['body']['bodyTTD']);
|
||||||
|
|
||||||
|
// Footer
|
||||||
|
$result['footer'] = array_merge($template['footer'], $data['footer']);
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
?>
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 55 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 57 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 56 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 30 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 40 KiB |
@@ -0,0 +1,94 @@
|
|||||||
|
<?php
|
||||||
|
include '../config/connect.php';
|
||||||
|
require '../payment/flip/Flip/Transaction.php';
|
||||||
|
|
||||||
|
try {
|
||||||
|
$sql = "
|
||||||
|
SELECT
|
||||||
|
a.id,
|
||||||
|
a.transaction_id,
|
||||||
|
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.status = 'lewat'
|
||||||
|
AND a.transaction_id != ''
|
||||||
|
AND a.transaction_status = 'ACTIVE'
|
||||||
|
AND b.payment_gateway = 'flip'
|
||||||
|
AND b.status_payment_gateway = 'ACTIVE'
|
||||||
|
AND YEAR(a.limit_pembayaran) = YEAR(NOW())
|
||||||
|
AND MONTH(a.limit_pembayaran) = MONTH(NOW())
|
||||||
|
ORDER BY a.limit_pembayaran ASC
|
||||||
|
LIMIT 5
|
||||||
|
";
|
||||||
|
|
||||||
|
$stmt = $pdo->prepare($sql);
|
||||||
|
$stmt->execute();
|
||||||
|
$data = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
$results = [];
|
||||||
|
|
||||||
|
foreach ($data as $row) {
|
||||||
|
// Pastikan class FlipPaymentGateway ada di Transaction.php
|
||||||
|
$flip = new FlipPaymentGateway($row['apikey_payment_gateway'], $row['url_payment_gateway']);
|
||||||
|
|
||||||
|
// Ambil status bill
|
||||||
|
$response = $flip->getBillStatus($row['transaction_id']);
|
||||||
|
|
||||||
|
// Cek apakah respon valid dan mengandung link_id
|
||||||
|
if (!is_array($response) || empty($response['link_id'])) {
|
||||||
|
$results[] = [
|
||||||
|
'id' => $row['id'],
|
||||||
|
'transaction_id' => $row['transaction_id'],
|
||||||
|
'status' => 'error',
|
||||||
|
'message' => 'Invalid or missing response from Flip API'
|
||||||
|
];
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tampilkan respon dari Flip (opsional)
|
||||||
|
// print_r($response);
|
||||||
|
|
||||||
|
// Edit bill menjadi INACTIVE
|
||||||
|
// $delete = $flip->editBill(
|
||||||
|
// $response['link_id'],
|
||||||
|
// 'INACTIVE',
|
||||||
|
// $response['title'] ?? '',
|
||||||
|
// $response['amount'] ?? 0
|
||||||
|
// );
|
||||||
|
|
||||||
|
$results[] = [
|
||||||
|
'id' => $row['id'],
|
||||||
|
'transaction_id' => $row['transaction_id'],
|
||||||
|
'flip_response' => $response
|
||||||
|
];
|
||||||
|
|
||||||
|
// // Jika berhasil, update status di database
|
||||||
|
// if ($delete) {
|
||||||
|
// $update = $pdo->prepare("UPDATE tagihan SET transaction_status = :status WHERE id = :id");
|
||||||
|
// $update->execute([
|
||||||
|
// ':status' => 'INACTIVE',
|
||||||
|
// ':id' => $row['id']
|
||||||
|
// ]);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tampilkan hasil dari Flip (bukan data dari DB)
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
echo json_encode($results, JSON_PRETTY_PRINT);
|
||||||
|
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
echo json_encode([
|
||||||
|
'status' => 'error',
|
||||||
|
'message' => $e->getMessage()
|
||||||
|
]);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
echo json_encode([
|
||||||
|
'status' => 'error',
|
||||||
|
'message' => $e->getMessage()
|
||||||
|
]);
|
||||||
|
}
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
<?php
|
||||||
|
require_once __DIR__ . '/../minio/vendor/autoload.php';
|
||||||
|
|
||||||
|
use Aws\S3\S3Client;
|
||||||
|
use Aws\Exception\AwsException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Upload file ke MinIO storage
|
||||||
|
*/
|
||||||
|
// function uploadToMinioStorageRaw($imageData, $objectPath) {
|
||||||
|
// $minio = new S3Client([
|
||||||
|
// 'version' => 'latest',
|
||||||
|
// 'region' => 'us-east-1',
|
||||||
|
// 'endpoint' => 'https://storage.manjapro.net',
|
||||||
|
// 'use_path_style_endpoint' => true,
|
||||||
|
// 'credentials' => [
|
||||||
|
// 'key' => 'admin',
|
||||||
|
// 'secret' => '@P4ssw0rd',
|
||||||
|
// ],
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
// $bucket = 'files';
|
||||||
|
|
||||||
|
// try {
|
||||||
|
// $result = $minio->putObject([
|
||||||
|
// 'Bucket' => $bucket,
|
||||||
|
// 'Key' => $objectPath,
|
||||||
|
// 'Body' => $imageData, // <== langsung dari memori, bukan file
|
||||||
|
// 'ContentType' => 'image/png',
|
||||||
|
// 'ACL' => 'public-read',
|
||||||
|
// ]);
|
||||||
|
// return $result['ObjectURL'];
|
||||||
|
// } catch (Exception $e) {
|
||||||
|
// error_log('Upload MinIO gagal: ' . $e->getMessage());
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
function uploadToMinioStorageRaw($fileData, $objectPath)
|
||||||
|
{
|
||||||
|
// --- Inisialisasi koneksi MinIO ---
|
||||||
|
$minio = new S3Client([
|
||||||
|
'version' => 'latest',
|
||||||
|
'region' => 'us-east-1',
|
||||||
|
'endpoint' => 'https://storage.manjapro.net', // URL MinIO kamu
|
||||||
|
'use_path_style_endpoint' => true,
|
||||||
|
'credentials' => [
|
||||||
|
'key' => 'admin', // Ganti sesuai kredensial kamu
|
||||||
|
'secret' => '@P4ssw0rd', // Ganti sesuai kredensial kamu
|
||||||
|
],
|
||||||
|
'suppress_php_deprecation_warning' => true
|
||||||
|
]);
|
||||||
|
|
||||||
|
$bucket = 'files';
|
||||||
|
|
||||||
|
// --- Tentukan Content-Type berdasarkan ekstensi file ---
|
||||||
|
$ext = strtolower(pathinfo($objectPath, PATHINFO_EXTENSION));
|
||||||
|
switch ($ext) {
|
||||||
|
case 'jpg':
|
||||||
|
case 'jpeg':
|
||||||
|
$contentType = 'image/jpeg';
|
||||||
|
break;
|
||||||
|
case 'png':
|
||||||
|
$contentType = 'image/png';
|
||||||
|
break;
|
||||||
|
case 'pdf':
|
||||||
|
$contentType = 'application/pdf';
|
||||||
|
break;
|
||||||
|
case 'txt':
|
||||||
|
$contentType = 'text/plain';
|
||||||
|
break;
|
||||||
|
case 'json':
|
||||||
|
$contentType = 'application/json';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$contentType = 'application/octet-stream';
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// --- Upload langsung dari memori ke MinIO ---
|
||||||
|
$result = $minio->putObject([
|
||||||
|
'Bucket' => $bucket,
|
||||||
|
'Key' => $objectPath,
|
||||||
|
'Body' => $fileData,
|
||||||
|
'ContentType' => $contentType,
|
||||||
|
'ACL' => 'public-read', // agar bisa diakses publik
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $result['ObjectURL'];
|
||||||
|
} catch (AwsException $e) {
|
||||||
|
error_log('Upload MinIO gagal: ' . $e->getMessage());
|
||||||
|
return false;
|
||||||
|
} catch (Exception $e) {
|
||||||
|
error_log('Kesalahan umum: ' . $e->getMessage());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -1,12 +1,85 @@
|
|||||||
<?php
|
<?php
|
||||||
header("Content-Type: application/json");
|
// header("Content-Type: application/json");
|
||||||
|
|
||||||
// direktori upload
|
// // direktori upload
|
||||||
$uploadDir = __DIR__ . "/../img/pesan/";
|
// $uploadDir = __DIR__ . "/../img/pesan/";
|
||||||
if (!file_exists($uploadDir)) {
|
// if (!file_exists($uploadDir)) {
|
||||||
mkdir($uploadDir, 0777, true);
|
// mkdir($uploadDir, 0777, true);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if (!isset($_FILES['file'])) {
|
||||||
|
// echo json_encode(["status" => "error", "message" => "No file uploaded"]);
|
||||||
|
// exit;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $file = $_FILES['file'];
|
||||||
|
// $ext = strtolower(pathinfo($file['name'], PATHINFO_EXTENSION));
|
||||||
|
// $allowed = ['jpg', 'jpeg', 'png', 'gif'];
|
||||||
|
|
||||||
|
// if (!in_array($ext, $allowed)) {
|
||||||
|
// echo json_encode(["status" => "error", "message" => "Invalid file type"]);
|
||||||
|
// exit;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $newName = uniqid("img_") . "." . $ext;
|
||||||
|
// $target = $uploadDir . $newName;
|
||||||
|
|
||||||
|
// if (move_uploaded_file($file['tmp_name'], $target)) {
|
||||||
|
// $url = "https://manjapro.net/img/pesan/" . $newName;
|
||||||
|
// echo json_encode(["status" => "success", "url" => $url]);
|
||||||
|
// } else {
|
||||||
|
// echo json_encode(["status" => "error", "message" => "Failed to move file"]);
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
header("Content-Type: application/json");
|
||||||
|
require_once __DIR__ . '/../minio/vendor/autoload.php';
|
||||||
|
|
||||||
|
use Aws\S3\S3Client;
|
||||||
|
use Aws\Exception\AwsException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Upload file langsung ke MinIO storage
|
||||||
|
*/
|
||||||
|
function uploadToMinioStorageRawPesan($fileData, $objectPath, $contentType)
|
||||||
|
{
|
||||||
|
$minio = new S3Client([
|
||||||
|
'version' => 'latest',
|
||||||
|
'region' => 'us-east-1',
|
||||||
|
'endpoint' => 'https://storage.manjapro.net',
|
||||||
|
'use_path_style_endpoint' => true,
|
||||||
|
'credentials' => [
|
||||||
|
'key' => 'admin', // Ganti sesuai kredensial kamu
|
||||||
|
'secret' => '@P4ssw0rd', // Ganti sesuai kredensial kamu
|
||||||
|
],
|
||||||
|
'suppress_php_deprecation_warning' => true
|
||||||
|
]);
|
||||||
|
|
||||||
|
$bucket = 'files';
|
||||||
|
|
||||||
|
try {
|
||||||
|
$result = $minio->putObject([
|
||||||
|
'Bucket' => $bucket,
|
||||||
|
'Key' => $objectPath,
|
||||||
|
'Body' => $fileData,
|
||||||
|
'ContentType' => $contentType,
|
||||||
|
'ACL' => 'public-read',
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $result['ObjectURL'];
|
||||||
|
} catch (AwsException $e) {
|
||||||
|
error_log('Upload MinIO gagal: ' . $e->getMessage());
|
||||||
|
return false;
|
||||||
|
} catch (Exception $e) {
|
||||||
|
error_log('Kesalahan umum: ' . $e->getMessage());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------
|
||||||
|
// PROSES UPLOAD
|
||||||
|
// ------------------------------------------------------------
|
||||||
if (!isset($_FILES['file'])) {
|
if (!isset($_FILES['file'])) {
|
||||||
echo json_encode(["status" => "error", "message" => "No file uploaded"]);
|
echo json_encode(["status" => "error", "message" => "No file uploaded"]);
|
||||||
exit;
|
exit;
|
||||||
@@ -21,13 +94,36 @@ if (!in_array($ext, $allowed)) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$newName = uniqid("img_") . "." . $ext;
|
// Tentukan Content-Type
|
||||||
$target = $uploadDir . $newName;
|
switch ($ext) {
|
||||||
|
case 'jpg':
|
||||||
|
case 'jpeg':
|
||||||
|
$contentType = 'image/jpeg';
|
||||||
|
break;
|
||||||
|
case 'png':
|
||||||
|
$contentType = 'image/png';
|
||||||
|
break;
|
||||||
|
case 'gif':
|
||||||
|
$contentType = 'image/gif';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$contentType = 'application/octet-stream';
|
||||||
|
}
|
||||||
|
|
||||||
if (move_uploaded_file($file['tmp_name'], $target)) {
|
// Buat nama baru unik
|
||||||
$url = "https://manjapro.net/img/pesan/" . $newName;
|
$newName = uniqid("img_") . "." . $ext;
|
||||||
|
$objectPath = "pesan/" . $newName;
|
||||||
|
|
||||||
|
// Baca isi file dari temporary upload
|
||||||
|
$fileData = file_get_contents($file['tmp_name']);
|
||||||
|
|
||||||
|
// Upload langsung ke MinIO
|
||||||
|
$url = uploadToMinioStorageRawPesan($fileData, $objectPath, $contentType);
|
||||||
|
|
||||||
|
// Hasil respon
|
||||||
|
if ($url) {
|
||||||
echo json_encode(["status" => "success", "url" => $url]);
|
echo json_encode(["status" => "success", "url" => $url]);
|
||||||
} else {
|
} else {
|
||||||
echo json_encode(["status" => "error", "message" => "Failed to move file"]);
|
echo json_encode(["status" => "error", "message" => "Failed to upload to MinIO"]);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
<?php
|
||||||
|
header("Location: https://wa.me/62895326705144");
|
||||||
|
exit;
|
||||||
Vendored
+295
-174
@@ -1,51 +1,285 @@
|
|||||||
|
|
||||||
|
// document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
// fetch('list_data/get_upload_file.php')
|
||||||
|
// .then(response => response.json())
|
||||||
|
// .then(data => {
|
||||||
|
// data.forEach(item => {
|
||||||
|
// const uploadImage = document.querySelector(`.uploadImage[data-id="${item.formId}"]`);
|
||||||
|
// if (uploadImage) {
|
||||||
|
// const preview = uploadImage.querySelector('img');
|
||||||
|
// const spanText = uploadImage.querySelector('span');
|
||||||
|
// preview.src = `https://storage.manjapro.net/files/user/${item.fileName}`;
|
||||||
|
// preview.style.display = 'block';
|
||||||
|
// spanText.style.display = 'none';
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
|
||||||
|
// // upload.js
|
||||||
|
// document.querySelectorAll('.uploadImage').forEach(uploadImage => {
|
||||||
|
// uploadImage.addEventListener('click', function() {
|
||||||
|
// const fileInput = document.createElement('input');
|
||||||
|
// fileInput.type = 'file';
|
||||||
|
// fileInput.accept = 'image/*';
|
||||||
|
// fileInput.style.display = 'none';
|
||||||
|
|
||||||
|
// fileInput.addEventListener('change', function() {
|
||||||
|
// const file = this.files[0];
|
||||||
|
// const preview = uploadImage.querySelector('img');
|
||||||
|
// const spanText = uploadImage.querySelector('span');
|
||||||
|
|
||||||
|
// // Menampilkan preview gambar
|
||||||
|
// const reader = new FileReader();
|
||||||
|
// reader.onload = function(e) {
|
||||||
|
// preview.src = e.target.result;
|
||||||
|
// preview.style.display = 'block';
|
||||||
|
// spanText.style.display = 'none';
|
||||||
|
|
||||||
|
// compressAndUploadImage(file, uploadImage.dataset.id, uploadImage);
|
||||||
|
// };
|
||||||
|
// reader.readAsDataURL(file);
|
||||||
|
// });
|
||||||
|
|
||||||
|
// document.body.appendChild(fileInput);
|
||||||
|
// fileInput.click();
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
|
||||||
|
// function compressAndUploadImage(file, formId, uploadImage) {
|
||||||
|
// const reader = new FileReader();
|
||||||
|
// reader.readAsDataURL(file);
|
||||||
|
// reader.onload = function(event) {
|
||||||
|
// const img = new Image();
|
||||||
|
// img.src = event.target.result;
|
||||||
|
// img.onload = function() {
|
||||||
|
// const canvas = document.createElement('canvas');
|
||||||
|
// const ctx = canvas.getContext('2d');
|
||||||
|
|
||||||
|
// const maxWidth = img.width;
|
||||||
|
// const maxHeight = img.height;
|
||||||
|
// canvas.width = maxWidth;
|
||||||
|
// canvas.height = maxHeight;
|
||||||
|
// ctx.drawImage(img, 0, 0, maxWidth, maxHeight);
|
||||||
|
|
||||||
|
// let quality = 0.9;
|
||||||
|
// let dataUrl = canvas.toDataURL('image/jpeg', quality);
|
||||||
|
|
||||||
|
// // Mengurangi kualitas sampai ukuran gambar kurang dari 200KB
|
||||||
|
// while (dataUrl.length > 200 * 1024) {
|
||||||
|
// quality -= 0.05;
|
||||||
|
// dataUrl = canvas.toDataURL('image/jpeg', quality);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// fetch(dataUrl)
|
||||||
|
// .then(res => res.blob())
|
||||||
|
// .then(blob => {
|
||||||
|
// const formData = new FormData();
|
||||||
|
// formData.append('file', blob, file.name);
|
||||||
|
// formData.append('formId', formId);
|
||||||
|
|
||||||
|
// const xhr = new XMLHttpRequest();
|
||||||
|
// xhr.open('POST', 'list_data/upload_file.php', true);
|
||||||
|
|
||||||
|
// // Menangani proses upload dan persentase
|
||||||
|
// xhr.upload.onprogress = function(event) {
|
||||||
|
// if (event.lengthComputable) {
|
||||||
|
// const percentComplete = (event.loaded / event.total) * 100;
|
||||||
|
// const progressBar = uploadImage.querySelector('.progressBar');
|
||||||
|
// progressBar.style.width = percentComplete + '%';
|
||||||
|
// uploadImage.querySelector('.progressContainer').style.display = 'block';
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
|
||||||
|
// xhr.onload = function() {
|
||||||
|
// if (xhr.status === 200) {
|
||||||
|
// console.log('Success:', xhr.responseText);
|
||||||
|
// showUploadAnimation(uploadImage);
|
||||||
|
// } else {
|
||||||
|
// console.error('Error:', xhr.responseText);
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
|
||||||
|
// xhr.send(formData);
|
||||||
|
// });
|
||||||
|
// };
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
|
||||||
|
// function showUploadAnimation(uploadImage) {
|
||||||
|
// const uploaded = document.createElement('div');
|
||||||
|
// uploaded.innerText = 'Uploaded!';
|
||||||
|
// uploaded.style.position = 'absolute';
|
||||||
|
// uploaded.style.top = '0';
|
||||||
|
// uploaded.style.left = '0';
|
||||||
|
// uploaded.style.width = '100%';
|
||||||
|
// uploaded.style.height = '100%';
|
||||||
|
// uploaded.style.background = 'rgba(0, 128, 0, 0.5)';
|
||||||
|
// uploaded.style.color = 'white';
|
||||||
|
// uploaded.style.fontSize = '24px';
|
||||||
|
// uploaded.style.display = 'flex';
|
||||||
|
// uploaded.style.alignItems = 'center';
|
||||||
|
// uploaded.style.justifyContent = 'center';
|
||||||
|
// uploadImage.appendChild(uploaded);
|
||||||
|
|
||||||
|
// setTimeout(() => {
|
||||||
|
// uploaded.style.animation = 'fadeOut 2s forwards';
|
||||||
|
// setTimeout(() => {
|
||||||
|
// uploadImage.removeChild(uploaded);
|
||||||
|
// }, 2000);
|
||||||
|
// }, 1000); // Menampilkan teks "Uploaded!" selama 1 detik sebelum memulai animasi
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
// Tambah CSS otomatis (tanpa ganggu style .uploadImage)
|
||||||
|
const style = document.createElement('style');
|
||||||
|
style.innerHTML = `
|
||||||
|
.progressCircle {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
|
.progressSvg {
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
transform: rotate(-90deg);
|
||||||
|
}
|
||||||
|
.progressSvg .bg {
|
||||||
|
fill: none;
|
||||||
|
stroke: #eee;
|
||||||
|
stroke-width: 2;
|
||||||
|
}
|
||||||
|
.progressSvg .progress {
|
||||||
|
fill: none;
|
||||||
|
stroke: #04c224;
|
||||||
|
stroke-width: 2;
|
||||||
|
stroke-linecap: round;
|
||||||
|
stroke-dasharray: 100, 100;
|
||||||
|
stroke-dashoffset: 100;
|
||||||
|
transition: stroke-dashoffset 0.3s;
|
||||||
|
}
|
||||||
|
.progressText {
|
||||||
|
position: absolute;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 18px;
|
||||||
|
color: #333;
|
||||||
|
}`;
|
||||||
|
document.head.appendChild(style);
|
||||||
|
|
||||||
|
// URL gambar default (jika tidak ada file)
|
||||||
|
const defaultImage = 'https://storage.manjapro.net/files/user/default.jpg';
|
||||||
|
|
||||||
|
// Ambil data file existing dari server
|
||||||
fetch('list_data/get_upload_file.php')
|
fetch('list_data/get_upload_file.php')
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
|
// Tandai semua uploadImage sebagai belum diisi dulu
|
||||||
|
document.querySelectorAll('.uploadImage').forEach(upload => {
|
||||||
|
const preview = upload.querySelector('img');
|
||||||
|
const spanText = upload.querySelector('span');
|
||||||
|
preview.src = defaultImage;
|
||||||
|
preview.style.display = 'block';
|
||||||
|
spanText.style.display = 'none';
|
||||||
|
});
|
||||||
|
|
||||||
|
// Lalu isi jika ada data dari server
|
||||||
data.forEach(item => {
|
data.forEach(item => {
|
||||||
const uploadImage = document.querySelector(`.uploadImage[data-id="${item.formId}"]`);
|
const uploadImage = document.querySelector(`.uploadImage[data-id="${item.formId}"]`);
|
||||||
if (uploadImage) {
|
if (uploadImage) {
|
||||||
const preview = uploadImage.querySelector('img');
|
const preview = uploadImage.querySelector('img');
|
||||||
const spanText = uploadImage.querySelector('span');
|
const spanText = uploadImage.querySelector('span');
|
||||||
preview.src = `img/user/${item.fileName}`;
|
const fileName = item.fileName && item.fileName.trim() !== ''
|
||||||
|
? item.fileName
|
||||||
|
: 'default.jpg';
|
||||||
|
|
||||||
|
preview.src = `https://storage.manjapro.net/files/user/${fileName}`;
|
||||||
|
// preview.src = `https://storage.manjapro.net/files/user/${item.fileName}`;
|
||||||
preview.style.display = 'block';
|
preview.style.display = 'block';
|
||||||
spanText.style.display = 'none';
|
spanText.style.display = 'none';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
})
|
||||||
});
|
.catch(() => {
|
||||||
|
// Kalau gagal fetch (misal offline), isi semua dengan default
|
||||||
// upload.js
|
document.querySelectorAll('.uploadImage').forEach(upload => {
|
||||||
document.querySelectorAll('.uploadImage').forEach(uploadImage => {
|
const preview = upload.querySelector('img');
|
||||||
uploadImage.addEventListener('click', function() {
|
const spanText = upload.querySelector('span');
|
||||||
const fileInput = document.createElement('input');
|
preview.src = defaultImage;
|
||||||
fileInput.type = 'file';
|
|
||||||
fileInput.accept = 'image/*';
|
|
||||||
fileInput.style.display = 'none';
|
|
||||||
|
|
||||||
fileInput.addEventListener('change', function() {
|
|
||||||
const file = this.files[0];
|
|
||||||
const preview = uploadImage.querySelector('img');
|
|
||||||
const spanText = uploadImage.querySelector('span');
|
|
||||||
|
|
||||||
// Menampilkan preview gambar
|
|
||||||
const reader = new FileReader();
|
|
||||||
reader.onload = function(e) {
|
|
||||||
preview.src = e.target.result;
|
|
||||||
preview.style.display = 'block';
|
preview.style.display = 'block';
|
||||||
spanText.style.display = 'none';
|
spanText.style.display = 'none';
|
||||||
|
});
|
||||||
compressAndUploadImage(file, uploadImage.dataset.id, uploadImage);
|
|
||||||
};
|
|
||||||
reader.readAsDataURL(file);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
document.body.appendChild(fileInput);
|
// Klik upload
|
||||||
fileInput.click();
|
document.querySelectorAll('.uploadImage').forEach(uploadImage => {
|
||||||
|
uploadImage.addEventListener('click', function() {
|
||||||
|
const fileInput = document.createElement('input');
|
||||||
|
fileInput.type = 'file';
|
||||||
|
fileInput.accept = 'image/*';
|
||||||
|
fileInput.style.display = 'none';
|
||||||
|
|
||||||
|
fileInput.addEventListener('change', function() {
|
||||||
|
const file = this.files[0];
|
||||||
|
if (!file) return;
|
||||||
|
|
||||||
|
// Maksimum 20 MB
|
||||||
|
if (file.size > 20 * 1024 * 1024) {
|
||||||
|
alert('Ukuran file maksimal 20MB.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const preview = uploadImage.querySelector('img');
|
||||||
|
const spanText = uploadImage.querySelector('span');
|
||||||
|
const reader = new FileReader();
|
||||||
|
|
||||||
|
reader.onload = function(e) {
|
||||||
|
preview.src = e.target.result;
|
||||||
|
preview.style.display = 'block';
|
||||||
|
spanText.style.display = 'none';
|
||||||
|
compressAndUploadImage(file, uploadImage.dataset.id, uploadImage);
|
||||||
|
};
|
||||||
|
reader.readAsDataURL(file);
|
||||||
|
});
|
||||||
|
|
||||||
|
document.body.appendChild(fileInput);
|
||||||
|
fileInput.click();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Membuat progres circle di tengah
|
||||||
|
function createProgressCircle(uploadImage) {
|
||||||
|
let existing = uploadImage.querySelector('.progressCircle');
|
||||||
|
if (existing) return existing;
|
||||||
|
|
||||||
|
const circle = document.createElement('div');
|
||||||
|
circle.className = 'progressCircle';
|
||||||
|
circle.innerHTML = `
|
||||||
|
<svg class="progressSvg" viewBox="0 0 36 36">
|
||||||
|
<path class="bg" d="M18 2.0845
|
||||||
|
a 15.9155 15.9155 0 0 1 0 31.831
|
||||||
|
a 15.9155 15.9155 0 0 1 0 -31.831" />
|
||||||
|
<path class="progress" d="M18 2.0845
|
||||||
|
a 15.9155 15.9155 0 0 1 0 31.831
|
||||||
|
a 15.9155 15.9155 0 0 1 0 -31.831" />
|
||||||
|
</svg>
|
||||||
|
<div class="progressText">0%</div>`;
|
||||||
|
uploadImage.appendChild(circle);
|
||||||
|
return circle;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Kompres gambar dan upload
|
||||||
function compressAndUploadImage(file, formId, uploadImage) {
|
function compressAndUploadImage(file, formId, uploadImage) {
|
||||||
const reader = new FileReader();
|
const reader = new FileReader();
|
||||||
reader.readAsDataURL(file);
|
reader.readAsDataURL(file);
|
||||||
@@ -56,17 +290,28 @@ function compressAndUploadImage(file, formId, uploadImage) {
|
|||||||
const canvas = document.createElement('canvas');
|
const canvas = document.createElement('canvas');
|
||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
|
|
||||||
const maxWidth = img.width;
|
let width = img.width;
|
||||||
const maxHeight = img.height;
|
let height = img.height;
|
||||||
canvas.width = maxWidth;
|
const maxDim = 1920;
|
||||||
canvas.height = maxHeight;
|
|
||||||
ctx.drawImage(img, 0, 0, maxWidth, maxHeight);
|
// Resize kalau terlalu besar
|
||||||
|
if (width > height && width > maxDim) {
|
||||||
|
height = Math.round(height * (maxDim / width));
|
||||||
|
width = maxDim;
|
||||||
|
} else if (height > maxDim) {
|
||||||
|
width = Math.round(width * (maxDim / height));
|
||||||
|
height = maxDim;
|
||||||
|
}
|
||||||
|
|
||||||
|
canvas.width = width;
|
||||||
|
canvas.height = height;
|
||||||
|
ctx.drawImage(img, 0, 0, width, height);
|
||||||
|
|
||||||
let quality = 0.9;
|
let quality = 0.9;
|
||||||
let dataUrl = canvas.toDataURL('image/jpeg', quality);
|
let dataUrl = canvas.toDataURL('image/jpeg', quality);
|
||||||
|
|
||||||
// Mengurangi kualitas sampai ukuran gambar kurang dari 200KB
|
// Turunkan kualitas sampai di bawah 500 KB
|
||||||
while (dataUrl.length > 200 * 1024) {
|
while (dataUrl.length > 500 * 1024 && quality > 0.05) {
|
||||||
quality -= 0.05;
|
quality -= 0.05;
|
||||||
dataUrl = canvas.toDataURL('image/jpeg', quality);
|
dataUrl = canvas.toDataURL('image/jpeg', quality);
|
||||||
}
|
}
|
||||||
@@ -81,22 +326,31 @@ function compressAndUploadImage(file, formId, uploadImage) {
|
|||||||
const xhr = new XMLHttpRequest();
|
const xhr = new XMLHttpRequest();
|
||||||
xhr.open('POST', 'list_data/upload_file.php', true);
|
xhr.open('POST', 'list_data/upload_file.php', true);
|
||||||
|
|
||||||
// Menangani proses upload dan persentase
|
const progressContainer = createProgressCircle(uploadImage);
|
||||||
|
const progressPath = progressContainer.querySelector('.progressSvg .progress');
|
||||||
|
const progressText = progressContainer.querySelector('.progressText');
|
||||||
|
progressContainer.style.display = 'flex';
|
||||||
|
|
||||||
xhr.upload.onprogress = function(event) {
|
xhr.upload.onprogress = function(event) {
|
||||||
if (event.lengthComputable) {
|
if (event.lengthComputable) {
|
||||||
const percentComplete = (event.loaded / event.total) * 100;
|
const percentComplete = (event.loaded / event.total) * 100;
|
||||||
const progressBar = uploadImage.querySelector('.progressBar');
|
const dashoffset = 100 - percentComplete;
|
||||||
progressBar.style.width = percentComplete + '%';
|
progressPath.style.strokeDashoffset = dashoffset;
|
||||||
uploadImage.querySelector('.progressContainer').style.display = 'block';
|
progressText.textContent = Math.round(percentComplete) + '%';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
xhr.onload = function() {
|
xhr.onload = function() {
|
||||||
if (xhr.status === 200) {
|
if (xhr.status === 200) {
|
||||||
console.log('Success:', xhr.responseText);
|
progressPath.style.strokeDashoffset = 0;
|
||||||
showUploadAnimation(uploadImage);
|
progressText.textContent = 'Uploaded';
|
||||||
|
progressText.style.color = '#04c224';
|
||||||
|
setTimeout(() => {
|
||||||
|
progressContainer.style.display = 'none';
|
||||||
|
}, 1500);
|
||||||
} else {
|
} else {
|
||||||
console.error('Error:', xhr.responseText);
|
alert('Upload gagal.');
|
||||||
|
console.error(xhr.responseText);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -105,136 +359,3 @@ function compressAndUploadImage(file, formId, uploadImage) {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function showUploadAnimation(uploadImage) {
|
|
||||||
const uploaded = document.createElement('div');
|
|
||||||
uploaded.innerText = 'Uploaded!';
|
|
||||||
uploaded.style.position = 'absolute';
|
|
||||||
uploaded.style.top = '0';
|
|
||||||
uploaded.style.left = '0';
|
|
||||||
uploaded.style.width = '100%';
|
|
||||||
uploaded.style.height = '100%';
|
|
||||||
uploaded.style.background = 'rgba(0, 128, 0, 0.5)';
|
|
||||||
uploaded.style.color = 'white';
|
|
||||||
uploaded.style.fontSize = '24px';
|
|
||||||
uploaded.style.display = 'flex';
|
|
||||||
uploaded.style.alignItems = 'center';
|
|
||||||
uploaded.style.justifyContent = 'center';
|
|
||||||
uploadImage.appendChild(uploaded);
|
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
uploaded.style.animation = 'fadeOut 2s forwards';
|
|
||||||
setTimeout(() => {
|
|
||||||
uploadImage.removeChild(uploaded);
|
|
||||||
}, 2000);
|
|
||||||
}, 1000); // Menampilkan teks "Uploaded!" selama 1 detik sebelum memulai animasi
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// // upload.js
|
|
||||||
// document.getElementById('uploadImage').addEventListener('click', function() {
|
|
||||||
// document.getElementById('fileInput').click();
|
|
||||||
// });
|
|
||||||
|
|
||||||
// document.getElementById('fileInput').addEventListener('change', function() {
|
|
||||||
// var file = this.files[0];
|
|
||||||
// var preview = document.getElementById('preview');
|
|
||||||
// var spanText = document.querySelector('#uploadImage span');
|
|
||||||
|
|
||||||
// // Menampilkan preview gambar
|
|
||||||
// var reader = new FileReader();
|
|
||||||
// reader.onload = function(e) {
|
|
||||||
// preview.src = e.target.result;
|
|
||||||
// preview.style.display = 'block';
|
|
||||||
// spanText.style.display = 'none';
|
|
||||||
|
|
||||||
// compressAndUploadImage(file);
|
|
||||||
// };
|
|
||||||
// reader.readAsDataURL(file);
|
|
||||||
// });
|
|
||||||
|
|
||||||
// function compressAndUploadImage(file) {
|
|
||||||
// var reader = new FileReader();
|
|
||||||
// reader.readAsDataURL(file);
|
|
||||||
// reader.onload = function(event) {
|
|
||||||
// var img = new Image();
|
|
||||||
// img.src = event.target.result;
|
|
||||||
// img.onload = function() {
|
|
||||||
// var canvas = document.createElement('canvas');
|
|
||||||
// var ctx = canvas.getContext('2d');
|
|
||||||
|
|
||||||
// var maxWidth = img.width;
|
|
||||||
// var maxHeight = img.height;
|
|
||||||
// canvas.width = maxWidth;
|
|
||||||
// canvas.height = maxHeight;
|
|
||||||
// ctx.drawImage(img, 0, 0, maxWidth, maxHeight);
|
|
||||||
|
|
||||||
// var quality = 0.9;
|
|
||||||
// var dataUrl = canvas.toDataURL('image/jpeg', quality);
|
|
||||||
|
|
||||||
// // Mengurangi kualitas sampai ukuran gambar kurang dari 200KB
|
|
||||||
// while (dataUrl.length > 200 * 1024) {
|
|
||||||
// quality -= 0.05;
|
|
||||||
// dataUrl = canvas.toDataURL('image/jpeg', quality);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// fetch(dataUrl)
|
|
||||||
// .then(res => res.blob())
|
|
||||||
// .then(blob => {
|
|
||||||
// var formData = new FormData();
|
|
||||||
// formData.append('file', blob, file.name);
|
|
||||||
|
|
||||||
// var xhr = new XMLHttpRequest();
|
|
||||||
// xhr.open('POST', 'list_data/upload_file.php', true);
|
|
||||||
|
|
||||||
// // Menangani proses upload dan persentase
|
|
||||||
// xhr.upload.onprogress = function(event) {
|
|
||||||
// if (event.lengthComputable) {
|
|
||||||
// var percentComplete = (event.loaded / event.total) * 100;
|
|
||||||
// var progressBar = document.getElementById('progressBar');
|
|
||||||
// progressBar.style.width = percentComplete + '%';
|
|
||||||
// document.getElementById('progressContainer').style.display = 'block';
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
|
|
||||||
// xhr.onload = function() {
|
|
||||||
// if (xhr.status === 200) {
|
|
||||||
// console.log('Success:', xhr.responseText);
|
|
||||||
// showUploadAnimation();
|
|
||||||
// } else {
|
|
||||||
// console.error('Error:', xhr.responseText);
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
|
|
||||||
// xhr.send(formData);
|
|
||||||
// });
|
|
||||||
// };
|
|
||||||
// };
|
|
||||||
// }
|
|
||||||
|
|
||||||
// function showUploadAnimation() {
|
|
||||||
// var uploadImage = document.getElementById('uploadImage');
|
|
||||||
// var uploaded = document.createElement('div');
|
|
||||||
// uploaded.innerText = 'Loading...!';
|
|
||||||
// uploaded.style.position = 'absolute';
|
|
||||||
// uploaded.style.top = '0';
|
|
||||||
// uploaded.style.left = '0';
|
|
||||||
// uploaded.style.width = '100%';
|
|
||||||
// uploaded.style.height = '100%';
|
|
||||||
// uploaded.style.background = 'rgba(212, 212, 212, 0.7)';
|
|
||||||
// uploaded.style.color = 'black';
|
|
||||||
// uploaded.style.fontSize = '24px';
|
|
||||||
// uploaded.style.display = 'flex';
|
|
||||||
// uploaded.style.alignItems = 'center';
|
|
||||||
// uploaded.style.justifyContent = 'center';
|
|
||||||
// uploadImage.appendChild(uploaded);
|
|
||||||
|
|
||||||
// setTimeout(() => {
|
|
||||||
// uploaded.style.animation = 'fadeOut 2s forwards';
|
|
||||||
// setTimeout(() => {
|
|
||||||
// uploadImage.removeChild(uploaded);
|
|
||||||
// }, 2000);
|
|
||||||
// }, 1000); // Menampilkan teks "Uploaded!" selama 1 detik sebelum memulai animasi
|
|
||||||
// }
|
|
||||||
+125
-28
@@ -1,29 +1,126 @@
|
|||||||
<?php
|
<?php
|
||||||
session_start();
|
session_start();
|
||||||
|
require '../minio/vendor/autoload.php';
|
||||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
||||||
if (isset($_FILES['file']) && $_FILES['file']['error'] === UPLOAD_ERR_OK) {
|
use Aws\S3\S3Client;
|
||||||
$uploadDir = '../img/user/';
|
use Aws\S3\Exception\S3Exception;
|
||||||
$fileExt = ".".pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION);
|
|
||||||
$fileName = "bilspro_".date('YmdHis').$fileExt;
|
/**
|
||||||
$uploadFile = $uploadDir . $fileName;
|
* Buat koneksi MinIO
|
||||||
$formId = $_POST['formId'];
|
*/
|
||||||
|
function minioClient() {
|
||||||
if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadFile)) {
|
return new S3Client([
|
||||||
// Menyimpan nama file dalam variabel session
|
'version' => 'latest',
|
||||||
if (!isset($_SESSION['uploaded_files'])) {
|
'region' => 'us-east-1',
|
||||||
$_SESSION['uploaded_files'] = [];
|
'endpoint' => 'https://storage.manjapro.net',
|
||||||
}
|
'use_path_style_endpoint' => true,
|
||||||
$_SESSION['uploaded_files'][$formId] = $fileName;
|
'credentials' => [
|
||||||
|
'key' => 'admin',
|
||||||
echo 'File successfully uploaded.';
|
'secret' => '@P4ssw0rd',
|
||||||
} else {
|
],
|
||||||
echo 'Error uploading file.';
|
'suppress_php_deprecation_warning' => true,
|
||||||
}
|
]);
|
||||||
} else {
|
}
|
||||||
echo 'No file uploaded or upload error.';
|
|
||||||
}
|
/**
|
||||||
} else {
|
* Upload file ke MinIO
|
||||||
echo 'Invalid request method.';
|
*/
|
||||||
}
|
function minioUpload($bucket, $key, $sourceFile) {
|
||||||
|
$s3 = minioClient();
|
||||||
|
|
||||||
|
try {
|
||||||
|
$result = $s3->putObject([
|
||||||
|
'Bucket' => $bucket,
|
||||||
|
'Key' => $key,
|
||||||
|
'SourceFile' => $sourceFile,
|
||||||
|
'ACL' => 'public-read', // opsional
|
||||||
|
]);
|
||||||
|
return $result['ObjectURL'];
|
||||||
|
} catch (S3Exception $e) {
|
||||||
|
error_log("MinIO Upload Error: " . $e->getMessage());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Upload lokal dan MinIO
|
||||||
|
*/
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
|
|
||||||
|
if (isset($_FILES['file']) && $_FILES['file']['error'] === UPLOAD_ERR_OK) {
|
||||||
|
|
||||||
|
$uploadDir = '../img/user/';
|
||||||
|
if (!is_dir($uploadDir)) mkdir($uploadDir, 0777, true);
|
||||||
|
|
||||||
|
$fileExt = "." . pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION);
|
||||||
|
$fileName = "bilspro_" . date('YmdHis') . $fileExt;
|
||||||
|
$uploadFile = $uploadDir . $fileName;
|
||||||
|
$formId = $_POST['formId'];
|
||||||
|
|
||||||
|
// --- 1️⃣ Upload ke server lokal ---
|
||||||
|
if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadFile)) {
|
||||||
|
|
||||||
|
// --- 2️⃣ Upload ke MinIO ---
|
||||||
|
$minioUrl = minioUpload('files', 'user/' . $fileName, $uploadFile);
|
||||||
|
|
||||||
|
// Simpan info file ke session
|
||||||
|
if (!isset($_SESSION['uploaded_files'])) {
|
||||||
|
$_SESSION['uploaded_files'] = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$_SESSION['uploaded_files'][$formId] = $fileName;
|
||||||
|
// $_SESSION['uploaded_files'][$formId] = [
|
||||||
|
// 'local' => $fileName,
|
||||||
|
// 'minio' => $minioUrl ?: null
|
||||||
|
// ];
|
||||||
|
|
||||||
|
// --- Respons sukses ---
|
||||||
|
echo json_encode([
|
||||||
|
'status' => 'success',
|
||||||
|
'message' => 'File berhasil diupload.',
|
||||||
|
'local_path' => $uploadFile,
|
||||||
|
'minio_url' => $minioUrl
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
echo json_encode(['status' => 'error', 'message' => 'Gagal upload ke server lokal.']);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
echo json_encode(['status' => 'error', 'message' => 'Tidak ada file diupload atau terjadi error.']);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
echo json_encode(['status' => 'error', 'message' => 'Invalid request method.']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// session_start();
|
||||||
|
|
||||||
|
// if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
|
// if (isset($_FILES['file']) && $_FILES['file']['error'] === UPLOAD_ERR_OK) {
|
||||||
|
// $uploadDir = '../img/user/';
|
||||||
|
// $fileExt = ".".pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION);
|
||||||
|
// $fileName = "bilspro_".date('YmdHis').$fileExt;
|
||||||
|
// $uploadFile = $uploadDir . $fileName;
|
||||||
|
// $formId = $_POST['formId'];
|
||||||
|
|
||||||
|
// if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadFile)) {
|
||||||
|
// // Menyimpan nama file dalam variabel session
|
||||||
|
// if (!isset($_SESSION['uploaded_files'])) {
|
||||||
|
// $_SESSION['uploaded_files'] = [];
|
||||||
|
// }
|
||||||
|
// $_SESSION['uploaded_files'][$formId] = $fileName;
|
||||||
|
|
||||||
|
// echo 'File successfully uploaded.';
|
||||||
|
// } else {
|
||||||
|
// echo 'Error uploading file.';
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// echo 'No file uploaded or upload error.';
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// echo 'Invalid request method.';
|
||||||
|
// }
|
||||||
?>
|
?>
|
||||||
+58
-24
@@ -1,10 +1,11 @@
|
|||||||
const { exec } = require('child_process');
|
const { exec } = require('child_process');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
// Jalur ke executable PHP
|
// === Konfigurasi dasar ===
|
||||||
const phpExecutablePath = '/www/server/php/74/bin/php';
|
const phpExecutablePath = '/www/server/php/74/bin/php';
|
||||||
|
|
||||||
// Daftar jalur ke file PHP
|
// Daftar file PHP utama
|
||||||
const phpScriptPaths = [
|
const phpScriptPaths = [
|
||||||
path.join(__dirname, 'load_pesan.php'),
|
path.join(__dirname, 'load_pesan.php'),
|
||||||
path.join(__dirname, 'load_tagihan_flip.php'),
|
path.join(__dirname, 'load_tagihan_flip.php'),
|
||||||
@@ -12,47 +13,80 @@ const phpScriptPaths = [
|
|||||||
path.join(__dirname, 'load_tagihan_paydisini.php'),
|
path.join(__dirname, 'load_tagihan_paydisini.php'),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// File tambahan (jalan tiap 1 detik)
|
||||||
// --- File tambahan setiap 1 detik ---
|
|
||||||
const loadWAOfficialPath = path.join(__dirname, 'load_pesan_official.php');
|
const loadWAOfficialPath = path.join(__dirname, 'load_pesan_official.php');
|
||||||
|
|
||||||
// Fungsi untuk menjalankan 1 file PHP (Promise)
|
// === Pengaturan Log ===
|
||||||
|
const LOG_DIR = path.join(__dirname, 'logs');
|
||||||
|
const LOG_FILE = path.join(LOG_DIR, 'service.log');
|
||||||
|
const MAX_LOG_SIZE = 5 * 1024 * 1024; // 5MB per file
|
||||||
|
|
||||||
|
// Pastikan folder logs ada
|
||||||
|
if (!fs.existsSync(LOG_DIR)) fs.mkdirSync(LOG_DIR);
|
||||||
|
|
||||||
|
// Fungsi menulis log efisien (rotasi otomatis)
|
||||||
|
function writeLog(message, isError = false) {
|
||||||
|
const timestamp = new Date().toISOString();
|
||||||
|
const formatted = `[${timestamp}] ${isError ? '[ERROR]' : '[INFO] '} ${message}\n`;
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Cek ukuran file log
|
||||||
|
if (fs.existsSync(LOG_FILE) && fs.statSync(LOG_FILE).size > MAX_LOG_SIZE) {
|
||||||
|
const old = LOG_FILE.replace('.log', `_${Date.now()}.log`);
|
||||||
|
fs.renameSync(LOG_FILE, old);
|
||||||
|
}
|
||||||
|
fs.appendFileSync(LOG_FILE, formatted, { encoding: 'utf8' });
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Log write failed:', e.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fungsi menjalankan file PHP
|
||||||
function runPhpScript(phpScriptPath) {
|
function runPhpScript(phpScriptPath) {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
console.log(`Running command: ${phpExecutablePath} ${phpScriptPath}`);
|
const cmd = `${phpExecutablePath} ${phpScriptPath}`;
|
||||||
exec(`${phpExecutablePath} ${phpScriptPath}`, (error, stdout, stderr) => {
|
writeLog(`Running command: ${cmd}`);
|
||||||
|
|
||||||
|
exec(cmd, { maxBuffer: 10 * 1024 * 1024 }, (error, stdout, stderr) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
console.error(`Error executing PHP script ${phpScriptPath}: ${error.message}`);
|
writeLog(`Error executing PHP script ${phpScriptPath}: ${error.message}`, true);
|
||||||
} else if (stderr) {
|
} else if (stderr && stderr.trim()) {
|
||||||
console.error(`PHP script ${phpScriptPath} stderr: ${stderr}`);
|
writeLog(`PHP script ${phpScriptPath} stderr: ${stderr.trim()}`, true);
|
||||||
} else {
|
} else if (stdout && stdout.trim()) {
|
||||||
console.log(`PHP script ${phpScriptPath} output: ${stdout}`);
|
// Batasi panjang log agar efisien
|
||||||
|
const output = stdout.trim().substring(0, 300);
|
||||||
|
writeLog(`PHP script ${phpScriptPath} output: ${output}${stdout.length > 300 ? '...' : ''}`);
|
||||||
}
|
}
|
||||||
resolve(); // tetap resolve biar lanjut meskipun error
|
resolve();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fungsi utama
|
// Fungsi utama untuk load semua script (5–15 detik)
|
||||||
async function runPhpScripts() {
|
async function runPhpScripts() {
|
||||||
// Jalankan semua script secara paralel
|
|
||||||
await Promise.all(phpScriptPaths.map(runPhpScript));
|
await Promise.all(phpScriptPaths.map(runPhpScript));
|
||||||
|
|
||||||
// Random delay 5–15 detik
|
|
||||||
const nextDelay = Math.floor(Math.random() * (10000 - 5000 + 1)) + 5000;
|
const nextDelay = Math.floor(Math.random() * (10000 - 5000 + 1)) + 5000;
|
||||||
console.log(`Next run in ${nextDelay / 1000} seconds\n`);
|
writeLog(`Next run in ${nextDelay / 1000} seconds`);
|
||||||
|
|
||||||
// Jalankan lagi setelah delay
|
|
||||||
setTimeout(runPhpScripts, nextDelay);
|
setTimeout(runPhpScripts, nextDelay);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fungsi loop cepat (1 detik)
|
// Fungsi loop khusus loadWAOfficial (tiap 1 detik)
|
||||||
function runLoadWAOfficial() {
|
async function runLoadWAOfficial() {
|
||||||
runPhpScript(loadWAOfficialPath).then(() => {
|
try {
|
||||||
setTimeout(runLoadWAOfficial, 1000);
|
await runPhpScript(loadWAOfficialPath);
|
||||||
});
|
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||||
|
runLoadWAOfficial();
|
||||||
|
} catch (error) {
|
||||||
|
writeLog(`Error saat menjalankan loadWAOfficial: ${error.message}`, true);
|
||||||
|
setTimeout(runLoadWAOfficial, 5000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tangani error global agar tidak crash
|
||||||
|
process.on('unhandledRejection', err => writeLog(`Unhandled Rejection: ${err.message}`, true));
|
||||||
|
process.on('uncaughtException', err => writeLog(`Uncaught Exception: ${err.message}`, true));
|
||||||
|
|
||||||
// Jalankan pertama kali
|
// Jalankan pertama kali
|
||||||
runPhpScripts();
|
runPhpScripts();
|
||||||
runLoadWAOfficial();
|
runLoadWAOfficial();
|
||||||
|
|||||||
@@ -71,12 +71,16 @@ try {
|
|||||||
$sekarang = date('Y-m-d');
|
$sekarang = date('Y-m-d');
|
||||||
|
|
||||||
if ($sekarang === $cektanggal) {
|
if ($sekarang === $cektanggal) {
|
||||||
|
|
||||||
|
$keteranganName = ucwords(strtolower(preg_replace('/[^a-zA-Z\s]/', '', $data['nama'])));
|
||||||
|
$keteranganFlip = str_replace('Layanan Internet ', '', $data['keterangan']) . " (an. " . $keteranganName . ")";
|
||||||
|
|
||||||
// Buat link payment gateway
|
// Buat link payment gateway
|
||||||
require '../payment/flip/Flip/Transaction.php';
|
require '../payment/flip/Flip/Transaction.php';
|
||||||
$flip = new FlipPaymentGateway($apiKey, $apiUrl);
|
$flip = new FlipPaymentGateway($apiKey, $apiUrl);
|
||||||
|
|
||||||
$response = $flip->createBill(
|
$response = $flip->createBill(
|
||||||
sanitizeString($data['keterangan']),
|
sanitizeString($keteranganFlip),
|
||||||
sanitizeString($data['verifikasi_tagihan']),
|
sanitizeString($data['verifikasi_tagihan']),
|
||||||
$data['email'],
|
$data['email'],
|
||||||
sanitizeString($data['nama']),
|
sanitizeString($data['nama']),
|
||||||
@@ -100,8 +104,9 @@ try {
|
|||||||
':transaction_status' => $transaction_status,
|
':transaction_status' => $transaction_status,
|
||||||
':idtag' => $data['id']
|
':idtag' => $data['id']
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
echo "[SUCCESS] {$data['nama']} ({$data['id']}) link dibuat.\n";
|
echo "[SUCCESS] {$data['nama']} ({$data['id']}) Server Id :{$data['id_data_server']} , link dibuat.\n";
|
||||||
$linkCreated = true; // Set penanda ada link dibuat
|
$linkCreated = true; // Set penanda ada link dibuat
|
||||||
} else {
|
} else {
|
||||||
error_log("[ERROR] Flip API gagal untuk tagihan ID {$data['id']}");
|
error_log("[ERROR] Flip API gagal untuk tagihan ID {$data['id']}");
|
||||||
|
|||||||
@@ -1,117 +1,121 @@
|
|||||||
[16:00:01] [OK] 103.26.176.81
|
[17:42:01] [OK] 103.26.176.81
|
||||||
[16:00:01] [OK] 103.188.169.123
|
[17:42:01] [OK] 103.188.169.123
|
||||||
[16:00:01] [OK] 103.26.176.85
|
[17:42:01] [OK] 103.26.176.85
|
||||||
[16:00:01] [OK] 103.188.169.121
|
[17:42:01] [OK] 103.188.169.121
|
||||||
[16:00:01] [OK] 103.26.176.83
|
[17:42:01] [OK] 103.26.176.83
|
||||||
[16:00:01] [OK] 103.155.198.185
|
[17:42:01] [OK] tunnel.manjapro.net
|
||||||
[16:00:02] [OK] tunnel.manjapro.net
|
[17:42:01] [OK] tunnel.manjapro.net
|
||||||
[16:00:02] [OK] tunnel.manjapro.net
|
[17:42:01] [OK] tunnel.manjapro.net
|
||||||
[16:00:02] [OK] 103.188.169.127
|
[17:42:01] [OK] tunnel.manjapro.net
|
||||||
[16:00:02] [OK] tunnel.manjapro.net
|
[17:42:01] [OK] 103.155.198.185
|
||||||
[16:00:02] [OK] tunnel.manjapro.net
|
[17:42:01] [OK] 103.188.169.127
|
||||||
[16:00:02] [OK] tunnel.manjapro.net
|
[17:42:01] [OK] tunnel.manjapro.net
|
||||||
[16:00:02] [OK] 157.20.128.231
|
[17:42:02] [OK] tunnel.manjapro.net
|
||||||
[16:00:02] [OK] tunnel.manjapro.net
|
[17:42:02] [OK] 103.26.176.87
|
||||||
[16:00:02] [OK] tunnel.manjapro.net
|
[17:42:02] [OK] tunnel.manjapro.net
|
||||||
[16:00:02] [OK] 103.155.196.145
|
[17:42:02] [OK] 103.236.190.109
|
||||||
[16:00:02] [OK] 103.26.176.93
|
[17:42:02] [OK] tunnel.manjapro.net
|
||||||
[16:00:03] [OK] 103.242.104.69
|
[17:42:02] [OK] 103.26.176.93
|
||||||
[16:00:03] [OK] tunnel.manjapro.net
|
[17:42:02] [OK] 103.155.196.145
|
||||||
[16:00:03] [OK] 103.94.10.112
|
[17:42:02] [OK] 103.242.104.69
|
||||||
[16:00:03] [OK] tunnel.manjapro.net
|
[17:42:02] [OK] 103.31.233.237
|
||||||
[16:00:03] [OK] 103.31.233.237
|
[17:42:02] [OK] gusjampang.xyz
|
||||||
[16:00:03] [OK] tunnel.manjapro.net
|
[17:42:03] [OK] tunnel.manjapro.net
|
||||||
[16:00:03] [OK] 103.18.79.171
|
[17:42:03] [OK] tunnel.manjapro.net
|
||||||
[16:00:04] [OK] 103.26.176.87
|
[17:42:03] [OK] 103.18.79.171
|
||||||
[16:00:04] [OK] 103.155.199.191
|
[17:42:03] [OK] 103.155.199.191
|
||||||
[16:00:04] [OK] tunnel.manjapro.net
|
[17:42:04] [OK] tunnel.manjapro.net
|
||||||
[16:00:04] [OK] tunnel.manjapro.net
|
[17:42:04] [OK] 103.242.106.56
|
||||||
[16:00:04] [OK] tunnel.manjapro.net
|
[17:42:05] [FAIL] 103.67.80.126
|
||||||
[16:00:05] [OK] 103.236.190.109
|
[17:42:05] [FAIL] 157.20.128.231
|
||||||
[16:00:05] [OK] 103.242.106.56
|
[17:42:05] [OK] tunnel.manjapro.net
|
||||||
[16:00:05] [FAIL] 103.67.80.126
|
[17:42:06] [FAIL] tunnel.bilspro.com
|
||||||
[16:00:06] [FAIL] tunnel.bilspro.com
|
[17:42:06] [FAIL] tunnel.bilspro.com
|
||||||
[16:00:06] [FAIL] tunnel.bilspro.com
|
[17:42:06] [FAIL] 103.94.10.240
|
||||||
[16:00:07] [FAIL] 103.94.10.240
|
[17:42:06] [OK] tunnel.manjapro.net
|
||||||
[16:00:07] [FAIL] 103.94.10.240
|
[17:42:07] [FAIL] 103.94.10.240
|
||||||
[16:00:08] [FAIL] 103.94.10.240
|
[17:42:07] [FAIL] 103.94.10.240
|
||||||
[16:00:08] [OK] tunnel.manjapro.net
|
[17:42:07] [OK] tunnel.manjapro.net
|
||||||
[16:00:08] [FAIL] tunnel.bilspro.com
|
[17:42:08] [FAIL] tunnel.bilspro.com
|
||||||
[16:00:09] [FAIL] infinnet.cloud
|
[17:42:09] [FAIL] infinnet.cloud
|
||||||
[16:00:09] [OK] tunnel.manjapro.net
|
[17:42:09] [OK] tunnel.manjapro.net
|
||||||
[16:00:09] [OK] tunnel.manjapro.net
|
[17:42:09] [OK] tunnel.manjapro.net
|
||||||
[16:00:09] [FAIL] 103.155.198.109
|
[17:42:09] [OK] tunnel.manjapro.net
|
||||||
[16:00:09] [OK] tunnel.manjapro.net
|
[17:42:10] [OK] tunnel.manjapro.net
|
||||||
[16:00:10] [OK] tunnel.manjapro.net
|
[17:42:10] [OK] tunnel.manjapro.net
|
||||||
[16:00:10] [OK] tunnel.manjapro.net
|
[17:42:10] [OK] tunnel.manjapro.net
|
||||||
[16:00:10] [OK] tunnel.manjapro.net
|
[17:42:10] [OK] tunnel.manjapro.net
|
||||||
[16:00:10] [OK] tunnel.manjapro.net
|
[17:42:10] [OK] tunnel.manjapro.net
|
||||||
[16:00:10] [OK] tunnel.manjapro.net
|
[17:42:11] [FAIL] infinnet.cloud
|
||||||
[16:00:11] [FAIL] infinnet.cloud
|
[17:42:11] [FAIL] tunnel.bilspro.com
|
||||||
[16:00:11] [FAIL] tunnel.bilspro.com
|
[17:42:11] [FAIL] 103.155.198.109
|
||||||
[16:00:11] [OK] tunnel.manjapro.net
|
[17:42:11] [OK] tunnel.manjapro.net
|
||||||
[16:00:14] [FAIL] tunnel.manjapro.net
|
[17:42:15] [FAIL] tunnel.manjapro.net
|
||||||
[16:00:15] [FAIL] 103.103.147.225
|
[17:42:16] [FAIL] 157.20.12
|
||||||
[16:00:15] [FAIL] 157.20.12
|
[17:42:16] [FAIL] tunnel.manjapro.net
|
||||||
[16:00:15] [FAIL] 114.141.51.12
|
[17:42:16] [FAIL] 114.141.51.12
|
||||||
[16:00:17] [FAIL] 114.141.51.12
|
[17:42:16] [FAIL] 114.141.51.12
|
||||||
[2025-10-18 16:00:17] Semua child selesai. Mulai update DB...
|
[17:42:17] [FAIL] 103.103.147.225
|
||||||
[16:00:17] [UPDATE DB] 03FK-Q7XE1
|
[17:42:20] [FAIL] tunnel.manjapro.net
|
||||||
[16:00:17] [UPDATE DB] IDLF-SK944
|
[2025-11-10 17:42:20] Semua child selesai. Mulai update DB...
|
||||||
[16:00:17] [UPDATE DB] TYF0-3RP75
|
[17:42:20] [UPDATE DB] 03FK-Q7XE1
|
||||||
[16:00:18] [UPDATE DB] 0YDS-EI1V6
|
[17:42:20] [UPDATE DB] IDLF-SK944
|
||||||
[16:00:18] [UPDATE DB] C7CU-PGT97
|
[17:42:20] [UPDATE DB] TYF0-3RP75
|
||||||
[16:00:18] [UPDATE STATUS] 7FZH-WIBI8 (Disconnected -> Disconnected)
|
[17:42:20] [UPDATE DB] 0YDS-EI1V6
|
||||||
[16:00:19] [UPDATE DB] YHVJ-ZN9V9
|
[17:42:20] [UPDATE DB] C7CU-PGT97
|
||||||
[16:00:20] [UPDATE DB] C7CU-PGT910
|
[17:42:20] [UPDATE STATUS] 7FZH-WIBI8 (Disconnected -> Disconnected)
|
||||||
[16:00:20] [UPDATE DB] MPK0-Q43P11
|
[17:42:20] [UPDATE DB] YHVJ-ZN9V9
|
||||||
[16:00:20] [UPDATE DB] S9QL-XRJ512
|
[17:42:20] [UPDATE DB] C7CU-PGT910
|
||||||
[16:00:21] [UPDATE DB] HHJH-UFWL14
|
[17:42:20] [UPDATE DB] MPK0-Q43P11
|
||||||
[16:00:21] [UPDATE DB] 03FK-Q7XE15
|
[17:42:20] [UPDATE DB] S9QL-XRJ512
|
||||||
[16:00:21] [UPDATE DB] DG7B-JP4218
|
[17:42:20] [UPDATE DB] HHJH-UFWL14
|
||||||
[16:00:21] [UPDATE DB] XXWL-VMH419
|
[17:42:20] [UPDATE DB] 03FK-Q7XE15
|
||||||
[16:00:21] [UPDATE DB] 03FK-Q7XE20
|
[17:42:20] [UPDATE DB] DG7B-JP4218
|
||||||
[16:00:21] [UPDATE DB] C7CU-PGT922
|
[17:42:20] [UPDATE DB] XXWL-VMH419
|
||||||
[16:00:21] [UPDATE DB] 8FHL-TXVS23
|
[17:42:20] [UPDATE DB] 03FK-Q7XE20
|
||||||
[16:00:21] [UPDATE DB] Q23C-IE2524
|
[17:42:20] [UPDATE DB] C7CU-PGT922
|
||||||
[16:00:21] [UPDATE DB] Q4D5-ATUM25
|
[17:42:20] [UPDATE DB] 8FHL-TXVS23
|
||||||
[16:00:21] [UPDATE DB] HHJH-UFWL28
|
[17:42:20] [UPDATE DB] Q23C-IE2524
|
||||||
[16:00:21] [UPDATE DB] 11P4-SII029
|
[17:42:20] [UPDATE STATUS] Q4D5-ATUM25 (Disconnected -> Disconnected)
|
||||||
[16:00:21] [UPDATE DB] CUAA-CD2K30
|
[17:42:20] [UPDATE DB] 03FK-Q7XE28
|
||||||
[16:00:21] [UPDATE DB] S1Z8-TK6932
|
[17:42:20] [UPDATE DB] 11P4-SII029
|
||||||
[16:00:21] [UPDATE DB] H67G-R4AK33
|
[17:42:20] [UPDATE DB] CUAA-CD2K30
|
||||||
[16:00:21] [UPDATE STATUS] 9RV7-3W5U34 (Disconnected -> Disconnected)
|
[17:42:20] [UPDATE DB] 03FK-Q7XE32
|
||||||
[16:00:21] [UPDATE DB] 32PA-DAZ435
|
[17:42:20] [UPDATE DB] H67G-R4AK33
|
||||||
[16:00:21] [UPDATE STATUS] LJQ6-KDDJ37 (Disconnected -> Disconnected)
|
[17:42:20] [UPDATE STATUS] 9RV7-3W5U34 (Disconnected -> Disconnected)
|
||||||
[16:00:21] [UPDATE DB] 0TW0-J74U38
|
[17:42:20] [UPDATE DB] 32PA-DAZ435
|
||||||
[16:00:21] [UPDATE DB] L7TJ-IF2G39
|
[17:42:20] [UPDATE STATUS] LJQ6-KDDJ37 (Disconnected -> Disconnected)
|
||||||
[16:00:21] [UPDATE DB] RWDJ-NXBZ40
|
[17:42:20] [UPDATE DB] 0TW0-J74U38
|
||||||
[16:00:21] [UPDATE DB] A26W-ART341
|
[17:42:20] [UPDATE DB] L7TJ-IF2G39
|
||||||
[16:00:21] [UPDATE STATUS] RE5H-G12Y42 (Disconnected -> Disconnected)
|
[17:42:20] [UPDATE DB] RWDJ-NXBZ40
|
||||||
[16:00:21] [UPDATE STATUS] 03FK-Q7XE43 (Disconnected -> Disconnected)
|
[17:42:20] [UPDATE DB] A26W-ART341
|
||||||
[16:00:21] [UPDATE STATUS] Q96U-20UZ44 (Disconnected -> Disconnected)
|
[17:42:20] [UPDATE STATUS] RE5H-G12Y42 (Disconnected -> Disconnected)
|
||||||
[16:00:21] [UPDATE DB] D3TU-JN5745
|
[17:42:20] [UPDATE STATUS] 03FK-Q7XE43 (Disconnected -> Disconnected)
|
||||||
[16:00:21] [UPDATE DB] 7SDF-17X546
|
[17:42:20] [UPDATE STATUS] Q96U-20UZ44 (Disconnected -> Disconnected)
|
||||||
[16:00:21] [UPDATE DB] HMAZ-3HSX51
|
[17:42:20] [UPDATE DB] D3TU-JN5745
|
||||||
[16:00:21] [UPDATE STATUS] PQJB-HG8V53 (Disconnected -> Disconnected)
|
[17:42:20] [UPDATE DB] 7SDF-17X546
|
||||||
[16:00:21] [UPDATE STATUS] PMA9-QC7654 (Disconnected -> Disconnected)
|
[17:42:20] [UPDATE DB] HMAZ-3HSX51
|
||||||
[16:00:21] [UPDATE STATUS] 7ZCI-NFCI62 (Disconnected -> Disconnected)
|
[17:42:20] [UPDATE STATUS] PQJB-HG8V53 (Disconnected -> Disconnected)
|
||||||
[16:00:21] [UPDATE STATUS] 0E73-PABK63 (Disconnected -> Disconnected)
|
[17:42:20] [UPDATE STATUS] PMA9-QC7654 (Disconnected -> Disconnected)
|
||||||
[16:00:21] [UPDATE STATUS] 4MZF-SFTR65 (Disconnected -> Disconnected)
|
[17:42:20] [UPDATE STATUS] 7ZCI-NFCI62 (Disconnected -> Disconnected)
|
||||||
[16:00:21] [UPDATE STATUS] PJC8-K0EG66 (Disconnected -> Disconnected)
|
[17:42:20] [UPDATE STATUS] 0E73-PABK63 (Disconnected -> Disconnected)
|
||||||
[16:00:21] [UPDATE STATUS] 351D-5NCH67 (Disconnected -> Disconnected)
|
[17:42:20] [UPDATE STATUS] 4MZF-SFTR65 (Disconnected -> Disconnected)
|
||||||
[16:00:21] [UPDATE STATUS] A0S7-K2IC69 (Disconnected -> Disconnected)
|
[17:42:20] [UPDATE STATUS] PJC8-K0EG66 (Disconnected -> Disconnected)
|
||||||
[16:00:21] [UPDATE DB] G9Z1-HRLY70
|
[17:42:20] [UPDATE STATUS] 351D-5NCH67 (Disconnected -> Disconnected)
|
||||||
[16:00:21] [UPDATE STATUS] C7CU-PGT972 (Disconnected -> Disconnected)
|
[17:42:20] [UPDATE STATUS] A0S7-K2IC69 (Disconnected -> Disconnected)
|
||||||
[16:00:21] [UPDATE DB] 66AU-Z7I573
|
[17:42:20] [UPDATE DB] G9Z1-HRLY70
|
||||||
[16:00:21] [UPDATE DB] S9QL-XRJ575
|
[17:42:20] [UPDATE STATUS] C7CU-PGT972 (Disconnected -> Disconnected)
|
||||||
[16:00:21] [UPDATE DB] ABMS-YBP776
|
[17:42:20] [UPDATE DB] 66AU-Z7I573
|
||||||
[16:00:21] [UPDATE DB] C7CU-PGT977
|
[17:42:20] [UPDATE DB] S9QL-XRJ575
|
||||||
[16:00:21] [UPDATE DB] C7CU-PGT978
|
[17:42:20] [UPDATE DB] ABMS-YBP776
|
||||||
[16:00:21] [UPDATE DB] HHJH-UFWL81
|
[17:42:20] [UPDATE DB] C7CU-PGT977
|
||||||
[16:00:21] [UPDATE DB] 83
|
[17:42:20] [UPDATE DB] C7CU-PGT978
|
||||||
[16:00:21] [UPDATE STATUS] RNS6-DB3N84 (Disconnected -> Disconnected)
|
[17:42:20] [UPDATE DB] HHJH-UFWL81
|
||||||
[16:00:21] [UPDATE DB] C7CU-PGT987
|
[17:42:20] [UPDATE DB] 83
|
||||||
[16:00:21] [UPDATE DB] ZMVC-KAFH88
|
[17:42:20] [UPDATE STATUS] RNS6-DB3N84 (Disconnected -> Disconnected)
|
||||||
[2025-10-18 16:00:21] Update DB selesai. OK: 57, FAIL: 0
|
[17:42:20] [UPDATE STATUS] C7CU-PGT987 (Disconnected -> Disconnected)
|
||||||
[2025-10-18 16:00:21] Lama eksekusi: 19.82 detik
|
[17:42:20] [UPDATE DB] ZMVC-KAFH88
|
||||||
|
[17:42:20] [UPDATE STATUS] L5BR-E8QA89 (Disconnected -> Disconnected)
|
||||||
|
[17:42:20] [UPDATE DB] XNEQ-GB6L90
|
||||||
|
[2025-11-10 17:42:20] Update DB selesai. OK: 59, FAIL: 0
|
||||||
|
[2025-11-10 17:42:20] Lama eksekusi: 19.57 detik
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
[2025-10-18 16:00:01] Tidak ada remote expired.
|
[2025-11-10 17:40:02] Remote port 12911 berhasil ditutup.
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
[2025-10-17 23:50:02] 0 data telah dihapus. Data tersisa sejak 2025-09-01 00:00:00 sampai sekarang.
|
[2025-11-09 23:50:02] 0 data telah dihapus. Data tersisa sejak 2025-10-01 00:00:00 sampai sekarang.
|
||||||
|
|||||||
@@ -0,0 +1,117 @@
|
|||||||
|
<?php
|
||||||
|
// /**
|
||||||
|
// * File: /www/wwwroot/bilspro/cron/flip_auto_inactive.php
|
||||||
|
// * Jalankan via cron: */10 * * * * php /www/wwwroot/bilspro/cron/flip_auto_inactive.php >/dev/null 2>&1
|
||||||
|
// */
|
||||||
|
|
||||||
|
ini_set('max_execution_time', 60);
|
||||||
|
ini_set('memory_limit', '256M');
|
||||||
|
date_default_timezone_set('Asia/Jakarta');
|
||||||
|
|
||||||
|
require "/www/wwwroot/bilspro/config/connect.php";
|
||||||
|
require "/www/wwwroot/bilspro/payment/flip/Flip/Transaction.php";
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Ambil maksimum 5 data agar ringan
|
||||||
|
$sql = "
|
||||||
|
SELECT
|
||||||
|
a.id,
|
||||||
|
a.transaction_id,
|
||||||
|
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.status = 'lewat'
|
||||||
|
AND a.transaction_id != ''
|
||||||
|
AND a.transaction_status = 'ACTIVE'
|
||||||
|
AND b.payment_gateway = 'flip'
|
||||||
|
AND b.status_payment_gateway = 'ACTIVE'
|
||||||
|
AND (
|
||||||
|
YEAR(a.limit_pembayaran) < YEAR(NOW())
|
||||||
|
OR (
|
||||||
|
YEAR(a.limit_pembayaran) = YEAR(NOW())
|
||||||
|
AND MONTH(a.limit_pembayaran) < MONTH(NOW())
|
||||||
|
)
|
||||||
|
)
|
||||||
|
ORDER BY a.limit_pembayaran ASC
|
||||||
|
LIMIT 5
|
||||||
|
";
|
||||||
|
|
||||||
|
$stmt = $pdo->prepare($sql);
|
||||||
|
$stmt->execute();
|
||||||
|
$data = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
if (empty($data)) {
|
||||||
|
exit; // tidak ada data, langsung keluar biar hemat resource
|
||||||
|
}
|
||||||
|
|
||||||
|
$logFile = "/www/wwwroot/bilspro/load/cronjob/flip_auto_inactive.log";
|
||||||
|
if (!file_exists(dirname($logFile))) {
|
||||||
|
mkdir(dirname($logFile), 0777, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$results = [];
|
||||||
|
|
||||||
|
foreach ($data as $row) {
|
||||||
|
try {
|
||||||
|
$flip = new FlipPaymentGateway($row['apikey_payment_gateway'], $row['url_payment_gateway']);
|
||||||
|
$response = $flip->getBillStatus($row['transaction_id']);
|
||||||
|
|
||||||
|
if (!is_array($response) || empty($response['link_id'])) {
|
||||||
|
$results[] = [
|
||||||
|
'id' => $row['id'],
|
||||||
|
'transaction_id' => $row['transaction_id'],
|
||||||
|
'status' => 'error',
|
||||||
|
'message' => 'Invalid or missing response from Flip API'
|
||||||
|
];
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$delete = $flip->editBill(
|
||||||
|
$response['link_id'],
|
||||||
|
'INACTIVE',
|
||||||
|
$response['title'] ?? '',
|
||||||
|
$response['amount'] ?? 0
|
||||||
|
);
|
||||||
|
|
||||||
|
$results[] = [
|
||||||
|
'id' => $row['id'],
|
||||||
|
'transaction_id' => $row['transaction_id'],
|
||||||
|
'flip_response' => $delete
|
||||||
|
];
|
||||||
|
|
||||||
|
if ($delete) {
|
||||||
|
$update = $pdo->prepare("UPDATE tagihan SET transaction_status = 'INACTIVE' WHERE id = :id");
|
||||||
|
$update->execute([':id' => $row['id']]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delay 1 detik antar request agar tidak membanjiri Flip API
|
||||||
|
sleep(1);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$results[] = [
|
||||||
|
'id' => $row['id'],
|
||||||
|
'transaction_id' => $row['transaction_id'],
|
||||||
|
'status' => 'error',
|
||||||
|
'message' => $e->getMessage()
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Simpan hasil ke log file, bukan echo ke output
|
||||||
|
file_put_contents(
|
||||||
|
$logFile,
|
||||||
|
"[" . date('Y-m-d H:i:s') . "] " . json_encode($results, JSON_UNESCAPED_SLASHES) . PHP_EOL,
|
||||||
|
FILE_APPEND
|
||||||
|
);
|
||||||
|
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
// Tangkap semua error (PDO/Exception)
|
||||||
|
file_put_contents(
|
||||||
|
"/www/wwwroot/bilspro/load/cronjob/flip_auto_inactive_error.log",
|
||||||
|
"[" . date('Y-m-d H:i:s') . "] ERROR: " . $e->getMessage() . PHP_EOL,
|
||||||
|
FILE_APPEND
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1 +1 @@
|
|||||||
2025-10-18 16:00:06 ✅ Summary updated, rows affected: 1627
|
2025-11-10 17:30:07 ✅ Summary updated, rows affected: 1784
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
Voucher: PG12HJNHP8KQ<br>Aktif => 2025-11-10 06:54:16<br>Format durasi tidak valid.<br>PHP Fatal error: Uncaught Exception: DateInterval::__construct(): Unknown or bad format () in /www/wwwroot/bilspro/load/hotspot_update.php:70
|
||||||
|
Stack trace:
|
||||||
|
#0 /www/wwwroot/bilspro/load/hotspot_update.php(70): DateInterval->__construct()
|
||||||
|
#1 {main}
|
||||||
|
thrown in /www/wwwroot/bilspro/load/hotspot_update.php on line 70
|
||||||
|
|
||||||
|
Fatal error: Uncaught Exception: DateInterval::__construct(): Unknown or bad format () in /www/wwwroot/bilspro/load/hotspot_update.php:70
|
||||||
|
Stack trace:
|
||||||
|
#0 /www/wwwroot/bilspro/load/hotspot_update.php(70): DateInterval->__construct()
|
||||||
|
#1 {main}
|
||||||
|
thrown in /www/wwwroot/bilspro/load/hotspot_update.php on line 70
|
||||||
|
|||||||
+17
-15
@@ -1,23 +1,23 @@
|
|||||||
SV_Cikembar_Utama Data pelanggan tidak ada
|
SV_Cikembar_Utama Data pelanggan tidak ada
|
||||||
2025-10-18 15:30:01SV_BojongKerta Data pelanggan tidak ada
|
2025-11-10 17:12:01SV_BojongKerta Data pelanggan tidak ada
|
||||||
2025-10-18 15:30:01RO Bima Net Data pelanggan tidak ada
|
2025-11-10 17:12:01RO Bima Net Data pelanggan tidak ada
|
||||||
2025-10-18 15:30:01SV_Kingnet_Cibadak Data pelanggan tidak ada
|
2025-11-10 17:12:01SV_Kingnet_Cibadak Data pelanggan tidak ada
|
||||||
2025-10-18 15:30:01SV_CC-Net_Cipicung Data pelanggan tidak ada
|
2025-11-10 17:12:01SV_CC-Net_Cipicung Data pelanggan tidak ada
|
||||||
2025-10-18 15:30:01SV_Nusaina_Cibadak Data pelanggan tidak ada
|
2025-11-10 17:12:01SV_Nusaina_Cibadak Data pelanggan tidak ada
|
||||||
2025-10-18 15:30:01SV_Diamond Net Status koneksi tidak aktif atau interval tidak tersedia.
|
2025-11-10 17:12:01SV_Diamond Net Status koneksi tidak aktif atau interval tidak tersedia.
|
||||||
SV_22P Net Cibadak Data pelanggan tidak ada
|
SV_22P Net Cibadak Data pelanggan tidak ada
|
||||||
2025-10-18 15:30:01SV_Nettizen_Segaranten Data pelanggan tidak ada
|
2025-11-10 17:12:01SV_Nettizen_Segaranten Data pelanggan tidak ada
|
||||||
2025-10-18 15:00:01SV-DNY-Net-1 Data pelanggan tidak ada
|
2025-11-10 16:42:01SV-DNY-Net-1 Data pelanggan tidak ada
|
||||||
2025-10-18 15:40:01SV_NTA_2_PSW_1 Status koneksi tidak aktif atau interval tidak tersedia.
|
2025-11-10 17:22:01SV_NTA_2_PSW_1 Status koneksi tidak aktif atau interval tidak tersedia.
|
||||||
SV_NTA_1 Status koneksi tidak aktif atau interval tidak tersedia.
|
SV_NTA_1 Status koneksi tidak aktif atau interval tidak tersedia.
|
||||||
SV-Cicukang Status koneksi tidak aktif atau interval tidak tersedia.
|
SV-Cicukang Status koneksi tidak aktif atau interval tidak tersedia.
|
||||||
RO-Bumdes-Mekarmanah Status koneksi tidak aktif atau interval tidak tersedia.
|
RO-Bumdes-Mekarmanah Status koneksi tidak aktif atau interval tidak tersedia.
|
||||||
RO-Pak-Kholiq Data pelanggan tidak ada
|
RO-Pak-Kholiq Data pelanggan tidak ada
|
||||||
2025-10-18 15:45:01RO-Dendrit-Net Status koneksi tidak aktif atau interval tidak tersedia.
|
2025-11-10 17:27:01RO-Dendrit-Net Status koneksi tidak aktif atau interval tidak tersedia.
|
||||||
LJN.NS.CSR.NET Status koneksi tidak aktif atau interval tidak tersedia.
|
LJN.NS.CSR.NET Status koneksi tidak aktif atau interval tidak tersedia.
|
||||||
IVVINET-CBD Data pelanggan tidak ada
|
IVVINET-CBD Data pelanggan tidak ada
|
||||||
2025-10-18 15:30:01QONNET Data pelanggan tidak ada
|
2025-11-10 17:12:01QONNET Data pelanggan tidak ada
|
||||||
2025-10-18 15:30:01Mikrotik_X86 Status koneksi tidak aktif atau interval tidak tersedia.
|
2025-11-10 17:12:01Mikrotik_X86 Status koneksi tidak aktif atau interval tidak tersedia.
|
||||||
Mikrotik_BSW_1 Status koneksi tidak aktif atau interval tidak tersedia.
|
Mikrotik_BSW_1 Status koneksi tidak aktif atau interval tidak tersedia.
|
||||||
Mikrotik_Alea Status koneksi tidak aktif atau interval tidak tersedia.
|
Mikrotik_Alea Status koneksi tidak aktif atau interval tidak tersedia.
|
||||||
STANG Status koneksi tidak aktif atau interval tidak tersedia.
|
STANG Status koneksi tidak aktif atau interval tidak tersedia.
|
||||||
@@ -37,16 +37,16 @@ RO_Wargasari Status koneksi tidak aktif atau interval tidak tersedia.
|
|||||||
LJN_AGUNG Status koneksi tidak aktif atau interval tidak tersedia.
|
LJN_AGUNG Status koneksi tidak aktif atau interval tidak tersedia.
|
||||||
RNET-CMS Status koneksi tidak aktif atau interval tidak tersedia.
|
RNET-CMS Status koneksi tidak aktif atau interval tidak tersedia.
|
||||||
DCN-GB-CCR Data pelanggan tidak ada
|
DCN-GB-CCR Data pelanggan tidak ada
|
||||||
2025-10-18 15:30:01412NET Status koneksi tidak aktif atau interval tidak tersedia.
|
2025-11-10 17:12:01412NET Status koneksi tidak aktif atau interval tidak tersedia.
|
||||||
brf Status koneksi tidak aktif atau interval tidak tersedia.
|
brf Status koneksi tidak aktif atau interval tidak tersedia.
|
||||||
BMSNET Status koneksi tidak aktif atau interval tidak tersedia.
|
BMSNET Status koneksi tidak aktif atau interval tidak tersedia.
|
||||||
purabaya Status koneksi tidak aktif atau interval tidak tersedia.
|
purabaya Status koneksi tidak aktif atau interval tidak tersedia.
|
||||||
DCN-CO-GX4 Data pelanggan tidak ada
|
DCN-CO-GX4 Data pelanggan tidak ada
|
||||||
2025-10-18 15:30:01MIKROTIK GX4 Status koneksi tidak aktif atau interval tidak tersedia.
|
2025-11-10 17:12:01MIKROTIK GX4 Status koneksi tidak aktif atau interval tidak tersedia.
|
||||||
RO - Netborhood Wifi Status koneksi tidak aktif atau interval tidak tersedia.
|
RO - Netborhood Wifi Status koneksi tidak aktif atau interval tidak tersedia.
|
||||||
Neglasari Status koneksi tidak aktif atau interval tidak tersedia.
|
Neglasari Status koneksi tidak aktif atau interval tidak tersedia.
|
||||||
SV-DNY-Net-2 Data pelanggan tidak ada
|
SV-DNY-Net-2 Data pelanggan tidak ada
|
||||||
2025-10-18 15:40:01DNY-Neglasari Status koneksi tidak aktif atau interval tidak tersedia.
|
2025-11-10 17:22:01DNY-Neglasari Status koneksi tidak aktif atau interval tidak tersedia.
|
||||||
RO_TTO Status koneksi tidak aktif atau interval tidak tersedia.
|
RO_TTO Status koneksi tidak aktif atau interval tidak tersedia.
|
||||||
AP - NET Status koneksi tidak aktif atau interval tidak tersedia.
|
AP - NET Status koneksi tidak aktif atau interval tidak tersedia.
|
||||||
GAS NET Status koneksi tidak aktif atau interval tidak tersedia.
|
GAS NET Status koneksi tidak aktif atau interval tidak tersedia.
|
||||||
@@ -55,3 +55,5 @@ chr tencent Status koneksi tidak aktif atau interval tidak tersedia.
|
|||||||
DamarisNet Status koneksi tidak aktif atau interval tidak tersedia.
|
DamarisNet Status koneksi tidak aktif atau interval tidak tersedia.
|
||||||
Triunsa Status koneksi tidak aktif atau interval tidak tersedia.
|
Triunsa Status koneksi tidak aktif atau interval tidak tersedia.
|
||||||
Mikrotik GR 3 Status koneksi tidak aktif atau interval tidak tersedia.
|
Mikrotik GR 3 Status koneksi tidak aktif atau interval tidak tersedia.
|
||||||
|
Mikrotik_Kenzinet Status koneksi tidak aktif atau interval tidak tersedia.
|
||||||
|
Mikrotik Distribusi Status koneksi tidak aktif atau interval tidak tersedia.
|
||||||
|
|||||||
@@ -8,14 +8,14 @@ Successfully started background process for IP: 103.155.199.191 PERWASIM-NETWORK
|
|||||||
Successfully started background process for IP: tunnel.manjapro.net SV_NTA_2_PSW_1
|
Successfully started background process for IP: tunnel.manjapro.net SV_NTA_2_PSW_1
|
||||||
Successfully started background process for IP: tunnel.manjapro.net SV-Cicukang
|
Successfully started background process for IP: tunnel.manjapro.net SV-Cicukang
|
||||||
Successfully started background process for IP: tunnel.manjapro.net SV_NTA_1
|
Successfully started background process for IP: tunnel.manjapro.net SV_NTA_1
|
||||||
Successfully started background process for IP: 103.94.10.112 STANG
|
|
||||||
Successfully started background process for IP: 157.20.128.231 QONNET
|
|
||||||
Successfully started background process for IP: 103.155.198.185 SV_Cikembar_Utama
|
Successfully started background process for IP: 103.155.198.185 SV_Cikembar_Utama
|
||||||
Successfully started background process for IP: 103.155.196.145 UNIX-NET
|
Successfully started background process for IP: 103.155.196.145 UNIX-NET
|
||||||
Successfully started background process for IP: 103.26.176.81 SV_CC-Net_Cipicung
|
Successfully started background process for IP: 103.26.176.81 SV_CC-Net_Cipicung
|
||||||
Successfully started background process for IP: tunnel.manjapro.net SV-DNY-Net-2
|
Successfully started background process for IP: tunnel.manjapro.net SV-DNY-Net-2
|
||||||
Successfully started background process for IP: tunnel.manjapro.net Mikrotik_X86
|
Successfully started background process for IP: tunnel.manjapro.net Mikrotik_X86
|
||||||
Successfully started background process for IP: tunnel.manjapro.net SV_NTA_2_PSW_2
|
Successfully started background process for IP: tunnel.manjapro.net SV_NTA_2_PSW_2
|
||||||
Successfully started background process for IP: tunnel.manjapro.net Triunsa
|
|
||||||
Successfully started background process for IP: tunnel.manjapro.net SV_Diamond Net
|
Successfully started background process for IP: tunnel.manjapro.net SV_Diamond Net
|
||||||
Started parallel processes for checking vouchers. => 2025-10-18 16:00:02
|
Successfully started background process for IP: tunnel.manjapro.net RO_Wargasari
|
||||||
|
Successfully started background process for IP: tunnel.manjapro.net RO_Sukasari
|
||||||
|
Successfully started background process for IP: tunnel.manjapro.net GAS NET
|
||||||
|
Started parallel processes for checking vouchers. => 2025-11-10 17:30:02
|
||||||
@@ -27,8 +27,8 @@ foreach ($whatsapp as $waKey) {
|
|||||||
|
|
||||||
$access_token = $waKey['token_access'];
|
$access_token = $waKey['token_access'];
|
||||||
$phone_number_id = $waKey['number_id'];
|
$phone_number_id = $waKey['number_id'];
|
||||||
$url = "https://graph.facebook.com/v17.0/$phone_number_id/messages";
|
$url = "https://graph.facebook.com/v20.0/$phone_number_id/messages";
|
||||||
$data = json_decode($pesan['pesan'], true);
|
$reply = json_decode($pesan['pesan'], true);
|
||||||
|
|
||||||
$ch = curl_init($url);
|
$ch = curl_init($url);
|
||||||
curl_setopt($ch, CURLOPT_POST, true);
|
curl_setopt($ch, CURLOPT_POST, true);
|
||||||
@@ -37,7 +37,7 @@ foreach ($whatsapp as $waKey) {
|
|||||||
"Content-Type: application/json"
|
"Content-Type: application/json"
|
||||||
]);
|
]);
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
|
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($reply));
|
||||||
|
|
||||||
$response = curl_exec($ch);
|
$response = curl_exec($ch);
|
||||||
|
|
||||||
@@ -57,10 +57,15 @@ foreach ($whatsapp as $waKey) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo "<pre>";
|
||||||
|
print_r($responseData);
|
||||||
|
echo "</pre>";
|
||||||
|
|
||||||
// kirim ke aplikasi 2
|
// kirim ke aplikasi 2
|
||||||
forwardToApp2([
|
forwardToApp2([
|
||||||
"data" => $data,
|
"data" => $reply,
|
||||||
"respon" => $response
|
"phone_id" => $phone_number_id,
|
||||||
|
"respon" => $response
|
||||||
]);
|
]);
|
||||||
|
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
// Aktifkan error log
|
// Aktifkan error log
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
ini_set('display_errors', 0);
|
ini_set('display_errors', 1);
|
||||||
ini_set('log_errors', 1);
|
ini_set('log_errors', 1);
|
||||||
ini_set('error_log', __DIR__ . '/../logs/load_tagihan_flip.log');
|
ini_set('error_log', __DIR__ . '/../logs/load_tagihan_flip.log');
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@ include "../config/whatsapp_api.php";
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// Ambil data tagihan sukses maksimal 5
|
// Ambil data tagihan sukses maksimal 5
|
||||||
$datetime = date('Y-m-d H:i:s', time() - 60);
|
$datetime = date('Y-m-d H:i:s', time() - 360);
|
||||||
$stmt = $pdo->prepare("
|
$stmt = $pdo->prepare("
|
||||||
SELECT * FROM v_tagihan_flip_lunas
|
SELECT * FROM v_tagihan_flip_lunas
|
||||||
WHERE last_mikrotik_connect > :datetime
|
WHERE last_mikrotik_connect > :datetime
|
||||||
@@ -106,11 +106,23 @@ try {
|
|||||||
imagestring($img, 5, 50, 350, '______________________________', $orange);
|
imagestring($img, 5, 50, 350, '______________________________', $orange);
|
||||||
|
|
||||||
$invoicePath = '../invoice/' . $invoice;
|
$invoicePath = '../invoice/' . $invoice;
|
||||||
|
|
||||||
|
$invoicePathMinio = 'invoice/' . $invoice;
|
||||||
|
require '../controller/uploadMinioFiles.php';
|
||||||
|
ob_start();
|
||||||
|
imagepng($img);
|
||||||
|
$imageData = ob_get_clean();
|
||||||
|
|
||||||
if (!imagepng($img, $invoicePath)) {
|
if (!imagepng($img, $invoicePath)) {
|
||||||
throw new Exception("Gagal menyimpan kwitansi ke $invoicePath");
|
throw new Exception("Gagal menyimpan kwitansi ke $invoicePath");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Upload file ke Minio
|
||||||
|
$responMinio = uploadToMinioStorageRaw($imageData,$invoicePathMinio);
|
||||||
|
|
||||||
imagedestroy($img);
|
imagedestroy($img);
|
||||||
|
|
||||||
|
echo $responsMinio;
|
||||||
// Aktifkan user Mikrotik
|
// Aktifkan user Mikrotik
|
||||||
$API = new RouterosAPI();
|
$API = new RouterosAPI();
|
||||||
$API->debug = false;
|
$API->debug = false;
|
||||||
@@ -162,7 +174,9 @@ try {
|
|||||||
|
|
||||||
// Kirim WhatsApp dengan kwitansi
|
// Kirim WhatsApp dengan kwitansi
|
||||||
$nomor = explode(',', $tagihan['nomor_whatsapp']);
|
$nomor = explode(',', $tagihan['nomor_whatsapp']);
|
||||||
$urlInvoice = 'https://manjapro.net/invoice/' . $invoice;
|
// $urlInvoice = 'https://manjapro.net/invoice/' . $invoice;
|
||||||
|
|
||||||
|
$urlInvoice = $responMinio;
|
||||||
|
|
||||||
// Cek transaksi dengan id tagihan
|
// Cek transaksi dengan id tagihan
|
||||||
$stmt = $pdo->prepare("SELECT id_tagihan FROM transaksi WHERE id_tagihan = :id AND metode_pembayaran = :metode");
|
$stmt = $pdo->prepare("SELECT id_tagihan FROM transaksi WHERE id_tagihan = :id AND metode_pembayaran = :metode");
|
||||||
|
|||||||
@@ -113,9 +113,20 @@ try {
|
|||||||
imagestring($img, 5, 50, 350, '______________________________', $orange);
|
imagestring($img, 5, 50, 350, '______________________________', $orange);
|
||||||
|
|
||||||
$invoicePath = '../invoice/' . $invoice;
|
$invoicePath = '../invoice/' . $invoice;
|
||||||
|
|
||||||
|
$invoicePathMinio = 'invoice/' . $invoice;
|
||||||
|
require '../controller/uploadMinioFiles.php';
|
||||||
|
ob_start();
|
||||||
|
imagepng($img);
|
||||||
|
$imageData = ob_get_clean();
|
||||||
|
|
||||||
if (!imagepng($img, $invoicePath)) {
|
if (!imagepng($img, $invoicePath)) {
|
||||||
throw new Exception("Gagal menyimpan kwitansi ke $invoicePath");
|
throw new Exception("Gagal menyimpan kwitansi ke $invoicePath");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Upload file ke Minio
|
||||||
|
uploadToMinioStorageRaw($imageData,$invoicePathMinio);
|
||||||
|
|
||||||
imagedestroy($img);
|
imagedestroy($img);
|
||||||
|
|
||||||
// Aktifkan user Mikrotik
|
// Aktifkan user Mikrotik
|
||||||
|
|||||||
+19542
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user