S2OJ/web/app/models/UOJSystemUpdate.php

33 lines
714 B
PHP
Raw Permalink Normal View History

2022-11-06 02:26:21 +00:00
<?php
class UOJSystemUpdate {
public static function updateProblem(UOJProblem $problem, $message, $time = null) {
if ($time === null) {
$time = DB::now();
}
DB::insert([
'insert into system_updates',
'(time, type, target_id, message)',
'values', DB::tuple([
$time, 'problem', $problem->info['id'], json_encode($message)
])
]);
}
public static function updateProblemInternally(UOJProblem $problem, $message, $time = null) {
if ($time === null) {
$time = DB::now();
}
DB::insert([
'insert into system_updates',
'(time, type, target_id, message)',
'values', DB::tuple([
$time, 'problem_internally', $problem->info['id'], json_encode($message)
])
]);
}
}