setName('syncGoodsToEs') ->setDescription('同步商品数据到ES'); } protected function execute(Input $input, Output $output) { $goodsService = new GoodsCateEs(); try { $goodsService->batchCreateData(); }catch (\Exception $e) { $output->writeln($e->getMessage()); } } }