You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
yanzong/app/command/SyncGoodsToEs.php

43 lines
1.1 KiB

6 months ago
<?php
namespace app\command;
6 months ago
use app\common\service\GoodsCateEs;
6 months ago
use app\common\service\GoodsEs;
6 months ago
use think\console\Command;
6 months ago
use think\console\Output;
use think\console\Input;
6 months ago
class SyncGoodsToEs extends Command
{
protected function configure()
{
// 指令配置
5 months ago
$this->setName('syncGoodsToEs')->setDescription('同步商品数据到ES');
$this->addArgument("type");
$this->addArgument("goods_id");
6 months ago
}
protected function execute(Input $input, Output $output)
{
5 months ago
$type = $input->getArgument("type");
$goods_id = $input->getArgument("goods_id");
6 months ago
$goodsService = new GoodsCateEs();
5 months ago
if ($type == "goods") {
$goodsService->batchCreateGoods($goods_id);
} elseif ($type == "goods_cate"){
$goodsService->batchCreateGoodsCategory($goods_id);
6 months ago
}
5 months ago
// try {
// $goodsService->batchCreateData();
// }catch (\Exception $e) {
// $output->writeln($e->getMessage());
// }
//$goodsService->batchCreateGoods();
6 months ago
}
}