|
@@ -208,10 +208,16 @@ class ProductService extends Service
|
|
|
$models->save();
|
|
|
}
|
|
|
|
|
|
+ $old = ProductInfo::where('del_time',0)
|
|
|
+ ->where('product_id',$data['id'])
|
|
|
+ ->select('file')
|
|
|
+ ->get()->toArray();
|
|
|
+ $old = array_column($old,'file');
|
|
|
ProductInfo::where('del_time',0)
|
|
|
->where('product_id',$data['id'])
|
|
|
->update(['del_time' => $time]);
|
|
|
|
|
|
+ $new = [];
|
|
|
if(! empty($data['img'])){
|
|
|
$insert = [];
|
|
|
foreach ($data['img'] as $value){
|
|
@@ -222,10 +228,10 @@ class ProductService extends Service
|
|
|
'name' => $value['name'],
|
|
|
'crt_time' => $time,
|
|
|
];
|
|
|
+ $new[] = $value['url'];
|
|
|
}
|
|
|
ProductInfo::insert($insert);
|
|
|
}
|
|
|
-
|
|
|
if(! empty($data['file'])){
|
|
|
$insert = [];
|
|
|
foreach ($data['file'] as $value){
|
|
@@ -236,6 +242,7 @@ class ProductService extends Service
|
|
|
'name' => $value['name'],
|
|
|
'crt_time' => $time,
|
|
|
];
|
|
|
+ $new[] = $value['url'];
|
|
|
}
|
|
|
ProductInfo::insert($insert);
|
|
|
}
|
|
@@ -263,6 +270,8 @@ class ProductService extends Service
|
|
|
return [false,$exception->getMessage()];
|
|
|
}
|
|
|
|
|
|
+ $this->delStorageFile($old, $new);
|
|
|
+
|
|
|
return [true,''];
|
|
|
}
|
|
|
|