修复小组采购,购物车内容状态没更新
This commit is contained in:
parent
ae6481d272
commit
6f8ab98bf5
@ -1132,6 +1132,11 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
$cart['extension_one'] = $extension_one;
|
$cart['extension_one'] = $extension_one;
|
||||||
$cart['extension_two'] = $extension_two;
|
$cart['extension_two'] = $extension_two;
|
||||||
$cart['cost'] = $cost;
|
$cart['cost'] = $cost;
|
||||||
|
// 获取购物车ID
|
||||||
|
foreach ($merchantCart['list'] as &$cart) {
|
||||||
|
$cartIds[] = $cart['cart_id'];
|
||||||
|
}
|
||||||
|
unset($cart);
|
||||||
|
|
||||||
// 开始计算------------------------------------------------------------
|
// 开始计算------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -1794,6 +1794,7 @@ class ProductDgRepository extends BaseRepository
|
|||||||
$_num = $this->productOnceCountCart($where['product_id'],$data['product_attr_unique'], $userInfo->uid);
|
$_num = $this->productOnceCountCart($where['product_id'],$data['product_attr_unique'], $userInfo->uid);
|
||||||
$cart_num = $_num + $data['cart_num'];
|
$cart_num = $_num + $data['cart_num'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sku['stock'] < $cart_num ) throw new ValidateException('库存不足');
|
if ($sku['stock'] < $cart_num ) throw new ValidateException('库存不足');
|
||||||
//添加购物车
|
//添加购物车
|
||||||
if (!$data['is_new']) {
|
if (!$data['is_new']) {
|
||||||
|
@ -68,7 +68,7 @@ class StoreCart extends BaseController
|
|||||||
{
|
{
|
||||||
$data = $this->checkParams($validate);
|
$data = $this->checkParams($validate);
|
||||||
|
|
||||||
if(!in_array($data['product_type'],[0,1,2,3,4,99])) return app('json')->fail('商品类型错误');
|
if(!in_array($data['product_type'],[0,1,2,3,4])) return app('json')->fail('商品类型错误');
|
||||||
if ($data['cart_num'] <= 0) return app('json')->fail('购买数量有误');
|
if ($data['cart_num'] <= 0) return app('json')->fail('购买数量有误');
|
||||||
$user = $this->request->userInfo();
|
$user = $this->request->userInfo();
|
||||||
event('user.cart.before',compact('user','data'));
|
event('user.cart.before',compact('user','data'));
|
||||||
@ -102,12 +102,7 @@ class StoreCart extends BaseController
|
|||||||
$data['source_id'] = $data['group_buying_id'];
|
$data['source_id'] = $data['group_buying_id'];
|
||||||
$data['product_id'] = $result['product']['product_id'];
|
$data['product_id'] = $result['product']['product_id'];
|
||||||
break;
|
break;
|
||||||
case 99: //小组代购
|
|
||||||
$result = app()->make(ProductRepository::class)->cartCheck($data,$this->request->userInfo());
|
|
||||||
[$source, $sourceId, $pid] = explode(':', $this->request->param('source', '0'), 3) + ['', '', ''];
|
|
||||||
$data['source'] = (in_array($source, [0, 1]) && $pid == $data['product_id']) ? $source : 0;
|
|
||||||
if ($data['source'] > 0) $data['source_id'] = intval($sourceId);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($data['group_buying_id']);
|
unset($data['group_buying_id']);
|
||||||
|
@ -70,7 +70,7 @@ class StoreCartDg extends BaseController
|
|||||||
public function create(validate $validate)
|
public function create(validate $validate)
|
||||||
{
|
{
|
||||||
$data = $this->checkParams($validate);
|
$data = $this->checkParams($validate);
|
||||||
if(!in_array($data['product_type'],[0,1,2,3,4,99])) return app('json')->fail('商品类型错误');
|
if(!in_array($data['product_type'],[0,1,2,3,4])) return app('json')->fail('商品类型错误');
|
||||||
if ($data['cart_num'] <= 0) return app('json')->fail('购买数量有误');
|
if ($data['cart_num'] <= 0) return app('json')->fail('购买数量有误');
|
||||||
$user = $this->request->userInfo();
|
$user = $this->request->userInfo();
|
||||||
event('user.cart.before',compact('user','data'));
|
event('user.cart.before',compact('user','data'));
|
||||||
@ -104,12 +104,6 @@ class StoreCartDg extends BaseController
|
|||||||
$data['source_id'] = $data['group_buying_id'];
|
$data['source_id'] = $data['group_buying_id'];
|
||||||
$data['product_id'] = $result['product']['product_id'];
|
$data['product_id'] = $result['product']['product_id'];
|
||||||
break;
|
break;
|
||||||
case 99: //小组代购
|
|
||||||
$result = app()->make(ProductDgRepository::class)->cartCheck($data,$this->request->userInfo());
|
|
||||||
[$source, $sourceId, $pid] = explode(':', $this->request->param('source', '0'), 3) + ['', '', ''];
|
|
||||||
$data['source'] = (in_array($source, [0, 1]) && $pid == $data['product_id']) ? $source : 0;
|
|
||||||
if ($data['source'] > 0) $data['source_id'] = intval($sourceId);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($data['group_buying_id']);
|
unset($data['group_buying_id']);
|
||||||
|
@ -262,7 +262,7 @@ class SupplyChainOrderBrokerAgeJob implements JobInterface
|
|||||||
// SupplyChainBorkerage::create($dataArrSix);
|
// SupplyChainBorkerage::create($dataArrSix);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
\think\facade\Log::record('执行完毕');
|
\think\facade\Log::record('供应链佣金分布执行完毕');
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::info('小组服务佣金同步失败: ' . var_export($data, 1) . $e->getMessage());
|
Log::info('小组服务佣金同步失败: ' . var_export($data, 1) . $e->getMessage());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user