This commit is contained in:
luofei 2024-01-21 15:05:03 +08:00
commit ab8e458f00

View File

@ -499,7 +499,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
];
$platformConsumption = Db::name('store_consumption_user')->where($ConsumptionWhere)->limit(100)->order('create_time', 'desc')
->field('coupon_user_id,uid,coupon_title,coupon_price,start_time,end_time')
->field('coupon_user_id,uid,coupon_title,coupon_price,balance,start_time,end_time')
->select()->each(function ($item) {
$item['describe'] = '仅限平台指定商家商品可使用';
return $item;
@ -1001,6 +1001,17 @@ class StoreOrderCreateRepository extends StoreOrderRepository
'status' => 1
];
}
if ($order['consumption_money'] > 0) {
$consumptionDetails[] = [
'user_id' => $uid,
'order_id' => $_order->order_id,
'group_order_id' => $groupOrder->group_order_id,
'type' => 1,
'amount' => $order['consumption_money'],
'pay_price' => $order['total_price'],
'create_time' => time()
];
}
//创建发票信息
if (isset($receipt_data[$_order['mer_id']])) {
@ -1117,6 +1128,9 @@ class StoreOrderCreateRepository extends StoreOrderRepository
if (count($bills) > 0) {
app()->make(UserBillRepository::class)->insertAll($bills);
}
if (count($consumptionDetails) > 0) {
Db::name('store_consumption_detail')->insertAll($consumptionDetails);
}
$storeOrderStatusRepository->batchCreateLog($orderStatus);
$storeOrderProductRepository->insertAll($orderProduct);
event('order.create', compact('groupOrder'));