mirror of
https://github.com/v2board/v2board.git
synced 2024-11-10 17:49:11 +08:00
update
This commit is contained in:
parent
42ad99065e
commit
99117cca58
@ -138,16 +138,6 @@ class ServerService
|
|||||||
|
|
||||||
public function log(int $userId, int $serverId, int $u, int $d, float $rate)
|
public function log(int $userId, int $serverId, int $u, int $d, float $rate)
|
||||||
{
|
{
|
||||||
$serverLog = ServerLog::where('user_id', $userId)
|
|
||||||
->where('server_id', $serverId)
|
|
||||||
->where('created_at', '>=', strtotime(date('Y-m-d h:00:00')))
|
|
||||||
->orderBy('created_at', 'DESC')
|
|
||||||
->first();
|
|
||||||
if ($serverLog) {
|
|
||||||
$serverLog->u = $serverLog->u + $u;
|
|
||||||
$serverLog->d = $serverLog->d + $d;
|
|
||||||
$serverLog->save();
|
|
||||||
} else {
|
|
||||||
$serverLog = new ServerLog();
|
$serverLog = new ServerLog();
|
||||||
$serverLog->user_id = $userId;
|
$serverLog->user_id = $userId;
|
||||||
$serverLog->server_id = $serverId;
|
$serverLog->server_id = $serverId;
|
||||||
@ -156,5 +146,4 @@ class ServerService
|
|||||||
$serverLog->rate = $rate;
|
$serverLog->rate = $rate;
|
||||||
$serverLog->save();
|
$serverLog->save();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user