作者 刘锟

合并分支 'akun' 到 'master'

Akun



查看合并请求 !310
@@ -202,7 +202,7 @@ class CategoryLogic extends BaseLogic @@ -202,7 +202,7 @@ class CategoryLogic extends BaseLogic
202 * 产品导入:分类处理 202 * 产品导入:分类处理
203 * @param $project_id 203 * @param $project_id
204 * @param $category 204 * @param $category
205 - * @return string 205 + * @return array
206 * @throws \Exception 206 * @throws \Exception
207 * @author Akun 207 * @author Akun
208 * @date 2023/09/21 14:55 208 * @date 2023/09/21 14:55
@@ -227,7 +227,9 @@ class CategoryLogic extends BaseLogic @@ -227,7 +227,9 @@ class CategoryLogic extends BaseLogic
227 } 227 }
228 //清除缓存 228 //清除缓存
229 Common::del_user_cache('product_category',$project_id); 229 Common::del_user_cache('product_category',$project_id);
230 - return $this->getLastCategory($return); 230 + $category_id = $this->getLastCategory($return);
  231 +
  232 + return ['category_id'=>$category_id,'category_arr'=>$return];
231 } 233 }
232 234
233 /** 235 /**
@@ -616,10 +616,13 @@ class ProductLogic extends BaseLogic @@ -616,10 +616,13 @@ class ProductLogic extends BaseLogic
616 if (!$product) { 616 if (!$product) {
617 617
618 $category_id = ''; 618 $category_id = '';
  619 + $category_arr = [];
619 if ($data[2]??'') { 620 if ($data[2]??'') {
620 //处理分类 621 //处理分类
621 $categoryLogic = new CategoryLogic(); 622 $categoryLogic = new CategoryLogic();
622 - $category_id = $categoryLogic->importProductCategory($project_id, $data[2]); 623 + $category_info = $categoryLogic->importProductCategory($project_id, $data[2]);
  624 + $category_id = $category_info['category_id'];
  625 + $category_arr = $category_info['category_arr'];
623 } 626 }
624 627
625 $keyword_id = ''; 628 $keyword_id = '';
@@ -805,6 +808,11 @@ class ProductLogic extends BaseLogic @@ -805,6 +808,11 @@ class ProductLogic extends BaseLogic
805 808
806 $this->edit(['route' => $route], ['id' => $id]); 809 $this->edit(['route' => $route], ['id' => $id]);
807 810
  811 + //关联分类
  812 + if($category_arr){
  813 + CategoryRelated::saveRelated($id, $category_arr);
  814 + }
  815 +
808 return true; 816 return true;
809 } 817 }
810 818