作者 lyh

gx复制项目脚本

@@ -133,11 +133,12 @@ class LyhImportTest extends Command @@ -133,11 +133,12 @@ class LyhImportTest extends Command
133 'product_id'=>$id 133 'product_id'=>$id
134 ]; 134 ];
135 $faqId = $columnModel->addReturnId($detailFaq); 135 $faqId = $columnModel->addReturnId($detailFaq);
  136 +
136 $faqsDetail = json_decode($val[4],true); 137 $faqsDetail = json_decode($val[4],true);
137 $faqContent = ''; 138 $faqContent = '';
138 - if(!empty($faqsDetail) && is_array($faqContent)){ 139 + if(!empty($faqsDetail) && is_array($faqsDetail)){
139 foreach ($faqsDetail as $faq_Val){ 140 foreach ($faqsDetail as $faq_Val){
140 - $faqContent = "question:".$faq_Val['question'] . "<br />" . "answer:".$faq_Val['answer']. "<br />"; 141 + $faqContent .= "question:".$faq_Val['question'] . "<br />" . "answer:".$faq_Val['answer']. "<br />";
141 } 142 }
142 $detailFaqInfo = [ 143 $detailFaqInfo = [
143 'product_id'=>$id, 144 'product_id'=>$id,
@@ -146,6 +147,8 @@ class LyhImportTest extends Command @@ -146,6 +147,8 @@ class LyhImportTest extends Command
146 'content'=>json_encode(['content'=>$faqContent]) 147 'content'=>json_encode(['content'=>$faqContent])
147 ]; 148 ];
148 $detailModel->addReturnId($detailFaqInfo); 149 $detailModel->addReturnId($detailFaqInfo);
  150 + }else{
  151 + echo date('Y-m-d H:i:s') . '产品标题:'. $val[1] . PHP_EOL .'faqs数据有问题:' . $val[4];
149 } 152 }
150 } 153 }
151 return true; 154 return true;