21 lines
871 B
PHP
21 lines
871 B
PHP
<?php
|
|
namespace App\Console\Commands;
|
|
use App\Services\RegistrationReport\Reporter;
|
|
use Illuminate\Console\Command;
|
|
class ReportRegistrations extends Command
|
|
{
|
|
protected $signature = 'report:registrations {--dry-run : Preview counts without HTTP or state changes}';
|
|
protected $description = 'Report each instance registration count at 08:00 Asia/Shanghai through TeleHub';
|
|
public function handle(Reporter $reporter): int
|
|
{
|
|
try {
|
|
$result=$reporter->run(dryRun:(bool)$this->option('dry-run'));
|
|
$this->line(json_encode($result,JSON_UNESCAPED_UNICODE|JSON_THROW_ON_ERROR));
|
|
return ($result['needs_attention']??false) ? self::FAILURE : self::SUCCESS;
|
|
} catch (\Throwable $e) {
|
|
$this->error('registration_report_failed_closed: '.get_class($e));
|
|
return self::FAILURE;
|
|
}
|
|
}
|
|
}
|