mirror of
https://github.com/v2board/v2board.git
synced 2025-01-26 16:09:09 +08:00
update: order service
This commit is contained in:
parent
b85eb72d1a
commit
d0cab99ae4
@ -117,30 +117,28 @@ class OrderService
|
|||||||
public function setInvite(User $user):void
|
public function setInvite(User $user):void
|
||||||
{
|
{
|
||||||
$order = $this->order;
|
$order = $this->order;
|
||||||
if ($user->invite_user_id && $order->total_amount > 0) {
|
if ($user->invite_user_id && ($order->total_amount <= 0)) return;
|
||||||
$order->invite_user_id = $user->invite_user_id;
|
$order->invite_user_id = $user->invite_user_id;
|
||||||
$inviter = User::find($user->invite_user_id);
|
$inviter = User::find($user->invite_user_id);
|
||||||
$isCommission = false;
|
$isCommission = false;
|
||||||
switch ((int)$inviter->commission_type) {
|
switch ((int)$inviter->commission_type) {
|
||||||
case 0:
|
case 0:
|
||||||
$commissionFirstTime = (int)config('v2board.commission_first_time_enable', 1);
|
$commissionFirstTime = (int)config('v2board.commission_first_time_enable', 1);
|
||||||
$isCommission = (!$commissionFirstTime || ($commissionFirstTime && !$this->haveValidOrder($user)));
|
$isCommission = (!$commissionFirstTime || ($commissionFirstTime && !$this->haveValidOrder($user)));
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
$isCommission = true;
|
$isCommission = true;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
$isCommission = !$this->haveValidOrder($user);
|
$isCommission = !$this->haveValidOrder($user);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($isCommission) {
|
if ($isCommission) return;
|
||||||
if ($inviter && $inviter->commission_rate) {
|
if ($inviter && $inviter->commission_rate) {
|
||||||
$order->commission_balance = $order->total_amount * ($inviter->commission_rate / 100);
|
$order->commission_balance = $order->total_amount * ($inviter->commission_rate / 100);
|
||||||
} else {
|
} else {
|
||||||
$order->commission_balance = $order->total_amount * (config('v2board.invite_commission', 10) / 100);
|
$order->commission_balance = $order->total_amount * (config('v2board.invite_commission', 10) / 100);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
public/theme/v2board/assets/umi.js
vendored
2
public/theme/v2board/assets/umi.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user