修复编辑
This commit is contained in:
parent
02b78c6542
commit
61188a1380
@ -239,7 +239,7 @@ class ProductRepository extends BaseRepository
|
||||
$result = $this->dao->create($product);
|
||||
|
||||
$settleParams = $this->setAttrValue($data, $result->product_id, $productType, 0, $data['mer_id']);
|
||||
if(isset($data['mer_cate_id']) &&$data['mer_cate_id']!=0){
|
||||
if (isset($data['mer_cate_id']) && $data['mer_cate_id'] != 0) {
|
||||
$settleParams['cate'] = $this->setMerCate($data['mer_cate_id'], $result->product_id, $data['mer_id']);
|
||||
}
|
||||
$settleParams['attr'] = $this->setAttr($data['attr'], $result->product_id);
|
||||
@ -277,7 +277,9 @@ class ProductRepository extends BaseRepository
|
||||
event('product.update.before', compact('id', 'data', 'merId', 'productType', 'conType'));
|
||||
$spuData = $product = $this->setProduct($data);
|
||||
$settleParams = $this->setAttrValue($data, $id, $productType, 1, $merId);
|
||||
if (isset($data['mer_cate_id']) && $data['mer_cate_id'] != 0 &&$data['mer_cate_id'][0]!=0) {
|
||||
$settleParams['cate'] = $this->setMerCate($data['mer_cate_id'], $id, $merId);
|
||||
}
|
||||
$settleParams['attr'] = $this->setAttr($data['attr'], $id);
|
||||
$content = [
|
||||
'content' => $conType ? json_encode($data['content']) : $data['content'],
|
||||
@ -287,8 +289,8 @@ class ProductRepository extends BaseRepository
|
||||
$spuData['mer_id'] = $merId;
|
||||
$spuData['mer_labels'] = $data['mer_labels'];
|
||||
Db::startTrans();
|
||||
try{
|
||||
$res=$this->save($id, $settleParams, $content, $product, $productType);
|
||||
try {
|
||||
$res = $this->save($id, $settleParams, $content, $product, $productType);
|
||||
// if ($productType == 1) { //秒杀商品
|
||||
// $dat = $this->setSeckillProduct($data);
|
||||
// app()->make(StoreSeckillActiveRepository::class)->updateByProduct($id, $dat);
|
||||
@ -306,7 +308,7 @@ class ProductRepository extends BaseRepository
|
||||
app()->make(SpuRepository::class)->changeStatus($id, $productType);
|
||||
Db::commit();
|
||||
return $res;
|
||||
}catch(\Exception $e){
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
return false;
|
||||
}
|
||||
@ -525,7 +527,7 @@ class ProductRepository extends BaseRepository
|
||||
{
|
||||
$result = [];
|
||||
foreach ($data as $value) {
|
||||
if($value['category']){
|
||||
if ($value['category']) {
|
||||
$result[] = [
|
||||
'product_id' => $productId,
|
||||
'mer_cate_id' => $value,
|
||||
@ -790,7 +792,7 @@ class ProductRepository extends BaseRepository
|
||||
unset($data['content']);
|
||||
$data['content'] = $content;
|
||||
// $attr = $this->detailAttr($data['attr']);
|
||||
$attrValue =$data['attrValue'];
|
||||
$attrValue = $data['attrValue'];
|
||||
|
||||
$sku = $this->detailAttrValue($attrValue, null, $data['product_type'], null);
|
||||
$data['sku'] = $sku;
|
||||
@ -842,7 +844,7 @@ class ProductRepository extends BaseRepository
|
||||
$where['product_type'] = $productType;
|
||||
if (!$merId) $where['is_gift_bag'] = 0;
|
||||
}
|
||||
if ($productType == 1 ||$productType==98) {
|
||||
if ($productType == 1 || $productType == 98) {
|
||||
$where['product_type'] = $productType;
|
||||
}
|
||||
if ($productType == 10) {
|
||||
@ -2357,7 +2359,7 @@ class ProductRepository extends BaseRepository
|
||||
$price = $params['price'] ?? 0;
|
||||
$orderProduct = StoreOrderProduct::where('order_id', $params['order_id'])->where('product_id', $params['order_product_id'])
|
||||
->where('product_sku', $params['order_unique'])->find();
|
||||
$stockIn=$orderProduct['product_num'];
|
||||
$stockIn = $orderProduct['product_num'];
|
||||
if ($stockIn <= 0) {
|
||||
throw new ValidateException('入库数量不能小于等于0');
|
||||
}
|
||||
@ -2377,7 +2379,7 @@ class ProductRepository extends BaseRepository
|
||||
}
|
||||
if ($orderProduct->is_imported == 0) {
|
||||
|
||||
$attrValue->stock=$attrValue->stock + $stockIn;
|
||||
$attrValue->stock = $attrValue->stock + $stockIn;
|
||||
$product->stock = $stockIn + $product->stock;
|
||||
$data = [
|
||||
'order_id' => $params['order_id'] ?? 0,
|
||||
@ -2398,7 +2400,7 @@ class ProductRepository extends BaseRepository
|
||||
$product->save();
|
||||
Db::commit();
|
||||
return true;
|
||||
}else{
|
||||
} else {
|
||||
throw new ValidateException('该商品已导入过');
|
||||
}
|
||||
$stockIn = $orderProduct['product_num'] ?? 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user