dpl/app/Console/Commands/SendExpiredSubscriptionMail.php

23 lines
783 B
PHP

<?php
namespace App\Console\Commands;
use App\Services\MailFlow\AutomaticMailPolicy;
use App\Services\MailFlow\ExpiredSubscriptionNotifier;
use Illuminate\Console\Command;
class SendExpiredSubscriptionMail extends Command
{
protected $signature = 'send:expiredSubscriptionMail';
protected $description = 'Queue current tier-two subscription expiry notifications';
public function handle(ExpiredSubscriptionNotifier $notifier): int
{
$state = AutomaticMailPolicy::state();
if ($state === null) { $this->warn('自动邮件档位暂不可读取'); return self::FAILURE; }
if ($state['level'] !== 2) { return self::SUCCESS; }
$this->info('套餐到期通知已派发:' . $notifier->queueDue());
return self::SUCCESS;
}
}