diff --git a/app/common/repositories/store/product/ProductRepository.php b/app/common/repositories/store/product/ProductRepository.php index b33a6b3e..6d128a61 100644 --- a/app/common/repositories/store/product/ProductRepository.php +++ b/app/common/repositories/store/product/ProductRepository.php @@ -224,11 +224,12 @@ class ProductRepository extends BaseRepository event('product.create.before', compact('data','productType','conType')); return Db::transaction(function () use ($data, $productType,$conType,$content,$product) { $activity_id = 0; + $product['product_type'] = $productType; $result = $this->dao->create($product); $settleParams = $this->setAttrValue($data, $result->product_id, $productType, 0,$data['mer_id']); $settleParams['cate'] = $this->setMerCate($data['mer_cate_id'], $result->product_id, $data['mer_id']); $settleParams['attr'] = $this->setAttr($data['attr'], $result->product_id); - if ($productType ==0 ) app()->make(ParameterValueRepository::class)->create($result->product_id, $data['params'] ?? [],$data['mer_id']); + if (in_array($productType, [0, 98])) app()->make(ParameterValueRepository::class)->create($result->product_id, $data['params'] ?? [],$data['mer_id']); $this->save($result->product_id, $settleParams, $content,$product,$productType); if (in_array($productType, [0, 1,98])) { if ($productType == 1) { //秒杀商品 diff --git a/app/controller/api/server/StoreProduct.php b/app/controller/api/server/StoreProduct.php index d39a5ffd..21d17a96 100644 --- a/app/controller/api/server/StoreProduct.php +++ b/app/controller/api/server/StoreProduct.php @@ -79,7 +79,12 @@ class StoreProduct extends BaseController $data['status'] = $merchant->is_audit ? 0 : 1; $data['mer_status'] = ($merchant['is_del'] || !$merchant['mer_state'] || !$merchant['status']) ? 0 : 1; $data['rate'] = 3; - $this->repository->create($data, 0, 1); + if ($merchant['type_id']==12){ + $product_type=98;//供应链 + }else{ + $product_type=0;//普通商品 + } + $this->repository->create($data, $product_type, 1); return app('json')->success('添加成功'); } diff --git a/app/controller/merchant/store/product/Product.php b/app/controller/merchant/store/product/Product.php index d7a6e834..789bd641 100644 --- a/app/controller/merchant/store/product/Product.php +++ b/app/controller/merchant/store/product/Product.php @@ -85,7 +85,12 @@ class Product extends BaseController $data['status'] = $this->request->merchant()->is_audit ? 0 : 1; $data['mer_status'] = ($this->request->merchant()->is_del || !$this->request->merchant()->mer_state || !$this->request->merchant()->status) ? 0 : 1; $data['rate'] = 3; - $this->repository->create($data,0); + if ($this->request->merchant()->type_id==12){ + $product_type=98;//供应链 + }else{ + $product_type=0;//普通商品 + } + $this->repository->create($data,$product_type); return app('json')->success('添加成功'); }