虚拟判题机对接文档

接口方法列表


抓取题目API

接口定义

http://localhost:8080/vjudge/problem/crawlProblem.action?id=${id}

输入参数

参数名 类型 示例值 描述
id int 6 题目编号

返回示例

{
    "data": {
        "description": "<div class="panel_content">
  Calculate 
 <i>A + B</i>. 
 <br />
</div>
<div class="panel_bottom">
  &nbsp; 
</div>",
        "hint": "",
        "id": 1,
        "input": "<div class="panel_content">
  Each line will contain two integers 
 <i>A</i> and 
 <i>B</i>. Process to end of file. 
 <br />
</div>
<div class="panel_bottom">
  &nbsp; 
</div>",
        "languageList": {
            "0": "G++",
            "1": "GCC",
            "2": "C++",
            "3": "C",
            "4": "Pascal",
            "5": "Java",
            "6": "C#"
        },
        "memoryLimit": 32768,
        "output": "<div class="panel_content">
  For each case, output 
 <i>A + B</i> in one line. 
 <br />
</div>
<div class="panel_bottom">
  &nbsp; 
</div>",
        "sampleInput": "<div class="panel_content"><pre><div style="font-family:Courier New,Courier,monospace;"> 1 1 </div></pre></div><div class="panel_bottom">
       &nbsp;
      </div>",
        "sampleOutput": "<div class="panel_content"><pre><div style="font-family:Courier New,Courier,monospace;"> 2 </div></pre></div><div class="panel_bottom">
       &nbsp;
      </div></div></div>",
        "source": "",
        "timeLimit": 1,
        "title": "A + B Problem"
    },
    "code": 100,
    "message": "抓取对象正在更新..."
}

返回码

code message 备注说明
0 抓取成功
100 抓取对象正在更新...
200 抓取对象不完整 失败返回码


提交账号API

接口定义

http://localhost:8080/vjudge/user/submitAccount.action

输入参数

参数名 类型 示例值 描述
username String 用户名
password String 用户密码

返回示例

{
    "code": 0,
    "message": "success"
}

返回码

code message 备注说明
0 success
200 Username not exists! 失败返回码


提交解答API

接口定义

http://localhost:8080/vjudge/problem/submitSolution.action

输入参数

参数名 类型 示例值 描述
id int 1 题目编号
language String 2 语言编号
source String base64编制代码

返回示例

{
    "data": {
        "taskId": 32
    },
    "code": 0,
    "message": "Submitting in process..."
}

返回码

code message 备注说明
0 Submitting in process...
101 Please login first!
200 No such a language! 失败返回码


查询状态API

接口定义

http://localhost:8080/vjudge/problem/queryStatus.action?id=${id}

输入参数

参数名 类型 示例值 描述
id int 32 taskId

返回示例

{
    "data": {
        "memory": 1712,
        "status": "AC",
        "time": 15
    },
    "code": 0,
    "message": "Success"
}

返回码

code message 备注说明
0 Success
200 The query doesn't exist 失败返回码


原文地址:https://www.cnblogs.com/zzzz76/p/13432529.html