|
|
|
@ -99,6 +99,7 @@ class OrderService implements OrderServiceInterface |
|
|
|
|
|
|
|
// 循环处理订单总额、子订单总额、商品、商户订单等信息
|
|
|
|
$orderAmountTotal = 0; # 总订单金额
|
|
|
|
$orderGoods = []; |
|
|
|
foreach ($storeList as $key => &$item) { |
|
|
|
|
|
|
|
// 子订单数据处理
|
|
|
|
@ -142,7 +143,7 @@ class OrderService implements OrderServiceInterface |
|
|
|
|
|
|
|
// 子订单内商品处理
|
|
|
|
$goodsAmountTotal = 0; |
|
|
|
$orderGoods = []; |
|
|
|
|
|
|
|
if (!is_array($item['good_list'])||empty($item['good_list'])) { |
|
|
|
Db::rollBack(); |
|
|
|
return '订单商品异常'; |
|
|
|
@ -273,28 +274,12 @@ class OrderService implements OrderServiceInterface |
|
|
|
} |
|
|
|
|
|
|
|
// 处理红包的使用
|
|
|
|
$canUseConpons = $this->couponService->getOrderCanUseCoupons( |
|
|
|
$data['money'], |
|
|
|
$data['market_id'], |
|
|
|
$data['user_id'], |
|
|
|
[ |
|
|
|
'receive.id', |
|
|
|
'receive.user_id', |
|
|
|
'receive.number', |
|
|
|
'receive.number_remain', |
|
|
|
'receive.system_coupon_user_id', |
|
|
|
'coupon.discounts', |
|
|
|
'coupon.discount_type', |
|
|
|
] |
|
|
|
); |
|
|
|
|
|
|
|
if (is_array($canUseConpons)&&!empty($canUseConpons)) { |
|
|
|
$canUseCoupons = CouponUserRec::select(['id', 'user_id', 'number', 'number_remain', 'system_coupon_user_id']) |
|
|
|
->whereIn('id', $receiveCouponIds) |
|
|
|
->get(); |
|
|
|
if (is_array($canUseCoupons)&&!empty($canUseCoupons)) { |
|
|
|
# 使用记录、更新当前优惠券
|
|
|
|
foreach ($canUseConpons as $key => &$coupon) { |
|
|
|
|
|
|
|
if (!in_array($coupon->id, $receiveCouponIds)) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
foreach ($canUseCoupons as $key => &$coupon) { |
|
|
|
|
|
|
|
$couponUse = [ |
|
|
|
'user_id' => $coupon->user_id, |
|
|
|
|