diff --git a/app/Console/Commands/BusinessGoodsSkuToLocal.php b/app/Console/Commands/BusinessGoodsSkuToLocal.php new file mode 100644 index 0000000..c6efea9 --- /dev/null +++ b/app/Console/Commands/BusinessGoodsSkuToLocal.php @@ -0,0 +1,103 @@ + $v) { + if ($k > 3) { + $skuName .= $v; + } + } + } + if ($brand) { + $goodsBrand = GoodsBrand::firstOrCreate(['name' => $brand]); + $brand = $goodsBrand->id; + } + $goodsType = GoodsType::firstOrCreate(['name' => $type]); + [$goodsCode, $skuCode] = explode('_', $businessGoodsSku['external_sku_id']); + $goods = [ + 'title' => $goodsName, + 'type_id' => $goodsType->id, + 'brand_id' => $brand, + 'goods_code' => $goodsCode, + ]; + $goods = Goods::firstOrCreate($goods); + $goodsSku = [ + 'goods_id' => $goods->id, + 'title' => $skuName, + 'sku_code' => $skuCode, + ]; + GoodsSku::firstOrCreate($goodsSku); + ++$num; + } + }); + $this->info('导入成功: ' . $num); + } +} diff --git a/app/Console/Commands/Inventory.php b/app/Console/Commands/Inventory.php index 348c9d5..40d5de3 100644 --- a/app/Console/Commands/Inventory.php +++ b/app/Console/Commands/Inventory.php @@ -22,7 +22,7 @@ class Inventory extends Command * * @var string */ - protected $description = '定时盘点'; + protected $description = '定时库存盘点'; /** * Create a new command instance.