修复内容
This commit is contained in:
@@ -491,8 +491,8 @@ class OrderLogic extends LogicBase
|
||||
// 拆分后每个订单的金额需要重新计算,这里先验证原始总金额
|
||||
// 实际拆分时每个订单会独立计算
|
||||
} else {
|
||||
if($user_money < $data['order_amount']){
|
||||
throw new Exception('账户余额不足');
|
||||
if($user_money < $data['order_amount']){
|
||||
throw new Exception('账户余额不足');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -556,10 +556,13 @@ class OrderLogic extends LogicBase
|
||||
|
||||
// 创建单个订单
|
||||
$single_goods_lists = $single_order_data['goods_lists'];
|
||||
if (empty($single_goods_lists)) {
|
||||
throw new Exception('商品信息获取失败');
|
||||
}
|
||||
$single_goods_id = $single_goods_lists[0]['goods_id'];
|
||||
|
||||
|
||||
$order = self::addOrder($user_id, $single_order_data, $order_source, $user_address, $single_goods_id);
|
||||
$order_id = $order['order_id'];
|
||||
$order_id = $order['order_id'];
|
||||
$order_ids[] = $order_id;
|
||||
|
||||
self::addOrderGoods($order_id, $single_goods_lists);
|
||||
@@ -590,6 +593,9 @@ class OrderLogic extends LogicBase
|
||||
}
|
||||
|
||||
$single_goods_lists = $single_order_data['goods_lists'];
|
||||
if (empty($single_goods_lists)) {
|
||||
throw new Exception('商品信息获取失败');
|
||||
}
|
||||
$single_goods_id = $single_goods_lists[0]['goods_id'];
|
||||
|
||||
$order = self::addOrder($user_id, $single_order_data, $order_source, $user_address, $single_goods_id);
|
||||
@@ -607,30 +613,36 @@ class OrderLogic extends LogicBase
|
||||
}
|
||||
} else {
|
||||
// 普通商品:保持原有逻辑
|
||||
if (empty($goods_lists)) {
|
||||
throw new Exception('商品信息获取失败');
|
||||
}
|
||||
$goods_id = $goods_lists[0]['goods_id'];
|
||||
|
||||
$order = self::addOrder($user_id, $data, $order_source, $user_address, $goods_id);
|
||||
$order_id = $order['order_id'];
|
||||
$order_ids[] = $order_id;
|
||||
|
||||
self::addOrderGoods($order_id, $goods_lists);
|
||||
self::addOrderAfter($order_id, $user_id, $type, $data);
|
||||
|
||||
//支付方式为余额支付,扣除余额,更新订单状态,支付状态
|
||||
if ($data['pay_way'] == Pay::BALANCE_PAY || $data['order_amount'] == 0) {
|
||||
PayNotifyLogic::handle('order', $order['order_sn'], []);
|
||||
}
|
||||
|
||||
self::addOrderGoods($order_id, $goods_lists);
|
||||
self::addOrderAfter($order_id, $user_id, $type, $data);
|
||||
|
||||
//支付方式为余额支付,扣除余额,更新订单状态,支付状态
|
||||
if ($data['pay_way'] == Pay::BALANCE_PAY || $data['order_amount'] == 0) {
|
||||
PayNotifyLogic::handle('order', $order['order_sn'], []);
|
||||
}
|
||||
|
||||
// 砍价订单处理
|
||||
if (isset($post['bargain_launch_id']) and $post['bargain_launch_id'] > 0) {
|
||||
$bargainLaunchModel = new BargainLaunch();
|
||||
$bargainLaunchModel->where(['id'=>(int)$post['bargain_launch_id']])
|
||||
->update(['order_id'=>$order_id, 'status'=>1]);
|
||||
// 砍价订单处理
|
||||
if (isset($post['bargain_launch_id']) and $post['bargain_launch_id'] > 0) {
|
||||
$bargainLaunchModel = new BargainLaunch();
|
||||
$bargainLaunchModel->where(['id'=>(int)$post['bargain_launch_id']])
|
||||
->update(['order_id'=>$order_id, 'status'=>1]);
|
||||
}
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
return self::dataSuccess('', ['order_id' => $order_ids[0] ?? 0, 'order_ids' => $order_ids, 'type' => 'order']);
|
||||
if (empty($order_ids)) {
|
||||
throw new Exception('订单创建失败');
|
||||
}
|
||||
return self::dataSuccess('', ['order_id' => $order_ids[0], 'order_ids' => $order_ids, 'type' => 'order']);
|
||||
|
||||
} catch (Exception $e) {
|
||||
Db::rollback();
|
||||
|
||||
Reference in New Issue
Block a user