码学堂商户接入指南
1. 概述与接入流程
2. 题目加载接口指南
3. 提交判题接口指南
4. 测评结果查询接口指南
5. 知识点加载接口指南
6. 知识点管理接口指南
7. 题目管理接口指南
选项格式说明
编程语言对应说明
8. 编程题、函数题、程序填空题批量上传测试数据集
9. 商户授权说明
-
+
home page
4. 测评结果查询接口指南
## 4.1 概述 码学堂提供了所有题型(除主观题)的判题结果查询接口服务。 ## 4.2 请求地址及方式 请求地址:`https://mp.api.maxuetang.cn/result` 请求方式:`POST` ## 4.3 查询请求参数说明 | 序号 | 参数 | 名称 | 是否必须提供 |描述 | | :----: | :----: | :----: | :----: |:---- | | 01 | merchant_id | 商户号 | 是 | | | 02 | ptype | 题目类型 | 是| {1,2,3,...,8},1:判断题、2:单项选择题、3:多项选择题、4:填空题、5:程序函数题、6:程序填空题、7:编程题、8:主观题| | 03 | sign | 签名 | 是 | SHA256签名 | | 04 | pid | 题目ID | 是 | 整型,指定时仅返回当前题目 | | 05 | solve_id | 提交ID | 是 | 长整型| | 06 |timestamp|时间戳|否|长整型数| ## 4.4 返回结果 ### 4.4.1 返回结果参数说明 | 序号 | 参数 | 名称 | 描述 | | :---- | :----: | :----: |:---- | |01|success|成功标识|true 或 false | |02|msg|消息|返回执行消息| |03|data|数据|返回数据对象| |04|ans|学生答案|JSON字符串,具体格式详见各题型判题结果查询返回示例| |05|pid|题目ID|题目号| |06|ptype|题目类型| | |07|solve_id|提交ID|| |08|result|判题结果代码|详见判题结果代码表| |09|score|得分| | |10|score_json|测试数据得分|编程题、函数题时返回| |10|time|时间戳| 时间戳 | ### 4.4.2 判题结果代码表 | 返回代码 | 描述 | | :----: | :----: | |0|未判| |1|待重判| 2|正在编译| 3|正在判题中| 4|答案正确| 5|输出格式错误| 6|答案错误| 7|运行超时| 8|内存超限| 9|输出超限| 10|运行错误| 11|编译错误| 12|编译成功| 20|部分正确| ## 4.5 JAVA接入示例 ```java package com.mxt.problem.load; import java.util.Map; import java.util.TreeMap; import com.mxt.config.MxtApiConfig; import com.mxt.sign.SignHelper; import cn.hutool.http.HttpUtil; import cn.hutool.json.JSONObject; public class ProblemResult { public static JSONObject resultProblem(int pid, int ptype, long solve_id) { Map params = new TreeMap(); params.put("merchant_id", MxtApiConfig.MERCHANT_ID ); params.put("ptype" , ptype ); params.put("pid" , pid ); params.put("timestamp" , System.currentTimeMillis() ); params.put("solve_id" , solve_id ); params.put("sign" , SignHelper.sign(params, MxtApiConfig.MERCHANT_KEY)); return new JSONObject(HttpUtil.post(MxtApiConfig.PROBLEM_RESULT_API, params)); } } ``` ## 4.6 各题型判题结果查询返回示例 ### 4.6.1 判断题判题结果查询返回示例 ```json { "success": true, "msg": "", "data": { "result": "6", "score": "0", "ans": { "0": "0",//未选择“错” "1": "1" //选择了“对” }, "pid": "8537", "ptype": "1", "time": "20220407111126", "solve_id": "40821001403244737" } } ``` ### 4.6.2 选择题判题结果查询返回示例 单项选择题与多项选择题返回格式一致。 ```json { "success": true, "msg": "", "data": { "result": "6", "score": "1.9", "ans": { "A": "0",//未选择A "B": "0",//未选择B "C": "0",//未选择C "D": "1" //选择了D }, "pid": "9175", "ptype": "2", "merchant_id": "88", "time": "20220407112728", "solve_id": "51658414959285203" } } ``` ### 4.6.3 填空题判题结果查询返回示例 ```json { "success": true, "msg": "", "data": { "result": "20", "score": "3", "ans": { "1": { //第1个空 "result": "4", "score": "3", "ans": "答案一" //学生答案 }, "2": { //第2个空 "result": "6", "score": "0", "ans": "答案" //学生答案 } }, "pid": "9198", "ptype": "4", "merchant_id": "88", "time": "20220407113455", "solve_id": "66018434417440337" } } ``` ### 4.6.4 程序填空题判题结果查询返回示例 ```json { "success": true, "msg": "", "data": { "result": "20", "score": "10", "ans": { "1": { //第1个空 "result": "11", "score": "0", "ans": "" //学生答案 }, "2": { //第2个空 "result": "4", "score": "5", "ans": "a, mid+1, high, k" //学生答案 }, "3": { //第3个空 "result": "4", "score": "5", "ans": "-1" //学生答案 }, "length": "3", "language": "c" }, "pid": "7789", "ptype": "5", "merchant_id": "88", "time": "20220407104020", "solve_id": "23157510715543360" } } ``` ### 4.6.5 函数题判题结果查询返回示例 ```json { "success": true, "msg": "", "data": { "result": "4", "score": "10", "score_json": {//各测试数据得分情况 "0": { "result": "4", "score": "4", "memory": "1120", "time": "0", "desc": "my" }, "test": { "result": "4", "score": "4", "memory": "1120", "time": "1", "desc": "test" }, "sample": { "result": "4", "score": "2", "memory": "1120", "time": "0", "desc": "sample" } }, "pid": "1412", "ptype": "6", "merchant_id": "88", "time": "20220407172430", "solve_id": "655432" } } ``` ### 4.6.6 编程题判题结果查询返回示例 ```json { "success": true, "msg": "", "data": { "result": "4", "score": "15", "score_json": {//各测试数据得分情况 "0": { "result": "4", "score": "3", "memory": "2412", "time": "0", "desc": "fjz1" }, "1": { "result": "4", "score": "3", "memory": "2412", "time": "0", "desc": "fjz3" }, "2": { "result": "4", "score": "3", "memory": "2412", "time": "0", "desc": "fjz4" }, "3": { "result": "4", "score": "3", "memory": "2412", "time": "0", "desc": "fjz5" }, "test": { "result": "4", "score": "3", "memory": "2412", "time": "0", "desc": "test" } }, "pid": "1008", "ptype": "7", "merchant_id": "88", "time": "20220407181855", "solve_id": "655435" } } ``` ### 4.6.7 主观题判题结果查询返回示例 主观题提交后,仅作存储,不支持主观题自动判题,查询时仅返回存储信息。 ```json { "success": true, "msg": "", "data": { "result": "0", "score": "0", "ans": { "ans": "答案" }, "pid": "8543", "ptype": "8", "merchant_id": "88", "time": "20220407182714", "solve_id": "32433312104014822" } } ```
码学堂管理员
April 9, 2022, 10:33 a.m.
Share documents
Collection documents
Last
Next
Scan wechat
Copy link
Scan your mobile phone to share
Copy link
关于 MrDoc
觅思文档MrDoc
是
州的先生
开发并开源的在线文档系统,其适合作为个人和小型团队的云笔记、文档和知识库管理工具。
如果觅思文档给你或你的团队带来了帮助,欢迎对作者进行一些打赏捐助,这将有力支持作者持续投入精力更新和维护觅思文档,感谢你的捐助!
>>>捐助鸣谢列表
微信
支付宝
QQ
PayPal
Markdown文件
share
link
type
password
Update password