// +---------------------------------------------------------------------- namespace ywxapp\command; use think\console\Command; use think\console\Input; use think\console\Output; use ywxapp\service\AddonService; /** * 运行期授权巡检命令(Discuz 式:已启用付费插件定期复查授权,过期自动禁用)。 * 用法:php think addon:license-check */ class AddonLicenseCheck extends Command { protected $name = 'addon:license-check'; protected function configure() { $this->setName($this->name) ->setDescription('巡检已启用付费插件的授权状态,过期自动禁用'); } protected function execute(Input $input, Output $output) { $disabled = AddonService::checkLicenses(); if (empty($disabled)) { $output->info('授权巡检完成:未发现需要禁用的插件。'); return 0; } $output->warning('以下插件授权未通过,已自动禁用:'); foreach ($disabled as $name) { $output->writeln(' - ' . $name); } return 0; } }