!245 修复库存导入0的异常

Merge pull request !245 from 杨建炊/fix-release-1.0.0/yjc-migrate
This commit is contained in:
杨建炊 2024-11-08 08:42:52 +00:00 committed by Gitee
commit d9f73a8675
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -32,7 +32,7 @@ class InventoryImport implements ToArray, SkipsEmptyRows
$goodsSkus = GoodsSku::query()->with("combinationGoods")->whereIn('external_sku_id', $externalSkuIds) $goodsSkus = GoodsSku::query()->with("combinationGoods")->whereIn('external_sku_id', $externalSkuIds)
->get()->toArray(); ->get()->toArray();
$goodsSkus = collect($goodsSkus)->map(function ($v) use ($inventoryKeyByExternalSkuIdMap) { $goodsSkus = collect($goodsSkus)->map(function ($v) use ($inventoryKeyByExternalSkuIdMap) {
if (!empty($inventoryKeyByExternalSkuIdMap[$v['external_sku_id']])) { if (isset($inventoryKeyByExternalSkuIdMap[$v['external_sku_id']])) {
$v['inventory'] = $inventoryKeyByExternalSkuIdMap[$v['external_sku_id']]; $v['inventory'] = $inventoryKeyByExternalSkuIdMap[$v['external_sku_id']];
return $v; return $v;
} }