移除多余接口

This commit is contained in:
undefined committed 2021-02-05 17:30:22 +08:00
1 parent 33aaf1f2ea
commit 0ceb095314
4 files changed
+9 -15

No files matched your search

+5 -5
View File
@@ -98,9 +98,9 @@ class SystemScriptHandler extends SystemHandler {
if (!global.Hydro.script[id]) throw new ValidationError('id');
const args = JSON.parse(raw);
validate(global.Hydro.script[id].validate, args);
const rid = await record.add(domainId, -1, this.user._id, '-', id, false, { input: 'raw' });
const rid = await record.add(domainId, -1, this.user._id, '-', id, false, 'raw');
const report = (data) => judge.next({ domainId, rid, ...data });
report({ message: `Running script: ${id}`, status: STATUS.STATUS_JUDGING });
report({ message: `Running script: ${id} `, status: STATUS.STATUS_JUDGING });
const start = new Date().getTime();
// Maybe async?
global.Hydro.script[id].run(args, report)
@@ -122,7 +122,7 @@ class SystemScriptHandler extends SystemHandler {
domainId,
rid,
status: STATUS.STATUS_SYSTEM_ERROR,
message: `${err}\n${err.stack}`,
message: `${err} \n${err.stack} `,
judger: 1,
time,
memory: 0,
@@ -149,8 +149,8 @@ class SystemSettingHandler extends SystemHandler {
for (const key in args) {
if (typeof args[key] === 'object') {
for (const subkey in args[key]) {
if (typeof set(`${key}.${subkey}`, args[key][subkey]) !== 'undefined') {
tasks.push(system.set(`${key}.${subkey}`, set(`${key}.${subkey}`, args[key][subkey])));
if (typeof set(`${key}.${subkey} `, args[key][subkey]) !== 'undefined') {
tasks.push(system.set(`${key}.${subkey} `, set(`${key}.${subkey} `, args[key][subkey])));
}
}
} else if (typeof set(key, args[key]) !== 'undefined') {
+2 -7
View File
@@ -260,16 +260,11 @@ export class ProblemPretestHandler extends ProblemDetailHandler {
@param('lang', Types.String)
@param('code', Types.String)
@param('input', Types.String, true)
async post(domainId: string, lang: string, code: string, input: string = '') {
async post(domainId: string, lang: string, code: string, input = '') {
this.limitRate('add_record', 3600, 100);
const rid = await record.add(
domainId, this.pdoc.docId, this.user._id,
lang, code, true,
{
input,
time: '1s',
memory: '512m',
},
lang, code, true, input,
);
const rdoc = await record.get(domainId, rid);
bus.boardcast('record/change', rdoc);