mirror of
https://github.com/v2board/v2board.git
synced 2025-01-11 00:29:09 +08:00
update
This commit is contained in:
parent
fb0ebea836
commit
fc7f73b558
@ -125,16 +125,6 @@ class OrderController extends Controller
|
||||
} else {
|
||||
$order->type = 1;
|
||||
}
|
||||
// invite process
|
||||
if ($user->invite_user_id) {
|
||||
$order->invite_user_id = $user->invite_user_id;
|
||||
$inviter = User::find($user->invite_user_id);
|
||||
if ($inviter && $inviter->commission_rate) {
|
||||
$order->commission_balance = $order->total_amount * ($inviter->commission_rate / 100);
|
||||
} else {
|
||||
$order->commission_balance = $order->total_amount * (config('v2board.invite_commission', 10) / 100);
|
||||
}
|
||||
}
|
||||
// coupon process
|
||||
if (isset($coupon)) {
|
||||
switch ($coupon->type) {
|
||||
@ -159,7 +149,16 @@ class OrderController extends Controller
|
||||
$order->total_amount = 0;
|
||||
$order->status = 1;
|
||||
}
|
||||
|
||||
// invite process
|
||||
if ($user->invite_user_id && $order->total_amount > 0) {
|
||||
$order->invite_user_id = $user->invite_user_id;
|
||||
$inviter = User::find($user->invite_user_id);
|
||||
if ($inviter && $inviter->commission_rate) {
|
||||
$order->commission_balance = $order->total_amount * ($inviter->commission_rate / 100);
|
||||
} else {
|
||||
$order->commission_balance = $order->total_amount * (config('v2board.invite_commission', 10) / 100);
|
||||
}
|
||||
}
|
||||
if (!$order->save()) {
|
||||
DB::rollback();
|
||||
abort(500, '订单创建失败');
|
||||
|
Loading…
Reference in New Issue
Block a user