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

7 months ago
<?php
namespace app\command;
6 months ago
use app\common\service\GoodsCateEs;
7 months ago
use app\common\service\GoodsEs;
7 months ago
use think\console\Command;
7 months ago
use think\console\Output;
use think\console\Input;
7 months ago
class SyncGoodsToEs extends Command
{
protected function configure()
{
// 指令配置
5 months ago
$this->setName('syncGoodsToEs')->setDescription('同步商品数据到ES');
$this->addArgument("type");
$this->addArgument("goods_id");
4 months ago
$this->addArgument("store_id");
7 months ago
}
protected function execute(Input $input, Output $output)
{
5 months ago
$type = $input->getArgument("type");
$goods_id = $input->getArgument("goods_id");
4 months ago
$store_id = $input->getArgument("store_id");
3 months ago
$goodsCateService = new GoodsCateEs();
// $goodsCateService->batchDelete([345865,1040929]);
// exit();
5 months ago
if ($type == "goods") {
4 months ago
$goodsCateService->batchCreateGoods($goods_id, $store_id);
5 months ago
} elseif ($type == "goods_cate"){
3 months ago
4 months ago
//$goodsCateService->createGoodsCateIndex();
$goodsCateService->batchCreateGoodsCategory($goods_id, $store_id);
6 months ago
}
5 months ago
7 months ago
}
}