修复问题

This commit is contained in:
mkm 2023-05-09 14:29:20 +08:00
parent 123e1bc671
commit 4f8a9f4c85
3 changed files with 14 additions and 3 deletions

View File

@ -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) { //秒杀商品

View File

@ -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('添加成功');
}

View File

@ -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('添加成功');
}