update: optimize commission calculation

This commit is contained in:
tokumeikoi 2022-02-07 15:01:11 +08:00
parent 03846022ef
commit 8a18bdf9c3
2 changed files with 5 additions and 1 deletions

View File

@ -93,6 +93,7 @@ class CheckCommission extends Command
0 => 100
];
}
$actualPayCommissionAmount = 0;
for ($l = 0; $l < $level; $l++) {
$inviter = User::find($inviteUserId);
if (!$inviter) continue;
@ -118,7 +119,10 @@ class CheckCommission extends Command
return false;
}
$inviteUserId = $inviter->invite_user_id;
$actualPayCommissionAmount = $actualPayCommissionAmount + $commissionBalance;
}
// update order commission balance
$order->commission_balance = $actualPayCommissionAmount;
return true;
}

File diff suppressed because one or more lines are too long