You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
906 B
35 lines
906 B
<?php
|
|
declare (strict_types = 1);
|
|
|
|
namespace app\command;
|
|
|
|
use app\service\admin\install\InstallSystemService;
|
|
use app\service\core\menu\CoreMenuService;
|
|
use think\console\Command;
|
|
use think\console\Input;
|
|
use think\console\input\Argument;
|
|
use think\console\input\Option;
|
|
use think\console\Output;
|
|
|
|
class Menu extends Command
|
|
{
|
|
protected function configure()
|
|
{
|
|
// 指令配置
|
|
$this->setName('menu')
|
|
->addOption('addon', 'a', Option::VALUE_OPTIONAL)
|
|
->setDescription('the menu command');
|
|
}
|
|
|
|
protected function execute(Input $input, Output $output)
|
|
{
|
|
$addon = $input->getOption('addon');
|
|
if ($addon) {
|
|
(new CoreMenuService())->refreshAddonMenu($addon);
|
|
} else {
|
|
(new InstallSystemService())->installMenu();
|
|
}
|
|
// 指令输出
|
|
$output->writeln('menu refresh success');
|
|
}
|
|
}
|
|
|