出错返回非正常的httpcode,错误信息为:
{
errorCode:[int],
message:[string]
}
api中所有url放在${host}/api/
域名下。并包含如下cookie:
{
languange:'zh'|'en',
token:'xxx',
}
@Get user/login
@Query {userId,password,remember}
@Return {
userId: [string] 用户名,
nickname:昵称,
signature:用户签名,
avatarUrl:头像地址,
classname:班级,
email:邮箱
}
@Post user/register
@Body {
userId:用户名,
nickname:昵称,
signature:用户签名,
classname:班级,
email:邮箱,
avatar: [file] 上传图片
}
@Return {
userId:[string] 用户名
}
@Put account/logout
@Return {}
@Get users
@Query {
userId:[...],
classname:[...],
...
size,
page
}
@Return [{
rank: [int] 排第几名,
userId:用户名,
nickname:昵称,
signature,
classname,
static:{
ac:[int] AC题数
submit:[int] 提交数
}
}]
@Get users/:userId
@Return {
nickname,
email,
signature,
avatarUrl,
classname,
solved:[{problemId}] //ac的题目列表
}
@Get problems
@Query {
size,
page,
...其他过滤参数,eg:
title:'A+B',
problemId:[1,2,3]
}
@Return {
total:1,与请求参数size对应的总页数
list:[{
problemId,
title,
tags:['Math','Dp'...]//题目标签
difficulty,//难易度
static:{
ac:[int] AC题数
submit:[int] 提交数
}
date // 更新时间
}]
}
@Get problems/:problemId
@Return {
title,
tags:[...],
difficulty,
timelimit:{java,others},
memorylimit:{java, others}
description,
input,
output,
sampleInput,
sampleOutput,
hint,
source,
static:{
ac:[int] AC题数
submit:[int] 提交数
}
}
###添加题目
@Post problems
@Body {
title,
difficulty,
timelimit:{java,others},
memorylimit:{java, others}
description,
input,
output,
sampleInput,
sampleOutput,
hint,
source,
files, //测试数据文件
specialTest //special judge程序
show:true|false //是否在练习列表里面显示
contestId:null, //将该题添加到contestId的竞赛中
tags:[...]
}
@Return {
problemId
}
@Put problems/:problemId
@Body{
//同添加题目
}
@Return {}
@Get languages
@Return [{
languangeId,
name
}]
@Post problems/:problemId/submit
@Body {
languangeId:''//语言
code
}
@Return {
submissionId //提交Id
}
@Put problems/:problemId/rejudge
@Return {}
@Delete problems/:problemId
@Return {}
@Get submissions
@Query {size,page,problemId,userId,verdictId...一些过滤参数}
@Return [{
userId,
problemId,
verdictId,//评测结果
time,
memory,
languageId,//使用的编译语言
length,
submitTime,
compileError:'xxxx' //编译错误详情
accessible:[true|false] //当前用户是否可以访问该提交的源代码
}]
@Get submissions/:submission
@Return {
userId,
problemId,
verdictId,//评测结果
time,
memory,
languageId,//使用的编译语言
length,
submitTime,
code,
compileError:'xxxx' //编译错误详情
accessible:[true|false] //当前用户是否可以访问该提交的源代码
}
@Put submissions/:submissionId/rejudge
@Get contests
@Query {size,page,title,statusId}
@Return {
contestId,
title,
startTime,
endTime,
statusId,//0-未开始,1-正在进行,2-已完成
attendsCount,//参赛人数
}
@Get contests/:contestId
@Return {
title,
startTime,
endTime,
statusId,
attendsCount,//参赛人数
host:{ 举办人
userId,
nickname
}
}
@Get contests/:contetId/problems
@Return [{
problemOrder,
title,
static:static:{ac,submit}
}]
@Get contests/:contestId/standing
@Query {
size,
page,
...其他过滤参数
}
@Return [
{
rank:[int] 排名,
userId,
solved,
time,
nickname,
status:{
problemOrder1:{
time,
penalty
},
problemOrder2:{
time,
penalty
}
...
}
}
]
@Get contests/:contestId/problems/:problemOrder
@Return {
problemId, //返回一个problemId方法以便调用problems/:problemId/submit方法提交代码
title,
timelimit:{ java, others},
memorylimit:{java,others}
description,
input,
output,
source,
static:{ac,submit}
}
@Get contests/:contestId/languages
@Return [{
languangeId,
name
}]
@Get contests/:contestId/submissions
@Query {size,page,...其他过滤参数}
@Return [{
userId,
problemOrder,
verdictId,//评测状态
languageId,
time,
memory,
accessible:[true}false],
compiler,//使用的编译语言
length,
submitTime,
compileError:'xxxx' //编译错误详情
}]
@Post contests
@Body{
hostId,//创建人
title,
startTime,
endTime,
password,//密码
attendId:[{userId}]//参加的人
}
@Put contests/:contestId
@Body {
//同添加竞赛
}
@Delete contests/:contestId
@Return {}
@Get discuss
@Query {size,page,...其他过滤参数}
@Return [{
title,
author:{
userId,
nickname,
avatarUrl,
classname
}
reply:[int]回复数
}]
@Post discuss
@Body {
title,
content,
userId
}
@Return {dicussId}
@Delete discuss/:discussId
@Return {}
@Get discuss/:discussId
@Query{
size,
page,
...其他过滤参数
}
@Return [{
index:[int]帖子索引,
title,
content,
reply:0[int]要回复帖子的索引
author:{
userId,
nickname,
avatarUrl,
classname
}
}]
@Post discuss/:discussId
@Body{
userId,
title,
content,
reply:0
}
@Return {
index:[int]帖子索引,
title,
content,
reply:[int]要回复帖子的索引
author:{
userId,
nickname,
avatarUrl,
classname
}
}
###删除回复
@Delete discuss/:discussId/:index
@Return {}
##Todos
- 多语言支持
- 用户批量导入