update: commission

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

View File

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