From b3a8b003f7a2429f0455e6dc5a470750d0cb4cf9 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Mon, 20 Mar 2023 07:09:51 +0800 Subject: [PATCH] feat: newLuoguRemoteProblem() --- web/app/libs/uoj-luogu-lib.php | 36 ++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/web/app/libs/uoj-luogu-lib.php b/web/app/libs/uoj-luogu-lib.php index 1a57a5a..527f76a 100644 --- a/web/app/libs/uoj-luogu-lib.php +++ b/web/app/libs/uoj-luogu-lib.php @@ -1,12 +1,14 @@ "answer", + "type" => "source code", + "file_name" => "answer.code", + "languages" => LUOGU_SUPPORTED_LANGUAGES, + ), + )); + $esc_extra_config = json_encode(array( + "luogu_pid" => $pid, + "view_content_type" => "ALL", + "view_details_type" => "ALL", + )); + + DB::query("insert into problems (title, is_hidden, submission_requirement, extra_config, hackable, type) values ('" . DB::escape($problem['title']) . "', 1, '" . DB::escape($esc_submission_requirements) . "', '" . DB::escape($esc_extra_config) . "', 0, 'luogu')"); + + $id = DB::insert_id(); + + DB::query("insert into problems_contents (id, statement, statement_md) values ($id, '" . DB::escape($problem['statement']) . "', '" . DB::escape($problem['statement_md']) . "')"); + + dataNewProblem($id); + + return $id; +}