|
@@ -940,6 +940,32 @@ class ProductService extends Service
|
|
|
return $img;
|
|
|
}
|
|
|
|
|
|
+ public function getProductImgGroup($product_id = [],$search){
|
|
|
+ if(empty($product_id)) return [];
|
|
|
+
|
|
|
+ $img = [];
|
|
|
+ $customer_info = ProductInfo::where('del_time',0)
|
|
|
+ ->whereIn('product_id',$product_id)
|
|
|
+ ->where('type',ProductInfo::type_one)
|
|
|
+ ->select('product_id','file','type','name')
|
|
|
+ ->get()->toArray();
|
|
|
+ $fileUploadService = new FileUploadService();
|
|
|
+ foreach ($customer_info as $value){
|
|
|
+ if(empty($search['from_wechat_program'])){
|
|
|
+ if(isset($img[$value['product_id']])) continue;
|
|
|
+ $url = "";
|
|
|
+ if(! empty($value['file'])) $url = $fileUploadService->getFileShow($value['file']);
|
|
|
+ $img[$value['product_id']][] = $url;
|
|
|
+ }else{
|
|
|
+ $url = "";
|
|
|
+ if(! empty($value['file'])) $url = $fileUploadService->getFileShow($value['file']);
|
|
|
+ $img[$value['product_id']][] = $url;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return $img;
|
|
|
+ }
|
|
|
+
|
|
|
public function batchUploadImg($data){
|
|
|
if(empty($data['product_id'])) return [false, '请选择产品'];
|
|
|
|
|
@@ -1246,7 +1272,7 @@ class ProductService extends Service
|
|
|
$detail_map = $this->getProductPrice($product_id, $type);
|
|
|
|
|
|
//获取产品图片
|
|
|
- $img = $this->getProductImg($product_id);
|
|
|
+ $img = $this->getProductImgGroup($product_id,$search);
|
|
|
|
|
|
//当前门店
|
|
|
$top_depart = $user['depart_top'][0] ?? [];
|
|
@@ -1264,7 +1290,10 @@ class ProductService extends Service
|
|
|
$data['data'][$key]['is_roll'] = false;
|
|
|
}
|
|
|
|
|
|
- $data['data'][$key]['img'] = $img[$value['id']] ?? "";
|
|
|
+ $tmp = $img[$value['id']] ?? [];
|
|
|
+ $data['data'][$key]['img'] = $tmp[0] ?? "";
|
|
|
+ if(isset($tmp[0])) unset($tmp[0]);
|
|
|
+ $data['data'][$key]['img_detail'] = array_values($tmp);
|
|
|
$tmp = $this->fillProductPrice($detail_map, $value, $top_depart,$basic_map);
|
|
|
$data['data'][$key]['product_price'] = $tmp;
|
|
|
$category_tmp = $category[$value['product_category_id']] ?? [];
|