|
@@ -110,7 +110,7 @@ class Order extends Base
|
|
|
$remark = $this->request->post('remark','','trim'); // 备注
|
|
|
$cart_ids = $this->request->post('cart_ids/a'); // 购物车ID数组
|
|
|
$goods_list = $this->request->post('goods_list/a'); // 商品列表
|
|
|
-
|
|
|
+ $userId = $this->auth->id;
|
|
|
$order = null;
|
|
|
try {
|
|
|
if (!empty($cart_ids)) {
|
|
@@ -121,16 +121,16 @@ class Order extends Base
|
|
|
}
|
|
|
|
|
|
// 先转换购物车为商品列表
|
|
|
- $goods_list = CartService::convertCartToGoodsList($cart_ids, $this->auth->id);
|
|
|
+ $goods_list = CartService::convertCartToGoodsList($cart_ids, $userId);
|
|
|
|
|
|
// 创建订单
|
|
|
- $order = OrderService::createOrder($address_id, $this->auth->id, $goods_list, $user_coupon_id, $remark);
|
|
|
+ $order = OrderService::createOrder($address_id, $userId, $goods_list, $user_coupon_id, $remark);
|
|
|
|
|
|
// 购物车订单创建成功后清理购物车
|
|
|
- CartService::clear($cart_ids);
|
|
|
+ CartService::clear($cart_ids,$userId);
|
|
|
} elseif (!empty($goods_list)) {
|
|
|
// 商品列表模式 - 直接创建订单
|
|
|
- $order = OrderService::createOrder($address_id, $this->auth->id, $goods_list, $user_coupon_id, $remark);
|
|
|
+ $order = OrderService::createOrder($address_id, $userId, $goods_list, $user_coupon_id, $remark);
|
|
|
} else {
|
|
|
$this->error('请提供购物车ID或商品列表');
|
|
|
}
|