refactor: 产品导出健壮性修改

This commit is contained in:
2025-02-18 10:52:46 +08:00
parent 1d810b7ab0
commit 3581687a1d

View File

@@ -450,8 +450,10 @@ class Product
if (!$product_related->isEmpty()) { if (!$product_related->isEmpty()) {
$related = []; $related = [];
foreach ($product_related as $item) { foreach ($product_related as $item) {
if (!empty($item->product)) {
$related[$item['product_id']][] = $item->product->spu; $related[$item['product_id']][] = $item->product->spu;
} }
}
$products->each(function($product) use($related) { $products->each(function($product) use($related) {
if (empty($related[$product->id])) { if (empty($related[$product->id])) {
return; return;