update: commission

This commit is contained in:
tokumeikoi 2021-01-13 12:24:22 +09:00
parent fe736df68d
commit 1ce019cfa5

View File

@ -63,14 +63,11 @@ class CheckCommission extends Command
->where('invite_user_id', '!=', NULL)
->get();
foreach ($order as $item) {
DB::beginTransaction();
$inviter = User::find($item->invite_user_id);
if (!$inviter) continue;
$inviter->commission_balance = $inviter->commission_balance + $item->commission_balance;
if (!$inviter->save()) {
DB::rollBack();
continue;
}
DB::beginTransaction();
if ($inviter->save()) {
$item->commission_status = 2;
if (!$item->save()) {
DB::rollBack();
@ -79,5 +76,6 @@ class CheckCommission extends Command
DB::commit();
}
}
}
}