作者 lyh

gx

@@ -91,9 +91,20 @@ DSE1504F,Super fast Recovery Rectifier,ITO-220AC,400,15,Single Positive,150,1.4, @@ -91,9 +91,20 @@ DSE1504F,Super fast Recovery Rectifier,ITO-220AC,400,15,Single Positive,150,1.4,
91 'module_id'=>2, 91 'module_id'=>2,
92 ]; 92 ];
93 $customModuleCategoryModel = new CustomModuleCategory(); 93 $customModuleCategoryModel = new CustomModuleCategory();
94 - $catInfo = $customModuleCategoryModel->read(['name'=>$array1[1]]);  
95 - if($catInfo !== false){  
96 - $contentData['category_id'] = $catInfo['id']; 94 + if(!empty($array1[1]) && is_array($array1)){
  95 + $cate_arr = explode('-',$array1);
  96 + foreach ($cate_arr as $cateV){
  97 + $catInfo = $customModuleCategoryModel->read(['name'=>$cateV]);
  98 + if($catInfo !== false){
  99 + $contentData['category_id'] = ','.$catInfo['id'];
  100 + }
  101 + }
  102 + $contentData['category_id'] = $contentData['category_id'].',';
  103 + }else{
  104 + $catInfo = $customModuleCategoryModel->read(['name'=>$array1]);
  105 + if($catInfo !== false){
  106 + $contentData['category_id'] = ','.$catInfo['id'].',';
  107 + }
97 } 108 }
98 $customModuleContentModel = new CustomModuleContent(); 109 $customModuleContentModel = new CustomModuleContent();
99 $contentId = $customModuleContentModel->addReturnId($contentData); 110 $contentId = $customModuleContentModel->addReturnId($contentData);