作者 李宇航

合并分支 'master-server' 到 'master'

Master server



查看合并请求 !1317
@@ -90,7 +90,6 @@ class LyhImportTest extends Command @@ -90,7 +90,6 @@ class LyhImportTest extends Command
90 if($k < 2){ 90 if($k < 2){
91 continue; 91 continue;
92 } 92 }
93 - dd($val);  
94 $saveData = []; 93 $saveData = [];
95 if($val[1] ?? ''){ 94 if($val[1] ?? ''){
96 $saveData['title'] = $val[1]; 95 $saveData['title'] = $val[1];
@@ -134,18 +133,23 @@ class LyhImportTest extends Command @@ -134,18 +133,23 @@ class LyhImportTest extends Command
134 'product_id'=>$id 133 'product_id'=>$id
135 ]; 134 ];
136 $faqId = $columnModel->addReturnId($detailFaq); 135 $faqId = $columnModel->addReturnId($detailFaq);
  136 +
137 $faqsDetail = json_decode($val[4],true); 137 $faqsDetail = json_decode($val[4],true);
138 $faqContent = ''; 138 $faqContent = '';
139 - foreach ($faqsDetail as $faq_Val){  
140 - $faqContent = "question:".$faq_Val['question'] . "<br />" . "answer:".$faq_Val['answer']. "<br />"; 139 + if(!empty($faqsDetail) && is_array($faqsDetail)){
  140 + foreach ($faqsDetail as $faq_Val){
  141 + $faqContent .= "question:".$faq_Val['question'] . "<br />" . "answer:".$faq_Val['answer']. "<br />";
  142 + }
  143 + $detailFaqInfo = [
  144 + 'product_id'=>$id,
  145 + 'column_id'=>$faqId,
  146 + 'text_type'=>1,
  147 + 'content'=>json_encode(['content'=>$faqContent])
  148 + ];
  149 + $detailModel->addReturnId($detailFaqInfo);
  150 + }else{
  151 + echo date('Y-m-d H:i:s') . '产品标题:'. $val[1] . PHP_EOL .'faqs数据有问题:' . $val[4];
141 } 152 }
142 - $detailFaqInfo = [  
143 - 'product_id'=>$id,  
144 - 'column_id'=>$faqId,  
145 - 'text_type'=>1,  
146 - 'content'=>json_encode(['content'=>$faqContent])  
147 - ];  
148 - $detailModel->addReturnId($detailFaqInfo);  
149 } 153 }
150 return true; 154 return true;
151 } 155 }