setName('table:create') // 运行 "php console_command list" 时的简短描述 ->setDescription('Create new model') // 运行命令时使用 "--help" 选项时的完整命令描述 ->setHelp('This command allow you to create models...') // 配置一个参数m ->addArgument('name', InputArgument::REQUIRED, 'what\'s model you want to create ?') // 配置一个可选参数 ->addArgument('optional_argument', InputArgument::OPTIONAL, 'this is a optional argument'); } protected function execute(InputInterface $input, OutputInterface $output) { $name = $input->getArgument('name'); if($name == 'queue'){ $allTables = $this->getDbTables(); $this->hf_mes_queue_pincheck($allTables); $this->hf_mes_queue_curve($allTables); $this->hf_mes_queue_grading($allTables); $this->hf_mes_queue_k($allTables); $this->hf_mes_queue_kun($allTables); } // 你想要做的任何操作 // $optional_argument = $input->getArgument('optional_argument'); // // $output->writeln('creating...'); // $output->writeln('created ' . $input->getArgument('name') . ' model success !'); // // if ($optional_argument) // $output->writeln('optional argument is ' . $optional_argument); // // $output->writeln('the end.'); $output->writeln('created ' . $input->getArgument('name') . ' table success !'); return 1; } /** * 获取数据库表名 * @return array */ private function getDbTables(): array { $sql = <<