update: server log

This commit is contained in:
tokumeikoi 2021-09-03 00:31:12 +09:00
parent c183462ef3
commit c2577e37c4

View File

@ -268,12 +268,15 @@ class ServerService
->where('user_id', $userId) ->where('user_id', $userId)
->where('rate', $rate) ->where('rate', $rate)
->where('method', $method) ->where('method', $method)
->lockForUpdate()
->first(); ->first();
if ($serverLog) { if ($serverLog) {
$serverLog->u = $serverLog->u + $u; try {
$serverLog->d = $serverLog->d + $d; $serverLog->increment('u', $u);
return $serverLog->save(); $serverLog->increment('d', $d);
return true;
} catch (\Exception $e) {
return false;
}
} else { } else {
$serverLog = new ServerLog(); $serverLog = new ServerLog();
$serverLog->user_id = $userId; $serverLog->user_id = $userId;