<?phpnamespace plugin\xbDeveloper\command;use Exception;use plugin\xbDeveloper\api\PluginsExport;use Symfony\Component\Console\Command\Command;use Symfony\Component\Console\Input\InputArgument;use Symfony\Component\Console\Input\InputInterface;use Symfony\Component\Console\Output\OutputInterface;/*** 导出插件* @copyright 贵州积木云网络科技有限公司* @author 楚羽幽 958416459@qq.com*/class PluginExport extends Command{protected static $defaultName = 'xb-plugin:export';protected static $defaultDescription = 'Xb Plugin export';/*** 配置命令* @return void* @copyright 贵州积木云网络科技有限公司* @author 楚羽幽 958416459@qq.com*/protected function configure(){$this->addArgument('name', InputArgument::REQUIRED, 'Xb plugin name');$this->addArgument('method', InputArgument::OPTIONAL, 'Xb plugin method');}/*** 执行命令* @param \Symfony\Component\Console\Input\InputInterface $input* @param \Symfony\Component\Console\Output\OutputInterface $output* @return int* @copyright 贵州积木云网络科技有限公司* @author 楚羽幽 958416459@qq.com*/protected function execute(InputInterface $input, OutputInterface $output): int{$name = $input->getArgument('name');$method = $input->getArgument('method');if (empty($name)) {$output->writeln('<error>请填写插件标识</error>');return self::FAILURE;}$class = new PluginsExport;$methodName = 'exportAllData';if ($method) {// 首字母转大写$method = ucfirst($method);$methodName = "export{$method}";if (!method_exists($class, $methodName)) {$output->writeln('<error>方法不存在</error>');return self::FAILURE;}}// 执行导出方法call_user_func([$class, $methodName], $name);$messageTypes = ['Sql' => '表结构','Dict' => '字典','Menus' => '菜单','Crontab' => '配置',];$message = $messageTypes[$method] ?? '全部';// 提示导出成功$output->writeln("<info>插件 {$name}{$message}数据导出完成...</info>");// 导出成功return self::SUCCESS;}}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。