|
@@ -412,6 +412,7 @@ class ImportService extends Service
|
|
|
->where('top_depart_id',$top_depart_id)
|
|
|
->pluck('id','title')
|
|
|
->toArray();
|
|
|
+ $category_parent = array_unique(array_column($category,'parent'));
|
|
|
|
|
|
$time = time();
|
|
|
|
|
@@ -447,6 +448,7 @@ class ImportService extends Service
|
|
|
$tmp['code'] = $value['1'];
|
|
|
if(empty($category[$value['2']])) return [false,'产品分类:' . $value['2'] . '不存在'];
|
|
|
$tmp['product_category_id'] = $category[$value['2']];
|
|
|
+ if(in_array($tmp['product_category_id'],$category_parent)) return [false,'产品分类:' . $value['2'] . '下存在子分类,请将产品建与最底层分类下'];
|
|
|
$parentsId = $this->findParentIds($tmp['product_category_id'], $category_list);
|
|
|
array_unshift($parentsId, $tmp['product_category_id']);
|
|
|
$result = array_reverse($parentsId);
|