作者 刘锟

upload_remote

... ... @@ -396,20 +396,28 @@ class ProductLogic extends BaseLogic
}
$gallery = [];
$thumb = '';
if($data[7]){
//处理图片
//处理图片
$img_arr = explode(',',$data[7]);
foreach ($img_arr as $v_img){
$one_img = CosService::uploadRemote($project_id,'image_product',$v_img);
if($one_img){
$gallery[] = [
$one_gallery = [
'alt' => '这是一张产品图',
'url' => $one_img
];
if(!$thumb){
$thumb = Arr::a2s($one_gallery);
}
$gallery[] = $one_gallery;
}
}
}
//处理seo
$seo_mate = [
'title' => $data[8]??'',
... ... @@ -423,7 +431,7 @@ class ProductLogic extends BaseLogic
[
'project_id' => $project_id,
'title' => $data[0],
'thumb' => $gallery[0] ? Arr::a2s($gallery[0]) : '',
'thumb' => $thumb,
'gallery' => Arr::a2s($gallery),
'attrs' => $data[4] ? $data[4] : Arr::a2s([]),
'category_id' => $category_id,
... ...