Uploaded From CV. Swandhana Server

This commit is contained in:
Duidev Software House
2025-01-27 08:16:55 +07:00
commit 6b3be42361
15186 changed files with 2328862 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Services\AstmMessageService;
use App\DataListiner;
class ProcessAstmMessages extends Command
{
protected $signature = 'astm:process-messages';
protected $description = 'Process pending ASTM messages';
private $astmMessageService;
public function __construct(AstmMessageService $astmMessageService)
{
parent::__construct();
$this->astmMessageService = $astmMessageService;
}
public function handle()
{
// Ambil data dari DataListener
$dataListener = DataListiner::whereNull('processed')->get();
if ($dataListener) {
$jumlah = count($dataListener);
$pesan = $this->astmMessageService->processAstmMessages($dataListener);
$this->info($jumlah.' Message processed '.$pesan.' at '.date('Y-m-d H:i:s'));
} else {
$this->info('Skipped Proses at '.date('Y-m-d H:i:s'));
}
}
}