|
|
@ -3,10 +3,12 @@ const enums = require('./enums'), |
|
|
|
url = require('url'); |
|
|
|
url = require('url'); |
|
|
|
|
|
|
|
|
|
|
|
module.exports.judge = async function (judge_state, priority) { |
|
|
|
module.exports.judge = async function (judge_state, priority) { |
|
|
|
let type, param; |
|
|
|
let type, param, extraFile = null; |
|
|
|
switch (judge_state.problem.type) { |
|
|
|
switch (judge_state.problem.type) { |
|
|
|
case 'submit-answer': |
|
|
|
case 'submit-answer': |
|
|
|
type = enums.ProblemType.AnswerSubmission; |
|
|
|
type = enums.ProblemType.AnswerSubmission; |
|
|
|
|
|
|
|
param = null; |
|
|
|
|
|
|
|
extraFile = 'static/uploads/answer/' + judge_state.code; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 'interaction': |
|
|
|
case 'interaction': |
|
|
|
type = enums.ProblemType.Interaction; |
|
|
|
type = enums.ProblemType.Interaction; |
|
|
@ -25,11 +27,14 @@ module.exports.judge = async function (judge_state, priority) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const req = { |
|
|
|
const req = { |
|
|
|
taskId: judge_state.id, |
|
|
|
content: { |
|
|
|
testData: judge_state.problem.id.toString(), |
|
|
|
taskId: judge_state.id, |
|
|
|
type: type, |
|
|
|
testData: judge_state.problem.id.toString(), |
|
|
|
priority: priority, |
|
|
|
type: type, |
|
|
|
param: param |
|
|
|
priority: priority, |
|
|
|
|
|
|
|
param: param |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
extraFileLocation: extraFile |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
await rp(url.resolve(syzoj.config.judge_server_addr, "/daemon/task"), { |
|
|
|
await rp(url.resolve(syzoj.config.judge_server_addr, "/daemon/task"), { |
|
|
|