37 行
1.2 KiB
PHP
37 行
1.2 KiB
PHP
<?php
|
|
|
|
namespace addons\shopro_huifu\command;
|
|
|
|
use addons\shopro_huifu\library\Installer;
|
|
use think\console\Command;
|
|
use think\console\Input;
|
|
use think\console\Output;
|
|
|
|
class RepairMenu extends Command
|
|
{
|
|
protected function configure()
|
|
{
|
|
$this->setName('shopro_huifu:repair-menu')
|
|
->setDescription('Repair shopro_huifu install (files + SQL + menus)');
|
|
}
|
|
|
|
protected function execute(Input $input, Output $output)
|
|
{
|
|
$shopro = \think\Db::name('auth_rule')->where('name', 'shopro')->find();
|
|
if (!$shopro) {
|
|
$output->error('未找到 Shopro 父菜单 (auth_rule.name=shopro),请先安装 Shopro 商城插件');
|
|
return;
|
|
}
|
|
|
|
Installer::installMenu($output);
|
|
Installer::installSplitMenu($output);
|
|
Installer::upgradePayTypeColumn($output);
|
|
\app\common\library\Menu::enable('shopro_huifu/config');
|
|
\app\common\library\Menu::enable('shopro/split');
|
|
Installer::grantRulesToShoproGroups($output);
|
|
Installer::clearMenuCache();
|
|
Installer::setAddonState('shopro_huifu', 1, $output);
|
|
$output->writeln('请退出后台重新登录,然后执行 php think shopro_huifu:verify 复查');
|
|
}
|
|
}
|