setName('syncGoodsToEs')->setDescription('同步商品数据到ES'); $this->addArgument("type"); $this->addArgument("goods_id"); } protected function execute(Input $input, Output $output) { $type = $input->getArgument("type"); $goods_id = $input->getArgument("goods_id"); $goodsService = new GoodsCateEs(); if ($type == "goods") { $goodsService->batchCreateGoods($goods_id); } elseif ($type == "goods_cate"){ $goodsService->batchCreateGoodsCategory($goods_id); } // try { // $goodsService->batchCreateData(); // }catch (\Exception $e) { // $output->writeln($e->getMessage()); // } //$goodsService->batchCreateGoods(); } }