作者 lyh

列表页聚合页模式

@@ -116,7 +116,10 @@ class AiVideoAutoPublish extends Command @@ -116,7 +116,10 @@ class AiVideoAutoPublish extends Command
116 return $data; 116 return $data;
117 } 117 }
118 $data['title'] = $info['title']; 118 $data['title'] = $info['title'];
119 - $data['remark'] = $info['intro']; 119 + $data['remark'] = strip_tags($info['intro']);
  120 + if(empty($data['remark'])){
  121 + $data['remark'] = $data['title'];
  122 + }
120 $data['images'] = array_map(function ($item) { 123 $data['images'] = array_map(function ($item) {
121 return [ 124 return [
122 'alt' => $item['title'], 125 'alt' => $item['title'],
@@ -133,11 +136,26 @@ class AiVideoAutoPublish extends Command @@ -133,11 +136,26 @@ class AiVideoAutoPublish extends Command
133 } 136 }
134 $data['title'] = $keywordInfo['title']; 137 $data['title'] = $keywordInfo['title'];
135 $data['remark'] = $keywordInfo['intro']; 138 $data['remark'] = $keywordInfo['intro'];
  139 + $data['remark'] = strip_tags($keywordInfo['intro']);
  140 + if(empty($data['remark'])){
  141 + $data['remark'] = $data['title'];
  142 + }
136 $data['images'] = []; 143 $data['images'] = [];
137 $productModel = new Product(); 144 $productModel = new Product();
138 $productList = $productModel->list(['keyword_id'=>['like','%,'.$keywordInfo['id'].',%']],'id',['gallery'],'desc',10); 145 $productList = $productModel->list(['keyword_id'=>['like','%,'.$keywordInfo['id'].',%']],'id',['gallery'],'desc',10);
139 foreach ($productList as $info){ 146 foreach ($productList as $info){
140 - $data['images'] = array_merge($data['images'],array_walk($info['gallery'], function (&$item) {$item['alt'] = $item['title'];unset($item['title']);})); 147 + $data['images'] = array_map(function ($item) {
  148 + return [
  149 + 'alt' => $item['title'],
  150 + 'url' => $item['url'] ?? '',
  151 + ];
  152 + }, $info['gallery']);
  153 + $data['images'] = array_merge($data['images'],array_map(function ($item) {
  154 + return [
  155 + 'alt' => $item['title'],
  156 + 'url' => $item['url'] ?? '',
  157 + ];
  158 + }, $info['gallery']));
141 } 159 }
142 return $data; 160 return $data;
143 } 161 }