|
@@ -57,15 +57,26 @@ class BaseProductImage extends EloquentRepository
|
|
|
}
|
|
|
}
|
|
|
// 处理条件2:如果数据在 base_product_image 中无,但在 $images 有
|
|
|
+ $i = 1;
|
|
|
foreach ($images as $image) {
|
|
|
$found = $existingImages->firstWhere('image_url', $image);
|
|
|
if (!$found) {
|
|
|
$result[] = [
|
|
|
'id' => 0,
|
|
|
'image_url' => $image,
|
|
|
+ 'order' => $i,
|
|
|
];
|
|
|
}
|
|
|
+ //更新库中排序
|
|
|
+ foreach ($existingImages as $existingImage) {
|
|
|
+ if ($existingImage->image_url == $image) {
|
|
|
+ $existingImage->order = $i;
|
|
|
+ $existingImage->save();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $i++;
|
|
|
}
|
|
|
+
|
|
|
return $result;
|
|
|
}
|
|
|
|