S2OJ/web/app/models/UOJSystemUpdate.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)
])
]);
}
}