作者 lyh
... ... @@ -202,7 +202,7 @@ class CategoryLogic extends BaseLogic
* 产品导入:分类处理
* @param $project_id
* @param $category
* @return string
* @return array
* @throws \Exception
* @author Akun
* @date 2023/09/21 14:55
... ... @@ -227,7 +227,9 @@ class CategoryLogic extends BaseLogic
}
//清除缓存
Common::del_user_cache('product_category',$project_id);
return $this->getLastCategory($return);
$category_id = $this->getLastCategory($return);
return ['category_id'=>$category_id,'category_arr'=>$return];
}
/**
... ...
... ... @@ -616,10 +616,13 @@ class ProductLogic extends BaseLogic
if (!$product) {
$category_id = '';
$category_arr = [];
if ($data[2]??'') {
//处理分类
$categoryLogic = new CategoryLogic();
$category_id = $categoryLogic->importProductCategory($project_id, $data[2]);
$category_info = $categoryLogic->importProductCategory($project_id, $data[2]);
$category_id = $category_info['category_id'];
$category_arr = $category_info['category_arr'];
}
$keyword_id = '';
... ... @@ -805,6 +808,11 @@ class ProductLogic extends BaseLogic
$this->edit(['route' => $route], ['id' => $id]);
//关联分类
if($category_arr){
CategoryRelated::saveRelated($id, $category_arr);
}
return true;
}
... ...