mirror of
https://github.com/lkddi/Xboard.git
synced 2026-04-03 18:40:52 +08:00
fix: intval u/d to avoid bigint overflow (#821)
This commit is contained in:
@@ -85,8 +85,8 @@ class StatUserJob implements ShouldQueue
|
||||
|
||||
if ($existingRecord) {
|
||||
$existingRecord->update([
|
||||
'u' => $existingRecord->u + ($v[0] * $this->server['rate']),
|
||||
'd' => $existingRecord->d + ($v[1] * $this->server['rate']),
|
||||
'u' => $existingRecord->u + intval($v[0] * $this->server['rate']),
|
||||
'd' => $existingRecord->d + intval($v[1] * $this->server['rate']),
|
||||
'updated_at' => time(),
|
||||
]);
|
||||
} else {
|
||||
@@ -95,8 +95,8 @@ class StatUserJob implements ShouldQueue
|
||||
'server_rate' => $this->server['rate'],
|
||||
'record_at' => $recordAt,
|
||||
'record_type' => $this->recordType,
|
||||
'u' => ($v[0] * $this->server['rate']),
|
||||
'd' => ($v[1] * $this->server['rate']),
|
||||
'u' => intval($v[0] * $this->server['rate']),
|
||||
'd' => intval($v[1] * $this->server['rate']),
|
||||
'created_at' => time(),
|
||||
'updated_at' => time(),
|
||||
]);
|
||||
@@ -112,8 +112,8 @@ class StatUserJob implements ShouldQueue
|
||||
'server_rate' => $this->server['rate'],
|
||||
'record_at' => $recordAt,
|
||||
'record_type' => $this->recordType,
|
||||
'u' => ($v[0] * $this->server['rate']),
|
||||
'd' => ($v[1] * $this->server['rate']),
|
||||
'u' => intval($v[0] * $this->server['rate']),
|
||||
'd' => intval($v[1] * $this->server['rate']),
|
||||
'created_at' => time(),
|
||||
'updated_at' => time(),
|
||||
],
|
||||
@@ -133,8 +133,8 @@ class StatUserJob implements ShouldQueue
|
||||
{
|
||||
$table = (new StatUser())->getTable();
|
||||
$now = time();
|
||||
$u = ($v[0] * $this->server['rate']);
|
||||
$d = ($v[1] * $this->server['rate']);
|
||||
$u = intval($v[0] * $this->server['rate']);
|
||||
$d = intval($v[1] * $this->server['rate']);
|
||||
|
||||
$sql = "INSERT INTO {$table} (user_id, server_rate, record_at, record_type, u, d, created_at, updated_at)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
||||
|
||||
Reference in New Issue
Block a user