mirror of
https://github.com/lkddi/Xboard.git
synced 2026-04-03 10:30:51 +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) {
|
if ($existingRecord) {
|
||||||
$existingRecord->update([
|
$existingRecord->update([
|
||||||
'u' => $existingRecord->u + ($v[0] * $this->server['rate']),
|
'u' => $existingRecord->u + intval($v[0] * $this->server['rate']),
|
||||||
'd' => $existingRecord->d + ($v[1] * $this->server['rate']),
|
'd' => $existingRecord->d + intval($v[1] * $this->server['rate']),
|
||||||
'updated_at' => time(),
|
'updated_at' => time(),
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
@@ -95,8 +95,8 @@ class StatUserJob implements ShouldQueue
|
|||||||
'server_rate' => $this->server['rate'],
|
'server_rate' => $this->server['rate'],
|
||||||
'record_at' => $recordAt,
|
'record_at' => $recordAt,
|
||||||
'record_type' => $this->recordType,
|
'record_type' => $this->recordType,
|
||||||
'u' => ($v[0] * $this->server['rate']),
|
'u' => intval($v[0] * $this->server['rate']),
|
||||||
'd' => ($v[1] * $this->server['rate']),
|
'd' => intval($v[1] * $this->server['rate']),
|
||||||
'created_at' => time(),
|
'created_at' => time(),
|
||||||
'updated_at' => time(),
|
'updated_at' => time(),
|
||||||
]);
|
]);
|
||||||
@@ -112,8 +112,8 @@ class StatUserJob implements ShouldQueue
|
|||||||
'server_rate' => $this->server['rate'],
|
'server_rate' => $this->server['rate'],
|
||||||
'record_at' => $recordAt,
|
'record_at' => $recordAt,
|
||||||
'record_type' => $this->recordType,
|
'record_type' => $this->recordType,
|
||||||
'u' => ($v[0] * $this->server['rate']),
|
'u' => intval($v[0] * $this->server['rate']),
|
||||||
'd' => ($v[1] * $this->server['rate']),
|
'd' => intval($v[1] * $this->server['rate']),
|
||||||
'created_at' => time(),
|
'created_at' => time(),
|
||||||
'updated_at' => time(),
|
'updated_at' => time(),
|
||||||
],
|
],
|
||||||
@@ -133,8 +133,8 @@ class StatUserJob implements ShouldQueue
|
|||||||
{
|
{
|
||||||
$table = (new StatUser())->getTable();
|
$table = (new StatUser())->getTable();
|
||||||
$now = time();
|
$now = time();
|
||||||
$u = ($v[0] * $this->server['rate']);
|
$u = intval($v[0] * $this->server['rate']);
|
||||||
$d = ($v[1] * $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)
|
$sql = "INSERT INTO {$table} (user_id, server_rate, record_at, record_type, u, d, created_at, updated_at)
|
||||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
||||||
|
|||||||
Reference in New Issue
Block a user