| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <?php
- requirePHPLib('form');
- requirePHPLib('judger');
- if ($myUser == null || !isSuperUser($myUser))
- become403Page();
- $cancel_form = new UOJForm('retry');
- $cancel_form->addInput('id', 'text', '重试请求', '',
- function ($id) {
- if (!validateUInt($id)) return 'ID 不合法';
- $u = queryDatumBrief($id);
- if (!$u) return '请求不存在';
- if ($u['status'] == 'Generating') return '请求处理中';
- return '';
- }, null);
- $cancel_form->handle = function() {
- $id = $_POST['id'];
- DB::update("update datum_requests set status = 'Waiting' where id = $id");
- };
- $cancel_form->submit_button_config['class_str'] = 'btn btn-danger';
- $cancel_form->submit_button_config['align'] = 'offset';
- $cancel_form->submit_button_config['text'] = '重试';
- $cancel_form->runAtServer();
- $retry_form = new UOJForm('retry');
- $retry_form->addInput('id', 'text', '重试请求', '',
- function ($id) {
- if (!validateUInt($id)) return 'ID 不合法';
- $u = queryDatumBrief($id);
- if (!$u) return '请求不存在';
- if ($u['status'] == 'Generating') return '请求处理中';
- return '';
- }, null);
- $retry_form->handle = function() {
- $id = $_POST['id'];
- DB::update("update datum_requests set request_time = now() where id = $id");
- DB::update("update datum_requests set finish_time = NULL where id = $id");
- DB::update("update datum_requests set status = 'Waiting' where id = $id");
- };
- $retry_form->submit_button_config['class_str'] = 'btn btn-danger';
- $retry_form->submit_button_config['align'] = 'offset';
- $retry_form->submit_button_config['text'] = '重试';
- $retry_form->runAtServer();
- $new_datum_form = new UOJForm('datum');
- $new_datum_form->addInput('pid', 'text', '题目编号', '',
- function ($pid) {
- if (!validateUInt($pid)) return '题号不合法';
- if (!queryProblemBrief($pid)) return '题目不存在';
- return '';
- }, null);
- $new_datum_form->addInput('timelim', 'text', '时间限制', '',
- function ($pid) {
- if (!validateUInt($pid)) return '时间限制不合法';
- return '';
- }, null);
- $new_datum_form->addInput('memlim', 'text', '空间限制', '',
- function ($pid) {
- if (!validateUInt($pid)) return '空间限制不合法';
- return '';
- }, null);
- $new_datum_form->addSourceCodeInput('std', '标程', array('C++17'));
- $new_datum_form->handle = function() {
- $std = '';
- if ($_POST['std_upload_type'] == 'editor') $std = $_POST['std_editor'];
- else $std = $_POST['std_file'];
- $std = DB::escape($std);
- $pid = $_POST['pid'];
- $timelim = $_POST['timelim'];
- $memlim = $_POST['memlim'];
- DB::insert("insert into datum_requests (pid, request_time, timelimit, memlimit, status, std) values ($pid, now(), $timelim, $memlim, 'Waiting', '$std')");
- };
- $new_datum_form->runAtServer();
- ?>
- <?php echoUOJPageHeader('自动数据生成') ?>
- <?php
- echoDatumList();
- echo '<h4>重试由大模型不稳定导致失败的请求</h4>';
- $retry_form->printHTML();
- echo '<h4>数据生成完毕后请手动点击校验配置并同步数据</h4>';
- $new_datum_form->printHTML();
- ?>
- <?php echoUOJPageFooter() ?>
|