$data['source']判断
This commit is contained in:
parent
b331323ca0
commit
97f6f141f6
@ -1933,20 +1933,19 @@ class ProductRepository extends BaseRepository
|
||||
if ($data['cart_num'] !== 1) throw new ValidateException('礼包商品只能购买一个');
|
||||
if ($userInfo->is_promoter) throw new ValidateException('您已经是分销员了');
|
||||
}
|
||||
|
||||
//立即购买 限购
|
||||
if ($data['is_new']) {
|
||||
$cart_num = $data['cart_num'];
|
||||
} else {
|
||||
//加入购物车
|
||||
//购物车现有
|
||||
$_num = $this->productOnceCountCart($where['product_id'], $data['product_attr_unique'], $userInfo->uid, $data['product_type']);
|
||||
$_num = $this->productOnceCountCart($where['product_id'], $data['product_attr_unique'], $userInfo->uid, $data['product_type'],$data['source']);
|
||||
$cart_num = $_num + $data['cart_num'];
|
||||
}
|
||||
if ($sku['stock'] < $cart_num) throw new ValidateException('库存不足');
|
||||
//添加购物车
|
||||
if (!$data['is_new']) {
|
||||
$cart = app()->make(StoreCartRepository::class)->getCartByProductSku($data['product_attr_unique'], $userInfo->uid, $data['product_type']);
|
||||
$cart = app()->make(StoreCartRepository::class)->getCartByProductSku($data['product_attr_unique'], $userInfo->uid, $data['product_type'],$data['source']);
|
||||
}
|
||||
return compact('product', 'sku', 'cart');
|
||||
}
|
||||
|
@ -91,9 +91,9 @@ class StoreCart extends BaseController
|
||||
case 0: //普通商品
|
||||
case 98: //供应链商品
|
||||
case 99: //委托商品
|
||||
$result = app()->make(ProductRepository::class)->cartCheck($data,$this->request->userInfo());
|
||||
[$source, $sourceId, $pid] = explode(':', $this->request->param('source', '0'), 3) + ['', '', ''];
|
||||
$data['source'] = $source;
|
||||
$result = app()->make(ProductRepository::class)->cartCheck($data,$this->request->userInfo());
|
||||
break;
|
||||
case 1: //秒杀商品
|
||||
$result = app()->make(ProductRepository::class)->cartSeckillCheck($data,$this->request->userInfo());
|
||||
|
Loading…
x
Reference in New Issue
Block a user