diff --git a/app/common/repositories/store/product/ProductRepository.php b/app/common/repositories/store/product/ProductRepository.php index 69f8d27e..e5778a69 100644 --- a/app/common/repositories/store/product/ProductRepository.php +++ b/app/common/repositories/store/product/ProductRepository.php @@ -238,7 +238,7 @@ class ProductRepository extends BaseRepository * @Date: 2020/5/11 * @param array $data */ - public function create(array $data, int $productType = 0, $conType = 0) + public function create(array $data, int $productType = 0, $conType = 1) { if (!$data['spec_type']) { $data['attr'] = []; @@ -404,11 +404,15 @@ class ProductRepository extends BaseRepository if (isset($settleParams['attr'])) $productAttrRepository->insert($settleParams['attr']); + + $productCateRepository = app()->make(ProductCateRepository::class); $productCateRepository->clearAttr($res->product_id); if (isset($settleParams['cate'])) $productCateRepository->insert($settleParams['cate']); + + $productAttrValueRepository = app()->make(ProductAttrValueRepository::class); $productAttrValueRepository->clearAttr($res->product_id); if (isset($settleParams['attrValue'])) { @@ -418,14 +422,15 @@ class ProductRepository extends BaseRepository } } if ($content) { - app()->make(ProductContentRepository::class)->clearAttr($res->product_id, $content['type']); - $this->dao->createContent($res->product_id, $content); + app()->make(ProductContentRepository::class)->clearAttr($id, $content['type']); + $this->dao->createContent($id, $content); } if (isset($data['admin_info'])) { $admin_info = $data['admin_info']; unset($data['admin_info']); } + $update_infos = $settleParams['update_infos'] ?? []; if (isset($settleParams['data'])) $data = array_merge($data, $settleParams['data']); $this->dao->update($id, $data);