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