mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-09 23:08:42 +00:00
33 lines
714 B
PHP
33 lines
714 B
PHP
<?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)
|
|
])
|
|
]);
|
|
}
|
|
}
|