|
...
|
...
|
@@ -120,12 +120,15 @@ class AiVideoAutoPublish extends Command |
|
|
|
if(empty($data['remark'])){
|
|
|
|
$data['remark'] = $data['title'];
|
|
|
|
}
|
|
|
|
$data['images'] = array_map(function ($item) {
|
|
|
|
$data['images'] = array_filter(array_map(function ($item) use ($data) {
|
|
|
|
if (!empty($item['url'])) {
|
|
|
|
return [
|
|
|
|
'alt' => $item['title'],
|
|
|
|
'url' => $item['url'] ?? '',
|
|
|
|
'alt' => $item['title'] ?? $data['title'],
|
|
|
|
'url' => $item['url'],
|
|
|
|
];
|
|
|
|
}, $info['gallery']);
|
|
|
|
}
|
|
|
|
return null; // 返回 null 让 array_filter 去除
|
|
|
|
}, $info['gallery']));
|
|
|
|
return $data;
|
|
|
|
}else{
|
|
|
|
//聚合页获取当前关联产品的图片
|
|
...
|
...
|
@@ -144,18 +147,16 @@ class AiVideoAutoPublish extends Command |
|
|
|
$productModel = new Product();
|
|
|
|
$productList = $productModel->list(['keyword_id'=>['like','%,'.$keywordInfo['id'].',%']],'id',['gallery'],'desc',10);
|
|
|
|
foreach ($productList as $info){
|
|
|
|
$data['images'] = array_map(function ($item) {
|
|
|
|
$images = array_filter(array_map(function ($item) use ($data) {
|
|
|
|
if (!empty($item['url'])) {
|
|
|
|
return [
|
|
|
|
'alt' => $item['title'],
|
|
|
|
'url' => $item['url'] ?? '',
|
|
|
|
];
|
|
|
|
}, $info['gallery']);
|
|
|
|
$data['images'] = array_merge($data['images'],array_map(function ($item) {
|
|
|
|
return [
|
|
|
|
'alt' => $item['title'],
|
|
|
|
'url' => $item['url'] ?? '',
|
|
|
|
'alt' => $item['title'] ?? $data['title'],
|
|
|
|
'url' => $item['url'],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
return null; // 返回 null 让 array_filter 去除
|
|
|
|
}, $info['gallery']));
|
|
|
|
$data['images'] = array_merge($data['images'],$images);
|
|
|
|
}
|
|
|
|
return $data;
|
|
|
|
}
|
...
|
...
|
|