API¶
公共响应¶
一些错误是所有接口都可能会返回的。具体如下:
404 Not Found
{
"code": 1000,
"message": "NOT_FOUND",
"data": {}
}
包括请求体非 json 字符串和缺少必要参数
400 Bad Request
{
"code": 1005,
"message": "invalid request",
"data": {}
}
401 Unauthorized
{
"code": 1001,
"message": "not_logged_in",
"data": {}
}
数据库连接错误等外部错误
500 Internal Server Error
{
"code": 1002,
"message": "external error",
"data": {}
}
500 Internal Server Error
{
"code": 1003,
"message": "internal error",
"data": {}
}
400 Bad Request
{
"code": 1006,
"message": "no permission",
"data": {}
}
400 Bad Request
{
"code": 1007,
"message": "user is banned",
"data": {}
}
通用请求¶
GET /get_csrf_token¶
无
生成一个 csrf token 并发送给前端,以方便前端进行 POST 等请求
- 成功
200 OK
{
"code": 0,
"msg": "Succeed",
"data": {
"csrf_token": "string"
}
}
data 各字段含义如下:
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|---|---|---|---|---|---|
| csrf_token | string | true | none | csrf token |
无
用户相关¶
POST /user/register¶
注册
请求附带 JSON 格式的正文。
样例:
{
"user_name": "string",
"password": "string",
"user_type": "demand",
"invite_code": "string",
"email": "string",
"verifycode": "string"
}
正文的 JSON 包含一个字典,字典的各字段含义如下:
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| user_name | body | string | 是 | 用户名 | 用户名须为长度在4~24的字符串 |
| password | body | string | 是 | 密码 | 密码须为长度在6~20的字符串 |
| user_type | body | string | 是 | 用户类型 | demand表示需求方,tag表示标注方,admin表示管理员,agent表示中介 |
| invite_code | body | string¦null | 否 | 邀请码 | |
| body | string | 是 | 电子邮箱 | 前端已经验证过格式 | |
| verifycode | body | string | 是 | 验证码 |
将待注册的用户名和密码作为请求体,后端首先比对是否有重复的用户名,再验证用户名和密码的合法性。
若均合法,则判断邀请码是否为空,若不为空则查询该邀请码,若存在则给邀请方奖励积分,否则返回错误响应;若邀请码为空则跳过这步。
最后将加密后的密码、用户名以及生成的不重复邀请码和不重复银行账户一起存储。
- 成功
200 OK
{
"code": 0,
"message": "succeed",
"data": {
"user_id": 0,
"user_name": "string",
"invite_code": "string"
}
}
data 各字段含义如下:
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|---|---|---|---|---|---|
| user_id | integer | true | none | 用户id | |
| user_name | string | true | none | 用户名 | |
| invite_code | string | true | none | 邀请码 |
- 用户名已存在
400 Bad Request
{
"code": 1,
"message": "existing username",
"data": {}
}
- 用户名格式有误
400 Bad Request
{
"code": 2,
"message": "username format error",
"data": {}
}
- 密码格式有误
400 Bad Request
{
"code": 3,
"message": "password format error",
"data": {}
}
- 邀请码错误
400 Bad Request
{
"code": 92,
"message": "wrong invite code",
"data": {}
}
- 邮箱已被绑定
400 Bad Request
{
"code": 41,
"message": "email already bound",
"data": {}
}
- 验证码已失效
400 Bad Request
{
"code": 45,
"message": "email verify code expired",
"data": {}
}
- 验证码错误
400 Bad Request
{
"code": 46,
"message": "wrong email verify code",
"data": {}
}
- 注册管理员未填写邀请码
400 Bad Request
{
"code": 80,
"message": "need invite code of admin",
"data": {}
}
POST /user/login¶
登陆
请求附带 JSON 格式的正文。
样例:
{
"user_name": "string",
"password": "string"
}
正文的 JSON 包含一个字典,字典的各字段含义如下:
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| user_name | body | string | 是 | 用户名 | |
| password | body | string | 是 | 密码 |
后端接受请求后,验证用户是否存在,若是则验证密码的加密与存储的加密密码是否匹配。
若两次验证都通过则返回成功响应,并设置cookie(加入token,后端将token与用户关联后存入数据库),否则返回用户名或密码错误
(用户登录后每次后端收到请求时,需要先检查cookie中是否存在token,以及token是否存在数据库中)
- 成功
200 OK
{
"code": 0,
"message": "succeed",
"data": {
"user_id": 0,
"user_name": "string",
"user_type": "demand"
}
}
data 各字段含义如下:
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|---|---|---|---|---|---|
| user_id | integer | true | none | 用户id | |
| user_name | string | true | none | 用户名 | |
| user_type | string | true | none | 用户类型 |
- 用户名或密码错误
400 Bad Request
{
"code": 4,
"message": "wrong username or password",
"data": {}
}
POST /user/modifypassword¶
通过原密码修改密码
请求附带 JSON 格式的正文。
样例:
{
"old_password": "string",
"new_password": "string"
}
正文的 JSON 包含一个字典,字典的各字段含义如下:
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| old_password | body | string | 是 | 旧密码 | |
| new_password | body | string | 是 | 新密码 |
后端检查请求中是否有token以及token是否存在数据库中,然后解析出password,验证old_password加密后与password是否一致。
若一致则修改密码,否则报错
- 成功
200 OK
{
"code": 0,
"message": "succeed",
"data": {}
}
- 原密码错误
400 Bad Request
{
"code": 4,
"message": "wrong password",
"data": {}
}
- 新密码不合法
400 Bad Request
{
"code": 3,
"message": "password format error",
"data": {}
}
GET /user/userinfo/{id}¶
获取用户信息
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| id | path | integer | 是 | 用户 id | none |
后端收到请求后,根据cookie获取token,通过token获取用户信息。
前端注意使用会员功能时需要更新当前用户是否为会员,会员等级,会员成长值等相关状态
- 成功
200 OK
{
"code": 0,
"message": "succeed",
"data": {
"user_id": 0,
"user_name": "string",
"user_type": "demand",
"score": 0,
"membership_level": 0,
"invite_code": "string",
"credit_score": 0,
"bank_account": "string",
"account_balance": 0,
"grow_value": 0,
"vip_expire_time": 0,
"is_checked": true,
"is_banned": true,
"email": "string",
"tag_score": 0
}
}
data 各字段含义如下:
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|---|---|---|---|---|---|
| user_id | integer | true | none | 用户 id | none |
| user_name | string | true | none | 用户名 | none |
| user_type | string | true | none | 用户类型 | demand表示需求方,tag表示标注方,admin表示管理员,intermediary表示中介 |
| score | integer | true | none | 积分 | 仅当请求自己的用户数据时返回 |
| membership_level | integer | true | none | 会员等级 | 0表示非会员,1表示白银,2表示黄金,3表示钻石 |
| invite_code | string | true | none | 邀请码 | 仅当请求自己的用户数据时返回 |
| credit_score | integer | true | none | 信誉分 | none |
| bank_account | string | true | none | 银行账户 | 仅当请求自己的用户数据时返回 |
| account_balance | integer | true | none | 银行卡余额 | 仅当请求自己的用户数据时返回 |
| grow_value | integer | true | none | 会员成长值 | none |
| vip_expire_time | number | true | none | 会员到期时间 | 仅当请求自己的用户数据时返回 |
| is_checked | boolean | true | none | 审核通过 | none |
| is_banned | boolean | true | none | 被封禁 | none |
| string | true | none | 用户邮箱 | 仅当请求自己的用户数据时返回 | |
| tag_score | integer | true | none | 标注获得的积分 |
- 请求的用户不存在
404 Not Found
{
"code": 8,
"message": "user does not exist",
"data": {}
}
POST /user/logout¶
退出登录
无
后端检查请求中是否有token以及token是否存在数据库中,若通过验证则清除cookie,并在数据库中删除token
- 成功
200 OK
{
"code": 0,
"message": "succeed",
"data": {}
}
无
POST /user/recharge¶
充值
请求附带 JSON 格式的正文。
样例:
{
"amount": 0
}
正文的 JSON 包含一个字典,字典的各字段含义如下:
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| amount | body | integer | 是 | 充值金额 | none |
后端检查请求中是否有token以及token是否存在数据库中
通过验证则判断充值金额是否是一个整数,若是则账户余额是否足够,若不够则返回错误响应,否则正常修改账户余额和积分(¥1 == 10 scores)。
若用户开通会员,则根据充值的金额数目增加相应的会员成长值。
- 成功
200 OK
{
"code": 0,
"message": "succeed",
"data": {}
}
- 余额不足
400 Bad Request
{
"code": 5,
"message": "balance not enough",
"data": {}
}
- 未绑定银行卡
400 Bad Request
{
"code": 37,
"message": "no bank card"
}
POST /user/withdraw¶
提现
请求附带 JSON 格式的正文。
样例:
{
"amount": 0
}
正文的 JSON 包含一个字典,字典的各字段含义如下:
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| amount | body | integer | 是 | 提现金额 | none |
后端检查请求中是否有token以及token是否存在数据库中,通过验证则判断提现金额是否是一个整数
若是则判断积分是否足够,若不够则返回错误响应,否则正常修改账户余额和积分(¥1 == 10 scores)
- 成功
200 OK
{
"code": 0,
"message": "succeed",
"data": {}
}
- 积分不足
400 Bad Request
{
"code": 5,
"message": "score not enough",
"data": {}
}
- 未绑定银行卡
400 Bad Request
{
"code": 37,
"message": "no bank card"
}
POST /user/modifybankaccount¶
修改银行账户
请求附带 JSON 格式的正文。
样例:
{
"bank_account": "string"
}
正文的 JSON 包含一个字典,字典的各字段含义如下:
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| bank_account | body | string | 是 | 银行卡号 | none |
若存在相应银行卡则直接绑定,否则创建一张并随机赋予一定的余额。
- 成功
200 OK
{
"code": 0,
"message": "succeed",
"data": {}
}
无
POST /user/get_verifycode¶
获取验证码
请求附带 JSON 格式的正文。
样例:
{
"email": "string"
}
正文的 JSON 包含一个字典,字典的各字段含义如下:
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| body | string | 是 | 邮箱 | none |
向该邮箱发送一个验证码
- 成功
200 OK
{
"code": 0,
"message": "string",
"data": {}
}
- 验证码发送失败
400 Bad Request
{
"code": 40,
"message": "string",
"data": {}
}
- 邮箱已被绑定
400 Bad Request
{
"code": 41,
"message": "string",
"data": {}
}
POST /user/change_email¶
邮箱换绑
请求附带 JSON 格式的正文。
样例:
{
"newemail": "string",
"verifycode": "string"
}
正文的 JSON 包含一个字典,字典的各字段含义如下:
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| newemail | body | string | 是 | 新邮箱 | none |
| verifycode | body | string | 是 | 验证码 | none |
更改用户绑定的邮箱,验证发送验证码的正确性
- 成功
200 OK
{
"code": 0,
"message": "string",
"data": {}
}
- 邮箱未请求验证码或邮箱不存在
400 Bad Request
{
"code": 40,
"message": "send verify code failed",
"data": {}
}
- 邮箱已被绑定
400 Bad Request
{
"code": 41,
"message": "email already bound",
"data": {}
}
- 验证码错误
400 Bad Request
{
"code": 46,
"message": "wrong email verify code",
"data": {}
}
- 验证码失效
400 Bad Request
{
"code": 45,
"message": "email verify code expired",
"data": {}
}
POST /user/modifypassword_by_email¶
通过邮箱修改密码
请求附带 JSON 格式的正文。
样例:
{
"verifycode": "string",
"new_password": "string"
}
正文的 JSON 包含一个字典,字典的各字段含义如下:
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| verifycode | body | string | 是 | 邮箱验证码 | none |
| new_password | body | string | 是 | 新密码 | none |
检查验证码的正确性,并修改密码
- 成功
200 OK
{
"code": 0,
"message": "string",
"data": {}
}
- 原密码错误
400 Bad Request
{
"code": 4,
"message": "wrong password",
"data": {}
}
- 新密码不合法
400 Bad Request
{
"code": 3,
"message": "password format error",
"data": {}
}
POST /user/verifycode_current_email¶
用当前绑定的邮箱获取验证码
无
向发起请求的用户绑定的邮箱发送验证码
- 成功
200 OK
{
"code": 0,
"message": "string",
"data": {}
}
- 发送验证码失败
400 Bad Request
{
"code": 40,
"message": "send verify code failed"
}
400 Bad Request
{
"code": 32,
"message": "no email bound"
}
POST /user/reset_invite_code¶
刷新邀请码
无
为发起请求的用户重新生成一个邀请码
- 成功
200 OK
{
"code": 0,
"message": "string",
"data": {}
}
无
POST /user/getvip¶
开通会员
请求附带 JSON 格式的正文。
样例:
{
"package_type": "month"
}
正文的 JSON 包含一个字典,字典的各字段含义如下:
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| package_type | body | string | 是 | 套餐种类 | month代表包月,season代表包季,year代表包年 |
后端检查请求中是否有token以及token是否存在数据库中,若通过则检查当前是否已经是会员,若否则检查积分是否足够,不够则返回错误响应,充足则扣除相应积分(包月扣除100,包季250,包年扣除600)。若当前已经是会员,则延长会员时间
- 成功
200 OK
{
"code": 0,
"message": "string",
"data": {}
}
- 当前已经是会员
400 Bad Request
{
"code": 6,
"message": "already vip",
"data": {}
}
400 Bad Request
{
"code": 5,
"message": "score not enough",
"data": {}
}
POST /user/ban_user/{user_id}¶
封禁违规用户
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| user_id | path | string | 是 | 用户 id | none |
封禁指定用户,检查发起请求的用户是否是管理员
- 成功
200 OK
{
"code": 0,
"message": "succeed",
"data": {}
}
- 无权限
400 Bad Request
{
"code": 19,
"message": "no permission",
"data": {}
}
GET /user/get_all_users¶
获取所有用户信息
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| type | query | string | 否 | 获取用户类型 | all:全部用户;tag:只返回标注方 |
获取用户列表,管理员可以获取所有用户,中介只能获取标注方列表
- 成功
200 OK
{
"code": 0,
"message": "succeed",
"data": [
{
"user_id": 0,
"user_name": "string",
"score": 0,
"membership_level": 0,
"credit_score": 100,
"vip_expire_time": 0.1,
"is_checked": true,
"is_banned": true,
"user_type": "demand"
}
]
}
data 各字段含义如下:
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|---|---|---|---|---|---|
| user_id | integer | true | none | 用户id | |
| user_name | string | true | none | 用户名 | |
| score | integer | true | none | 积分 | |
| membership_level | integer | true | none | 会员等级 | 0表示非会员,1表示白银,2表示黄金,3表示钻石 |
| credit_score | integer | true | none | 信用分 | (恶意行为会扣除) |
| vip_expire_time | number | true | none | 会员到期时间戳 | 小于当前时间戳则为非会员 |
| is_checked | boolean | true | none | 需求方是否被审核通过 | |
| is_banned | boolean | true | none | 用户是否被违规封禁 | |
| user_type | string | true | none | 用户类型 |
无
POST /user/check_user/{user_id}¶
审核用户成为需求方
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| user_id | path | string | 是 | 用户 id | none |
通过用户user_id的需求方审核需求
- 成功
200 OK
{
"code": 0,
"message": "string",
"data": "string"
}
无
GET /user/get_agent_list¶
获取中介列表
无
获取可以委托任务的中介列表,由需求方请求
- 成功
200 OK
{
"code": "0",
"message": "success",
"data": {
"agent_list": [
{
"user_id": 0,
"user_name": "string",
"user_type": "advertiser",
"membership_level": 0,
"credit_score": 100,
"grow_value": 0,
"is_checked": true,
"is_banned": true,
"email": {
"email": "string",
"email_valid": "string",
"email_valid_expire": 0
},
"tag_score": 0,
"face_base64": "string"
}
]
}
}
data 各字段含义如下:
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|---|---|---|---|---|---|
| agent_list | [object] | true | none | 中介id的列表 | none |
| user_id | integer | true | none | 用户id | 主键 |
| user_name | string | true | none | 用户名 | |
| user_type | string | true | none | 用户类型 | demand表示需求方,tag表示标注方,admin表示管理员,agent表示中介 |
| membership_level | integer | true | none | 会员等级 | 0表示非会员,1表示白银,2表示黄金,3表示钻石 |
| credit_score | integer | true | none | 信用分 | (恶意行为会扣除) |
| grow_value | integer | true | none | 会员成长值 | 充值、发布任务、完成标注均可积累成长值。成长值达到100时会员升级至黄金,达到1000时升级至钻石。充值增加的成长值与增加的积分相同,发布方每次发布任务、标注方每次完成标注均增加10点成长值 |
| is_checked | boolean | true | none | 需求方是否被审核通过 | |
| is_banned | boolean | true | none | 用户是否被违规封禁 | |
| object | true | none | 用户邮箱 | ||
| tag_score | integer | true | none | 标注方标注获得的积分 |
无
POST /user/face_recognition¶
人脸识别
请求附带 JSON 格式的正文。
样例:
{
"image": "string"
}
正文的 JSON 包含一个字典,字典的各字段含义如下:
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| image | body | string | 是 | 人脸照片 | 人脸照片的base64格式 |
判断图片中是否含有人脸,如果有人脸且未绑定到用户则绑定该人脸到发起请求的用户。
- 成功
200 OK
{
"code": 0,
"message": "success"
}
- 未检测到人脸
401 Unauthorized
{
"code": 60,
"message": "face unrecognized",
"data": "string"
}
401 Unauthorized
{
"code": 63,
"message": "face registered"
}
POST /user/face_recognition_login¶
人脸识别登陆
请求附带 JSON 格式的正文。
样例:
{
"image": "string"
}
正文的 JSON 包含一个字典,字典的各字段含义如下:
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| image | body | string | 是 | 人脸照片 | 人脸照片的base64格式 |
查找与图片匹配的用户,并登录该用户。
- 成功
200 OK
{
"code": 0,
"message": "success",
"data": {
"user_name": "string",
"user_type": "string",
"user_id": "string"
}
}
data 各字段含义如下:
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|---|---|---|---|---|---|
| user_id | integer | true | none | 用户id | |
| user_name | string | true | none | 用户名 | |
| invite_code | string | true | none | 邀请码 |
- 未检测到人脸
401 Unauthorized
{
"code": 60,
"message": "face unrecognized",
"data": "string"
}
400 Bad Request
{
"code": 61,
"message": "face unmatched",
"data": "string"
}
POST /user/unban_user/{user_id}¶
取消封禁用户
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| user_id | path | string | 是 | 用户 id | none |
将该用户的状态设为未封禁
- 成功
200 OK
{
"code": 0,
"message": "string",
"data": {}
}
无
任务相关¶
POST /task/¶
创建任务
请求附带 JSON 格式的正文。
样例:
{
"task_type": "image",
"task_style": "string",
"reward_per_q": 0,
"time_limit_per_q": 0,
"total_time_limit": 0,
"distribute_user_num": 0,
"task_name": "string",
"accept_method": "manual",
"files": [
{
"filename": "string",
"tag": "string"
}
],
"tag_type": [
"string"
],
"stdans_tag": "string",
"strategy": "string",
"input_type": [
"string"
],
"cut_num": "string"
}
正文的 JSON 包含一个字典,字典的各字段含义如下:
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| id | path | string | 是 | none | |
| task_type | body | string | 是 | 任务类型 | none |
| task_style | body | string | 是 | 任务描述 | none |
| reward_per_q | body | integer | 是 | 单题奖励分数 | none |
| time_limit_per_q | body | integer | 是 | 单题时限 | none |
| total_time_limit | body | integer | 是 | 总时限 | none |
| distribute_user_num | body | integer | 是 | 分发用户数量 | none |
| task_name | body | string | 是 | 任务名 | none |
| accept_method | body | string | 是 | 验收方式 | none |
| files | body | [object] | 是 | 文件标识符列表 | none |
| filename | body | string | 是 | 上传的文件名 | none |
| tag | body | string | 是 | 唯一标识符 | none |
| tag_type | body | any | 否 | 标签类型 | none |
| input_type | body | string | 是 | 输入框题干 | none |
| tags | body | [string] | 是 | 选择题选项 | none |
| stdans_tag | body | string | 是 | 标准答案 | none |
| strategy | body | string | 是 | 分发策略 | toall表示自动接取,order表示顺序分发,smart表示智能分发 |
| input_type | body | [string] | 否 | 输入类型 | 用于“自定义任务模板”类型任务:用户可以自定义若干个输入框 |
| cut_num | body | string | 是 | 切分数 | 用于图片框选任务。指定将图片切成cut_num*cut_num张子图片 |
用户创建任务,检查是否是通过审核的需求方发起的请求
- 成功
200 OK
{
"code": 0,
"message": "succeed",
"data": {}
}
- 时限或奖励不合法
400 Bad Request
{
"code": 9,
"message": "time limit or reward score format error",
"data": {}
}
400 Bad Request
{
"code": 9,
"message": "time limit or reward score format error",
"data": {}
}
400 Bad Request
{
"code": 13,
"message": "task name format error",
"data": {}
}
PUT /task/{id}¶
修改任务
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| id | path | string | 是 | none |
请求附带 JSON 格式的正文。
样例:
{
"task_type": "image",
"task_style": "string",
"reward_per_q": 0,
"time_limit_per_q": 0,
"total_time_limit": 0,
"distribute_user_num": 0,
"task_name": "string",
"accept_method": "manual",
"files": [
{
"filename": "string",
"tag": "string"
}
],
"tag_type": [
"string"
],
"stdans_tag": "string",
"strategy": "string",
"input_type": [
"string"
],
"cut_num": "string"
}
正文的 JSON 包含一个字典,字典的各字段含义如下:
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| task_type | body | string | 是 | 任务类型 | none |
| task_style | body | string | 是 | 任务描述 | none |
| reward_per_q | body | integer | 是 | 单题奖励分数 | none |
| time_limit_per_q | body | integer | 是 | 单题时限 | none |
| total_time_limit | body | integer | 是 | 总时限 | none |
| distribute_user_num | body | integer | 是 | 分发用户数量 | none |
| task_name | body | string | 是 | 任务名 | none |
| accept_method | body | string | 是 | 验收方式 | none |
| files | body | [object] | 是 | 文件标识符列表 | none |
| filename | body | string | 是 | 上传的文件名 | none |
| tag | body | string | 是 | 唯一标识符 | none |
| tag_type | body | any | 否 | 标签类型 | none |
| input_type | body | string | 是 | none | |
| tags | body | [string] | 是 | none | |
| stdans_tag | body | string | 是 | none | |
| strategy | body | string | 是 | 分发策略 | toall表示自动接取,order表示顺序分发,smart表示智能分发 |
| input_type | body | [string] | 否 | 输入类型 | 用于“自定义任务模板”类型任务:用户可以自定义若干个输入框 |
| cut_num | body | string | 是 | 切分数 | 用于图片框选任务。指定将图片切成cut_num*cut_num张子图片 |
修改用户,检查是否是通过审核的需求方发起的请求修改自己发布的任务
- 成功
200 OK
{
"code": 0,
"message": "succeed",
"data": {}
}
- 时限或奖励不合法
400 Bad Request
{
"code": 9,
"message": "time limit or reward score format error",
"data": {}
}
400 Bad Request
{
"code": 10,
"message": "score not enough",
"data": {}
}
404 Not Found
{
"code": 11,
"message": "task does not exist",
"data": {}
}
400 Bad Request
{
"code": 12,
"message": "no permission to modify",
"data": {}
}
400 Bad Request
{
"code": 13,
"message": "task name format error",
"data": {}
}
DELETE /task/{id}¶
删除任务
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| id | path | integer | 是 | 任务 id | none |
管理员删除任务,或任务发布者删除自己发布的任务
- 成功
200 OK
{
"code": 0,
"message": "succeed",
"data": {}
}
- 请求的任务不存在
404 Not Found
{
"code": 11,
"message": "task does not exist",
"data": {}
}
400 Bad Request
{
"code": 12,
"message": "no permission to delete",
"data": {}
}
400 Bad Request
{
"code": 22,
"message": "task has been distributed",
"data": {}
}
GET /task/get_my_tasks¶
获取当前用户发布或分配的任务列表
无
后端根据当前用户类型,若为需求方,则返回发布的任务;若为标注方,则返回被分配到的任务;若为管理员,则返回错误响应;若为中介,返回被委托的任务
- 成功
200 OK
{
"code": 0,
"message": "succeed",
"data": [
{
"task_type": "string",
"task_style": "string",
"reward_per_q": 0,
"time_limit_per_q": 0,
"total_time_limit": 0,
"publisher": {
"user_id": 0,
"user_name": "string",
"password": "string",
"user_type": "advertiser",
"score": 0,
"membership_level": 0,
"invite_code": "string",
"credit_score": 100,
"bank_account": {
"card_id": "string",
"card_balance": "string"
},
"grow_value": 0,
"vip_expire_time": 0.1,
"is_checked": true,
"is_banned": true,
"email": {
"email": "string",
"email_valid": "string",
"email_valid_expire": 0
},
"tag_score": 0,
"face_base64": "string"
},
"task_id": 0,
"distribute_user_num": 0,
"q_num": 0,
"task_name": "string",
"current_tag_user_list": [
{
"tag_user": {
"user_id": null,
"user_name": null,
"password": null,
"user_type": null,
"score": null,
"membership_level": null,
"invite_code": null,
"credit_score": null,
"bank_account": null,
"grow_value": null,
"vip_expire_time": null,
"is_checked": null,
"is_banned": null,
"email": null,
"tag_score": null,
"face_base64": null
},
"accepted_at": 0
}
],
"past_tag_user_list": [
{
"user_id": 0,
"user_name": "string",
"password": "string",
"user_type": "advertiser",
"score": 0,
"membership_level": 0,
"invite_code": "string",
"credit_score": 100,
"bank_account": {
"card_id": null,
"card_balance": null
},
"grow_value": 0,
"vip_expire_time": 0.1,
"is_checked": true,
"is_banned": true,
"email": {
"email": null,
"email_valid": null,
"email_valid_expire": null
},
"tag_score": 0,
"face_base64": "string"
}
],
"progress": [
{
"tag_user": {
"user_id": null,
"user_name": null,
"password": null,
"user_type": null,
"score": null,
"membership_level": null,
"invite_code": null,
"credit_score": null,
"bank_account": null,
"grow_value": null,
"vip_expire_time": null,
"is_checked": null,
"is_banned": null,
"email": null,
"tag_score": null,
"face_base64": null
},
"q_id": 0
}
],
"result_type": "string",
"accept_method": "auto",
"state": "not_handle"
}
]
}
data 各字段含义如下:
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|---|---|---|---|---|---|
| task_type | string | true | none | 任务类型 | none |
| task_style | string | true | none | 任务样式 | (待定)对任务的描述 |
| reward_per_q | integer | true | none | 单题奖励分数 | none |
| time_limit_per_q | integer | true | none | 单题时限 | none |
| total_time_limit | integer | true | none | 总时限 | none |
| publisher | User | true | none | 任务发布者 | none |
| user_id | integer | true | none | 用户id,主键 | |
| user_name | string | true | none | 用户名 | |
| user_type | string | true | none | demand表示需求方,tag表示标注方,admin表示管理员,agent表示中介 | |
| score | integer | true | none | 积分(标注所得奖励) | |
| membership_level | integer | true | none | 会员等级:0表示非会员,1表示白银,2表示黄金,3表示钻石 | |
| invite_code | string | true | none | 邀请码,8位字母和数字 | |
| credit_score | integer | true | none | 信用分(恶意行为会扣除) | |
| bank_account | object | true | none | 银行账户 | |
| card_id | string | true | none | 银行卡号 | |
| card_balance | string | true | none | 银行卡余额 | |
| grow_value | integer | true | none | 会员成长值 | 充值、发布任务、完成标注均可积累成长值。成长值达到100时会员升级至黄金,达到1000时升级至钻石。充值增加的成长值与增加的积分相同,发布方每次发布任务、标注方每次完成标注均增加10点成长值 |
| vip_expire_time | number | true | none | 会员到期时间戳 | 小于当前时间戳则为非会员 |
| is_checked | boolean | true | none | 需求方是否被审核通过 | |
| is_banned | boolean | true | none | 用户是否被违规封禁 | |
| object | true | none | 用户邮箱 | ||
| string | true | none | 用户邮箱 | ||
| email_valid | string | true | none | 用户邮箱验证码 | |
| email_valid_expire | number | true | none | 邮箱验证码过期时间 | |
| tag_score | integer | true | none | 标注方标注获得的积分 | |
| face_base64 | string | true | none | 用户面部图片的 base64 | |
| task_id | integer | true | none | 任务id | 主键,唯一标识 |
| distribute_user_num | integer | true | none | 设定分发用户数量 | none |
| q_num | integer | true | none | 题目的数量 | none |
| task_name | string | true | none | 任务名 | 长度在4-24之间的字符串 |
| current_tag_user_list | [object] | true | none | 当前被分发用户列表 | none |
| tag_user | User | true | none | 任务发布者 | none |
| user_id | integer | true | none | 用户id,主键 | |
| user_name | string | true | none | 用户名 | |
| password | string | true | none | 加密之后的密码 | |
| user_type | string | true | none | demand表示需求方,tag表示标注方,admin表示管理员,agent表示中介 | |
| score | integer | true | none | 积分(标注所得奖励) | |
| membership_level | integer | true | none | 会员等级:0表示非会员,1表示白银,2表示黄金,3表示钻石 | |
| invite_code | string | true | none | 邀请码,8位字母和数字 | |
| credit_score | integer | true | none | 信用分(恶意行为会扣除) | |
| bank_account | object | true | none | 银行账户 | |
| grow_value | integer | true | none | 会员成长值 | 充值、发布任务、完成标注均可积累成长值。成长值达到100时会员升级至黄金,达到1000时升级至钻石。充值增加的成长值与增加的积分相同,发布方每次发布任务、标注方每次完成标注均增加10点成长值 |
| vip_expire_time | number | true | none | 会员到期时间戳 | 小于当前时间戳则为非会员 |
| is_checked | boolean | true | none | 需求方是否被审核通过 | |
| is_banned | boolean | true | none | 用户是否被违规封禁 | |
| object | true | none | 用户邮箱 | ||
| tag_score | integer | true | none | 标注方标注获得的积分 | |
| face_base64 | string | true | none | 用户面部图片的 base64 | |
| accepted_at | number | true | none | 标注用户接受任务时间戳 | none |
| past_tag_user_list | [User] | true | none | 过去被分发到的用户列表 | 确保不重复分发 |
| 任务发布者 | User | false | none | 任务发布者 | none |
| user_id | integer | true | none | 用户id,主键 | |
| user_name | string | true | none | 用户名 | |
| password | string | true | none | 加密之后的密码 | |
| user_type | string | true | none | demand表示需求方,tag表示标注方,admin表示管理员,agent表示中介 | |
| score | integer | true | none | 积分(标注所得奖励) | |
| membership_level | integer | true | none | 会员等级:0表示非会员,1表示白银,2表示黄金,3表示钻石 | |
| invite_code | string | true | none | 邀请码,8位字母和数字 | |
| credit_score | integer | true | none | 信用分(恶意行为会扣除) | |
| bank_account | object | true | none | 银行账户 | |
| grow_value | integer | true | none | 会员成长值 | 充值、发布任务、完成标注均可积累成长值。成长值达到100时会员升级至黄金,达到1000时升级至钻石。充值增加的成长值与增加的积分相同,发布方每次发布任务、标注方每次完成标注均增加10点成长值 |
| vip_expire_time | number | true | none | 会员到期时间戳 | 小于当前时间戳则为非会员 |
| is_checked | boolean | true | none | 需求方是否被审核通过 | |
| is_banned | boolean | true | none | 用户是否被违规封禁 | |
| object | true | none | 用户邮箱 | ||
| tag_score | integer | true | none | 标注方标注获得的积分 | |
| face_base64 | string | true | none | 用户面部图片的 base64 | |
| progress | [object] | true | none | 用户标注进展 | 分发时即将相应的用户加入,进展为0 |
| tag_user | User | true | none | 任务发布者 | none |
| user_id | integer | true | none | 用户id,主键 | |
| user_name | string | true | none | 用户名 | |
| password | string | true | none | 加密之后的密码 | |
| user_type | string | true | none | demand表示需求方,tag表示标注方,admin表示管理员,agent表示中介 | |
| score | integer | true | none | 积分(标注所得奖励) | |
| membership_level | integer | true | none | 会员等级:0表示非会员,1表示白银,2表示黄金,3表示钻石 | |
| invite_code | string | true | none | 邀请码,8位字母和数字 | |
| credit_score | integer | true | none | 信用分(恶意行为会扣除) | |
| bank_account | object | true | none | 银行账户 | |
| grow_value | integer | true | none | 会员成长值 | 充值、发布任务、完成标注均可积累成长值。成长值达到100时会员升级至黄金,达到1000时升级至钻石。充值增加的成长值与增加的积分相同,发布方每次发布任务、标注方每次完成标注均增加10点成长值 |
| vip_expire_time | number | true | none | 会员到期时间戳 | 小于当前时间戳则为非会员 |
| is_checked | boolean | true | none | 需求方是否被审核通过 | |
| is_banned | boolean | true | none | 用户是否被违规封禁 | |
| object | true | none | 用户邮箱 | ||
| tag_score | integer | true | none | 标注方标注获得的积分 | |
| face_base64 | string | true | none | 用户面部图片的 base64 | |
| q_id | integer | true | none | 用户标注到的题号 | none |
| result_type | string | true | none | none | |
| accept_method | string | true | none | 验收方式 | 分为自动验收和人工验收两种 |
| state | string | false | none | 用户在任务上的状态 | 状态间互斥 |
- 当前用户为管理员
400 Bad Request
{
"code": 12,
"message": "no task of admin",
"data": {}
}
POST /task/upload_data¶
需求方上传题目数据
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| data_type | query | string | 是 | 题目数据类型 | text, image 中选择,压缩包内文件的类型 |
file: string
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| file | body | string(binary) | 是 | 一个压缩包 | none |
压缩包内只能包含 x.txt 或 x.jpg,其中 x 为从1开始的连续整数 txt的编码为 utf-8 根据压缩包大小等待不同时间,记压缩包大小为 x MB 普通用户 x10s 白银用户 x7s 黄金用户 x3s 钻石用户 x0s
- 成功
200 OK
{
"code": 0,
"message": "succeed",
"data": [
{
"filename": "string",
"tag": "string"
}
]
}
- 压缩包内部文件序列中断
200 OK
{
"code": 20,
"message": "file sequence interrupt",
"data": {
"files": [
{
"filename": "string",
"tag": "string"
}
],
"upload_num": 0,
"legal_num": 0
}
}
data 各字段含义如下:
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|---|---|---|---|---|---|
| filename | string | true | none | 上传的文件名 | |
| tag | string | true | none | 唯一标识符 | 文字数据返回一个text_id,图片数据返回一个url |
| upload_num | integer | true | none | 上传文件数 | |
| legal_num | integer | true | none | 合法文件数 |
- 文件类型错误
400 Bad Request
{
"code": 32,
"message": "data type error"
}
POST /task/upload_res/{task_id}/{q_id}¶
登陆
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| task_id | path | string | 是 | 任务 id | none |
| q_id | path | string | 是 | 问题 id | none |
请求附带 JSON 格式的正文。
样例:
{
"result": [
{
"input_type": "string",
"tag_result": [
"string"
]
}
],
"input_result": [
{
"input_type": "string",
"input_res": "string"
}
]
}
正文的 JSON 包含一个字典,字典的各字段含义如下:
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| result | body | any | 是 | 根据任务类型 | none |
| input_result | body | any | 否 | 根据任务类型 | none |
- 成功
200 OK
{
"code": 0,
"message": "succeed",
"data": {}
}
- 不可重复提交
400 Bad Request
{
"code": 50,
"message": "no resubmit",
"data": {}
}
GET /task/{task_id}/{q_id}¶
请求指定任务的指定题目数据
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| task_id | path | string | 是 | 任务 id | none |
| q_id | path | integer | 是 | 问题 id | none |
判断当前用户类型,若为管理员则返回题目数据和标注结果;若为需求方且为发布人,则返回问题数据和标注结果;若为标注方且题目被分发给当前用户,则返回问题数据和标注结果。其他身份均无权限。
- 成功
200 OK
{
"code": 0,
"message": "succeed",
"data": {
"data": [
"string"
],
"result": [
{
"tag_user": {
"user_id": 0,
"user_name": "string",
"password": "string",
"user_type": "[",
"score": 0,
"membership_level": 0,
"invite_code": "string",
"credit_score": 100,
"bank_account": {},
"grow_value": 0,
"vip_expire_time": 0.1,
"is_checked": true,
"is_banned": true,
"email": {},
"tag_score": 0,
"face_base64": "string"
},
"tag_res": "string"
}
],
"data_type": "string",
"tag_type": [
"string"
],
"start_time": "string",
"input_type": [
"string"
],
"cut_num": "string"
}
}
data 各字段含义如下:
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|---|---|---|---|---|---|
| data | any | true | none | 题目数据 | none |
| anonymous | [string] | false | none | 文字数据 | 一个按行分开的字符串数组 |
| anonymous | string | false | none | 图片数据 | 一个url |
| result | [object] | true | none | none | |
| tag_user | User | true | none | 任务发布者 | none |
| user_id | integer | true | none | 用户id,主键 | |
| user_name | string | true | none | 用户名 | |
| password | string | true | none | 加密之后的密码 | |
| user_type | string | true | none | demand表示需求方,tag表示标注方,admin表示管理员,agent表示中介 | |
| score | integer | true | none | 积分(标注所得奖励) | |
| membership_level | integer | true | none | 会员等级:0表示非会员,1表示白银,2表示黄金,3表示钻石 | |
| invite_code | string | true | none | 邀请码,8位字母和数字 | |
| credit_score | integer | true | none | 信用分(恶意行为会扣除) | |
| bank_account | object | true | none | 银行账户 | |
| card_id | string | true | none | 银行卡号 | |
| card_balance | string | true | none | 银行卡余额 | |
| grow_value | integer | true | none | 会员成长值 | 充值、发布任务、完成标注均可积累成长值。成长值达到100时会员升级至黄金,达到1000时升级至钻石。充值增加的成长值与增加的积分相同,发布方每次发布任务、标注方每次完成标注均增加10点成长值 |
| vip_expire_time | number | true | none | 会员到期时间戳 | 小于当前时间戳则为非会员 |
| is_checked | boolean | true | none | 需求方是否被审核通过 | |
| is_banned | boolean | true | none | 用户是否被违规封禁 | |
| object | true | none | 用户邮箱 | ||
| string | true | none | 用户邮箱 | ||
| email_valid | string | true | none | 用户邮箱验证码 | |
| email_valid_expire | number | true | none | 邮箱验证码过期时间 | |
| tag_score | integer | true | none | 标注方标注获得的积分 | |
| face_base64 | string | true | none | 用户面部图片的 base64 | |
| tag_res | string | true | none | none | |
| data_type | string | true | none | none | |
| tag_type | any | false | none | none | |
| anonymous | [string] | false | none | none | |
| anonymous | [object] | false | none | none | |
| input_type | string | true | none | none | |
| tags | [string] | true | none | none | |
| start_time | string | true | none | 开始做题时间 | none |
| input_type | [string] | true | none | none | |
| cut_num | string | true | none | 同创建任务 |
- 任务不存在
404 Not Found
{
"code": 11,
"message": "task does not exist",
"data": {}
}
404 Not Found
{
"code": 13,
"message": "question does not exist",
"data": {}
}
400 Bad Request
{
"code": 16,
"message": "no access permission",
"data": {}
}
400 Bad Request
{
"code": 35,
"message": "user not checked",
"data": {}
}
POST /task/distribute/{task_id}¶
分发任务
无
需求方创建好任务并导入数据后,可以分发(只有创建任务的需求方可以分发)。后端根据需求方设定的分发用户数目和分发策略分发任务。后端需要修改任务的当前分发用户列表
- 成功
200 OK
{
"code": 0,
"message": "succeed",
"data": {}
}
- 任务未创建
400 Bad Request
{
"code": 14,
"message": "task not created",
"data": {}
}
400 Bad Request
{
"code": 15,
"message": "no distribute permission",
"data": {}
}
400 Bad Request
{
"code": 15,
"message": "no distribute permission",
"data": {}
}
400 Bad Request
{
"code": 23,
"message": "task has been distributed",
"data": {}
}
400 Bad Request
{
"code": 10,
"message": "score not enough",
"data": {}
}
400 Bad Request
{
"code": 34,
"message": "task not checked",
"data": {}
}
400 Bad Request
{
"code": 33,
"message": "refused task",
"data": {}
}
GET /task/{task_id}¶
请求任务数据
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| task_id | path | integer | 是 | 任务 id | none |
管理员和发布者和被分发到的标注方可以请求整个任务数据,其他身份均无权限
distributed_time当请求者是标注方时,返回该用户被分发到该任务的时间。
- 成功
200 OK
{
"code": 0,
"message": "succeed",
"data": {
"task_type": "string",
"task_style": "string",
"reward_per_q": 0,
"time_limit_per_q": 0,
"total_time_limit": 0,
"auto_ac": true,
"manual_ac": true,
"publisher": {
"user_id": 0,
"user_name": "string",
"password": "string",
"user_type": "advertiser",
"score": 0,
"membership_level": 0,
"invite_code": "string",
"credit_score": 100,
"bank_account": {
"card_id": "string",
"card_balance": "string"
},
"grow_value": 0,
"vip_expire_time": 0.1,
"is_checked": true,
"is_banned": true,
"email": {
"email": "string",
"email_valid": "string",
"email_valid_expire": 0
},
"tag_score": 0,
"face_base64": "string"
},
"task_id": 0,
"distribute_user_num": 0,
"q_num": 0,
"task_name": "string",
"current_tag_user_list": [
{
"tag_user": {
"user_id": 0,
"user_name": "string",
"password": "string",
"user_type": "[",
"score": 0,
"membership_level": 0,
"invite_code": "string",
"credit_score": 100,
"bank_account": {},
"grow_value": 0,
"vip_expire_time": 0.1,
"is_checked": true,
"is_banned": true,
"email": {},
"tag_score": 0,
"face_base64": "string"
},
"accepted_at": 0,
"state": "not_handle"
}
],
"progress": [
{
"tag_user": {
"user_id": 0,
"user_name": "string",
"password": "string",
"user_type": "[",
"score": 0,
"membership_level": 0,
"invite_code": "string",
"credit_score": 100,
"bank_account": {},
"grow_value": 0,
"vip_expire_time": 0.1,
"is_checked": true,
"is_banned": true,
"email": {},
"tag_score": 0,
"face_base64": "string"
},
"q_id": 0
}
],
"result_type": "string",
"accept_method": "auto",
"accepted_time": 0,
"current_tag_user_num": 0,
"check_result": "string",
"agent": {
"user_id": 0,
"user_name": "string",
"credit_score": 100
}
}
}
data 各字段含义如下:
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|---|---|---|---|---|---|
| data | object | true | none | none | |
| task_type | string | true | none | 任务类型 | none |
| task_style | string | true | none | 任务样式 | (待定)对任务的描述 |
| reward_per_q | integer | true | none | 单题奖励分数 | none |
| time_limit_per_q | integer | true | none | 单题时限 | none |
| total_time_limit | integer | true | none | 总时限 | none |
| auto_ac | boolean | true | none | 是否自动验收 | none |
| manual_ac | boolean | true | none | 是否人工验收 | none |
| publisher | User | true | none | 任务发布者 | none |
| user_id | integer | true | none | 用户id,主键 | |
| user_name | string | true | none | 用户名 | |
| password | string | true | none | 加密之后的密码 | |
| user_type | string | true | none | demand表示需求方,tag表示标注方,admin表示管理员,agent表示中介 | |
| score | integer | true | none | 积分(标注所得奖励) | |
| membership_level | integer | true | none | 会员等级:0表示非会员,1表示白银,2表示黄金,3表示钻石 | |
| invite_code | string | true | none | 邀请码,8位字母和数字 | |
| credit_score | integer | true | none | 信用分(恶意行为会扣除) | |
| bank_account | object | true | none | 银行账户 | |
| card_id | string | true | none | 银行卡号 | |
| card_balance | string | true | none | 银行卡余额 | |
| grow_value | integer | true | none | 会员成长值 | 充值、发布任务、完成标注均可积累成长值。成长值达到100时会员升级至黄金,达到1000时升级至钻石。充值增加的成长值与增加的积分相同,发布方每次发布任务、标注方每次完成标注均增加10点成长值 |
| vip_expire_time | number | true | none | 会员到期时间戳 | 小于当前时间戳则为非会员 |
| is_checked | boolean | true | none | 需求方是否被审核通过 | |
| is_banned | boolean | true | none | 用户是否被违规封禁 | |
| object | true | none | 用户邮箱 | ||
| string | true | none | 用户邮箱 | ||
| email_valid | string | true | none | 用户邮箱验证码 | |
| email_valid_expire | number | true | none | 邮箱验证码过期时间 | |
| tag_score | integer | true | none | 标注方标注获得的积分 | |
| face_base64 | string | true | none | 用户面部图片的 base64 | |
| task_id | integer | true | none | 任务id | 主键,唯一标识 |
| distribute_user_num | integer | true | none | 设定分发用户数量 | none |
| q_num | integer | true | none | 题目的数量 | none |
| task_name | string | true | none | 任务名 | 长度在4-24之间的字符串 |
| current_tag_user_list | [object] | true | none | 当前被分发用户列表 | none |
| tag_user | User | true | none | 任务发布者 | none |
| user_id | integer | true | none | 用户id,主键 | |
| user_name | string | true | none | 用户名 | |
| password | string | true | none | 加密之后的密码 | |
| user_type | string | true | none | demand表示需求方,tag表示标注方,admin表示管理员,agent表示中介 | |
| score | integer | true | none | 积分(标注所得奖励) | |
| membership_level | integer | true | none | 会员等级:0表示非会员,1表示白银,2表示黄金,3表示钻石 | |
| invite_code | string | true | none | 邀请码,8位字母和数字 | |
| credit_score | integer | true | none | 信用分(恶意行为会扣除) | |
| bank_account | object | true | none | 银行账户 | |
| grow_value | integer | true | none | 会员成长值 | 充值、发布任务、完成标注均可积累成长值。成长值达到100时会员升级至黄金,达到1000时升级至钻石。充值增加的成长值与增加的积分相同,发布方每次发布任务、标注方每次完成标注均增加10点成长值 |
| vip_expire_time | number | true | none | 会员到期时间戳 | 小于当前时间戳则为非会员 |
| is_checked | boolean | true | none | 需求方是否被审核通过 | |
| is_banned | boolean | true | none | 用户是否被违规封禁 | |
| object | true | none | 用户邮箱 | ||
| tag_score | integer | true | none | 标注方标注获得的积分 | |
| face_base64 | string | true | none | 用户面部图片的 base64 | |
| accepted_at | number | true | none | 标注用户接受任务时间戳 | none |
| state | string | true | none | 用户在任务上的状态 | 状态间互斥 |
| progress | [object] | true | none | 用户标注进展 | 分发时即将相应的用户加入,进展为0 |
| tag_user | User | true | none | 任务发布者 | none |
| user_id | integer | true | none | 用户id,主键 | |
| user_name | string | true | none | 用户名 | |
| password | string | true | none | 加密之后的密码 | |
| user_type | string | true | none | demand表示需求方,tag表示标注方,admin表示管理员,agent表示中介 | |
| score | integer | true | none | 积分(标注所得奖励) | |
| membership_level | integer | true | none | 会员等级:0表示非会员,1表示白银,2表示黄金,3表示钻石 | |
| invite_code | string | true | none | 邀请码,8位字母和数字 | |
| credit_score | integer | true | none | 信用分(恶意行为会扣除) | |
| bank_account | object | true | none | 银行账户 | |
| grow_value | integer | true | none | 会员成长值 | 充值、发布任务、完成标注均可积累成长值。成长值达到100时会员升级至黄金,达到1000时升级至钻石。充值增加的成长值与增加的积分相同,发布方每次发布任务、标注方每次完成标注均增加10点成长值 |
| vip_expire_time | number | true | none | 会员到期时间戳 | 小于当前时间戳则为非会员 |
| is_checked | boolean | true | none | 需求方是否被审核通过 | |
| is_banned | boolean | true | none | 用户是否被违规封禁 | |
| object | true | none | 用户邮箱 | ||
| tag_score | integer | true | none | 标注方标注获得的积分 | |
| face_base64 | string | true | none | 用户面部图片的 base64 | |
| q_id | integer | true | none | 用户标注到的题号 | none |
| result_type | string | true | none | none | |
| accept_method | string | true | none | none | |
| accepted_time | number | true | none | 开始时间 | 只有请求方是 tag 时返回 |
| current_tag_user_num | number | true | none | 当前已被分发的个数 | 只有请求方是agent时返回 |
| check_result | string | true | none | 管理员审核结果 | none |
| agent | object | true | none | 中介 | 任务委托给哪位中介 |
| user_id | integer | true | none | 用户id,主键 | |
| user_name | string | true | none | 用户名 | |
| credit_score | integer | true | none | 信用分(恶意行为会扣除) |
- 无访问权限
400 Bad Request
{
"code": 16,
"message": "no access permission",
"data": {}
}
404 Not Found
{
"code": 11,
"message": "task does not exist",
"data": {}
}
POST /task/refuse/{task_id}¶
标注方拒绝任务
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| task_id | path | integer | 是 | 任务 id | none |
后端收到该请求后,将任务分发给另一个不在past_tag_user_list中的标注用户,并更新current_tag_user_list。若剩余可分发用户不足,则返回错误响应。
- 成功
200 OK
{
"code": 0,
"message": "succeed",
"data": {}
}
无
POST /task/accept/{task_id}¶
标注方接受任务
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| task_id | path | string | 是 | 任务 id | none |
后端首先判断该任务是否被分发给当前用户,修改该用户的accepted_at,再返回任务数据
- 成功
200 OK
{
"code": 0,
"message": "succeed"
}
- 无接受权限
400 Bad Request
{
"code": 18,
"message": "no permission to accept",
"data": {}
}
400 Bad Request
{
"code": 30,
"message": "accept limit",
"data": {}
}
400 Bad Request
{
"code": 31,
"message": "distribution completed",
"data": {}
}
400 Bad Request
{
"code": 32,
"message": "repeat accept",
"data": {}
}
GET /task/is_distributed/{task_id}¶
任务是否已被分发
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| task_id | path | string | 是 | 任务 id | none |
请求task_id任务是否已经被分发
- 成功
200 OK
{
"code": 0,
"message": "success",
"data": {
"is_distributed": true
}
}
data 各字段含义如下:
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|---|---|---|---|---|---|
| is_distributed | boolean | true | none | none |
- 任务未创建
404 Not Found
```json
{
"code": 14,
"message": "task not created",
"data": {}
}
```
POST /task/redistribute/{task_id}¶
重新分发任务
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| task_id | path | string | 是 | 任务 id | none |
需求方的分发用户列表里有用户超时了 需求方按下选择重新分发的按钮 这会去掉所有超时的用户 并重新分配current taguserlist
如果有审核被拒的应该也要被重新分发
- 成功
200 OK
{
"code": 0,
"message": "succeed",
"data": {}
}
- 任务未创建
404 Not Found
{
"code": 14,
"message": "task not created",
"data": {}
}
400 Bad Request
{
"code": 15,
"message": "no distribute permission",
"data": {}
}
400 Bad Request
{
"code": 21,
"message": "tag user not enough",
"data": {}
}
400 Bad Request
{
"code": 10,
"message": "score not enough",
"data": {}
}
400 Bad Request
{
"code": 75,
"message": "string",
"data": {}
}
- 当前用户未被审核
400 Bad Request
{
"code": 35,
"message": "user not checked",
"data": {}
}
GET /task/get_all_tasks¶
获取所有任务
无
仅有管理员可以使用,获得所有任务的信息
- 成功
200 OK
{
"code": 0,
"message": "string",
"data": [
{
"task_id": 0,
"task_type": "text",
"task_style": [
"string"
],
"publisher": {
"user_id": 0,
"user_name": "string",
"user_type": "advertiser",
"membership_level": 0,
"credit_score": 100,
"grow_value": 0,
"is_checked": true,
"is_banned": true,
"email": {
"email": "string",
"email_valid": "string",
"email_valid_expire": 0
},
"tag_score": 0,
"face_base64": "string"
},
"task_name": "string",
"tag_type": [
"string"
],
"check_result": "string",
"input_type": [
{
"input_tip": "string"
}
]
}
]
}
data 各字段含义如下:
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|---|---|---|---|---|---|
| code | integer | true | none | none | |
| message | string | true | none | none | |
| data | [object] | true | none | none | |
| task_id | integer | true | none | 任务id | 主键,唯一标识 |
| task_type | string | true | none | 任务类型 | none |
| task_style | [string] | true | none | 任务描述 | 对任务的描述 |
| publisher | object | true | none | 任务发布者 | none |
| user_id | integer | true | none | 用户id,主键 | |
| user_name | string | true | none | 用户名 | |
| user_type | string | true | none | demand表示需求方,tag表示标注方,admin表示管理员,agent表示中介 | |
| membership_level | integer | true | none | 会员等级:0表示非会员,1表示白银,2表示黄金,3表示钻石 | |
| credit_score | integer | true | none | 信用分(恶意行为会扣除) | |
| grow_value | integer | true | none | 会员成长值 | 充值、发布任务、完成标注均可积累成长值。成长值达到100时会员升级至黄金,达到1000时升级至钻石。充值增加的成长值与增加的积分相同,发布方每次发布任务、标注方每次完成标注均增加10点成长值 |
| is_checked | boolean | true | none | 需求方是否被审核通过 | |
| is_banned | boolean | true | none | 用户是否被违规封禁 | |
| object | true | none | 用户邮箱 | ||
| string | true | none | 用户邮箱 | ||
| email_valid | string | true | none | 用户邮箱验证码 | |
| email_valid_expire | number | true | none | 邮箱验证码过期时间 | |
| tag_score | integer | true | none | 标注方标注获得的积分 | |
| face_base64 | string | true | none | 用户面部图片的 base64 | |
| task_name | string | true | none | 任务名 | 长度在4-24之间的字符串 |
| tag_type | [string] | true | none | none | |
| check_result | string | true | none | 被审核的结果,refuse表示拒绝,accept表示接受,wait表示待审核 | |
| input_type | [object] | true | none | none | |
| input_tip | string | true | none | none |
无
POST /task/upload_res/{task_id}¶
标注方批量上传结果
file: string
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| task_id | path | string | 是 | 任务 id | none |
| file | body | string(binary) | 是 | 一个 csv 文件 | none |
上传在下载题目数据中获得的压缩包内的 upload.csv,后端更新题目的标注结果
- 成功
200 OK
{
"code": 0,
"message": "success",
"data": {}
}
- csv 字段缺失
400 Bad Request
{
"code": 71,
"message": "missing field name"
}
400 Bad Request
{
"code": 72,
"message": "invalid task type"
}
400 Bad Request
{
"code": 73,
"message": "wrong filename"
}
400 Bad Request
{
"code": 74,
"message": "wrong tag name"
}
GET /task/taginfo/{task_id}¶
获取标注信息
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| task_id | path | string | 是 | 任务 id | none |
获得当前标注用户在当前任务的每一题上的标注状态
- 成功
200 OK
{
"code": 0,
"message": "string",
"data": [
{
"q_id": 0,
"state": " notstarted",
"startat": 0,
"finishat": 0,
"q_data": "string",
"q_type": "text"
}
]
}
data 各字段含义如下:
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|---|---|---|---|---|---|
| q_id | integer | true | none | 题目id | none |
| state | string | true | none | 题目状态 | 进入标注界面的时间超过单题下限的,视为开始标注 |
| startat | integer | true | none | 开始标注的时间 | none |
| finishat | integer | true | none | 完成标注的时间 | none |
| q_data | string | true | none | 题干 | 若题目数据类型为 图片,则返回 图片地址,其他类型不支持预览,所以随意返回。若数据类型为文本,当文本长度超过100时,截断到100个字符,并在后面填补... |
| q_type | string | true | none | 题目数据类型 | none |
无
POST /task/startquestion/{task_id}/{q_id}¶
题目开始标注
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| task_id | path | string | 是 | 任务 id | none |
| q_id | path | string | 是 | 题目 id | none |
将题目状态设置为 已开始标注,并更新开始时间
- 成功
200 OK
{
"code": 0,
"message": "string",
"data": {}
}
- 已开始标注
400 Bad Request
{
"code": 59,
"message": "already start"
}
GET /{url}¶
- 图片不存在
404 Not Found
{
"code": 18,
"message": "picture not found"
}
GET /task/get_batch_data/{task_id}¶
获取批量标注题目数据
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| task_id | path | string | 是 | 任务 id | none |
获取当前题目的所有数据(批量标注用)
- 成功
200 OK
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| data.zip | body | file | 是 | 题目数据 |
无
POST /task/to_agent/{task_id}¶
获取当前题目的所有数据(批量标注用)
请求附带 JSON 格式的正文。
样例:
{
"agent_id": "string"
}
正文的 JSON 包含一个字典,字典的各字段含义如下:
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| agent_id | body | string | 是 | 委托给中介的用户id | none |
需求方将任务委托给中介平台
- 成功
200 OK
{
"code": 0,
"message": "success",
"data": "string"
}
无
POST /task/distribute_to_user/{task_id}/{user_id}¶
分发任务给特定用户
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| task_id | path | string | 是 | none | |
| user_id | path | string | 是 | none |
中介将任务task_id分发给user_id
- 成功
200 OK
{
"code": 0,
"message": "success",
"data": "string"
}
无
GET /task/get_free_tasks¶
获取可接取的任务
无
获取可接取的任务
- 成功
200 OK
{
"code": 0,
"message": "string",
"data": [
{
"task_id": 0,
"task_type": "string",
"task_style": "string",
"reward_per_q": 0,
"time_limit_per_q": 0,
"total_time_limit": 0,
"publisher": {
"user_id": 0,
"user_name": "string",
"password": "string",
"user_type": "advertiser",
"score": 0,
"membership_level": 0,
"invite_code": "string",
"credit_score": 100,
"bank_account": {
"card_id": "string",
"card_balance": "string"
},
"grow_value": 0,
"vip_expire_time": 0.1,
"is_checked": true,
"is_banned": true,
"email": {
"email": "string",
"email_valid": "string",
"email_valid_expire": 0
},
"tag_score": 0,
"face_base64": "string"
},
"distribute_user_num": 0,
"q_num": 0,
"task_name": "string",
"questions": [
{
"data": "string",
"result": [
{}
],
"data_type": "text",
"tag_type": [
"string"
]
}
],
"current_tag_user_list": [
{
"tag_user": {
"user_id": null,
"user_name": null,
"password": null,
"user_type": null,
"score": null,
"membership_level": null,
"invite_code": null,
"credit_score": null,
"bank_account": null,
"grow_value": null,
"vip_expire_time": null,
"is_checked": null,
"is_banned": null,
"email": null,
"tag_score": null,
"face_base64": null
},
"accepted_at": 0,
"is_finished": true,
"is_check_accepted": "pass"
}
],
"past_tag_user_list": [
{
"user_id": 0,
"user_name": "string",
"password": "string",
"user_type": "advertiser",
"score": 0,
"membership_level": 0,
"invite_code": "string",
"credit_score": 100,
"bank_account": {
"card_id": null,
"card_balance": null
},
"grow_value": 0,
"vip_expire_time": 0.1,
"is_checked": true,
"is_banned": true,
"email": {
"email": null,
"email_valid": null,
"email_valid_expire": null
},
"tag_score": 0,
"face_base64": "string"
}
],
"progress": [
{
"tag_user": {
"user_id": null,
"user_name": null,
"password": null,
"user_type": null,
"score": null,
"membership_level": null,
"invite_code": null,
"credit_score": null,
"bank_account": null,
"grow_value": null,
"vip_expire_time": null,
"is_checked": null,
"is_banned": null,
"email": null,
"tag_score": null,
"face_base64": null
},
"q_id": 0
}
],
"result_type": "string",
"accept_method": "auto",
"tag_type": [
"string"
],
"categories": [
"string"
],
"agent": "string"
}
]
}
data 各字段含义如下:
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|---|---|---|---|---|---|
| task_id | integer | true | none | 任务id | 主键,唯一标识 |
| task_type | string | true | none | 任务类型 | none |
| task_style | string | true | none | 任务样式 | (待定)对任务的描述 |
| reward_per_q | integer | true | none | 单题奖励分数 | none |
| time_limit_per_q | integer | true | none | 单题时限 | none |
| total_time_limit | integer | true | none | 总时限 | none |
| publisher | User | true | none | 任务发布者 | none |
| user_id | integer | true | none | 用户id,主键 | |
| user_name | string | true | none | 用户名 | |
| password | string | true | none | 加密之后的密码 | |
| user_type | string | true | none | demand表示需求方,tag表示标注方,admin表示管理员,agent表示中介 | |
| score | integer | true | none | 积分(标注所得奖励) | |
| membership_level | integer | true | none | 会员等级:0表示非会员,1表示白银,2表示黄金,3表示钻石 | |
| invite_code | string | true | none | 邀请码,8位字母和数字 | |
| credit_score | integer | true | none | 信用分(恶意行为会扣除) | |
| bank_account | object | true | none | 银行账户 | |
| card_id | string | true | none | 银行卡号 | |
| card_balance | string | true | none | 银行卡余额 | |
| grow_value | integer | true | none | 会员成长值 | 充值、发布任务、完成标注均可积累成长值。成长值达到100时会员升级至黄金,达到1000时升级至钻石。充值增加的成长值与增加的积分相同,发布方每次发布任务、标注方每次完成标注均增加10点成长值 |
| vip_expire_time | number | true | none | 会员到期时间戳 | 小于当前时间戳则为非会员 |
| is_checked | boolean | true | none | 需求方是否被审核通过 | |
| is_banned | boolean | true | none | 用户是否被违规封禁 | |
| object | true | none | 用户邮箱 | ||
| string | true | none | 用户邮箱 | ||
| email_valid | string | true | none | 用户邮箱验证码 | |
| email_valid_expire | number | true | none | 邮箱验证码过期时间 | |
| tag_score | integer | true | none | 标注方标注获得的积分 | |
| face_base64 | string | true | none | 用户面部图片的 base64 | |
| distribute_user_num | integer | true | none | 设定分发用户数量 | none |
| q_num | integer | true | none | 题目的数量 | none |
| task_name | string | true | none | 任务名 | 长度在4-24之间的字符串 |
| questions | [object] | true | none | 具体问题数据 | none |
| data | string | false | none | 问题数据 | 存储文字数据或图片数据的唯一标识符 |
| result | [object] | false | none | 标注结果 | 列表中存储不同用户的标注结果 |
| tag_user | User | false | none | 任务标注者 | none |
| user_id | integer | true | none | 用户id,主键 | |
| user_name | string | true | none | 用户名 | |
| password | string | true | none | 加密之后的密码 | |
| user_type | string | true | none | demand表示需求方,tag表示标注方,admin表示管理员,agent表示中介 | |
| score | integer | true | none | 积分(标注所得奖励) | |
| membership_level | integer | true | none | 会员等级:0表示非会员,1表示白银,2表示黄金,3表示钻石 | |
| invite_code | string | true | none | 邀请码,8位字母和数字 | |
| credit_score | integer | true | none | 信用分(恶意行为会扣除) | |
| bank_account | object | true | none | 银行账户 | |
| grow_value | integer | true | none | 会员成长值 | 充值、发布任务、完成标注均可积累成长值。成长值达到100时会员升级至黄金,达到1000时升级至钻石。充值增加的成长值与增加的积分相同,发布方每次发布任务、标注方每次完成标注均增加10点成长值 |
| vip_expire_time | number | true | none | 会员到期时间戳 | 小于当前时间戳则为非会员 |
| is_checked | boolean | true | none | 需求方是否被审核通过 | |
| is_banned | boolean | true | none | 用户是否被违规封禁 | |
| object | true | none | 用户邮箱 | ||
| tag_score | integer | true | none | 标注方标注获得的积分 | |
| face_base64 | string | true | none | 用户面部图片的 base64 | |
| tag_res | string | false | none | 标注结果 | none |
| data_type | string | false | none | 数据类型 | none |
| tag_type | [string] | true | none | none | |
| current_tag_user_list | [object] | true | none | 当前被分发用户列表 | none |
| tag_user | User | true | none | 任务发布者 | none |
| user_id | integer | true | none | 用户id,主键 | |
| user_name | string | true | none | 用户名 | |
| password | string | true | none | 加密之后的密码 | |
| user_type | string | true | none | demand表示需求方,tag表示标注方,admin表示管理员,agent表示中介 | |
| score | integer | true | none | 积分(标注所得奖励) | |
| membership_level | integer | true | none | 会员等级:0表示非会员,1表示白银,2表示黄金,3表示钻石 | |
| invite_code | string | true | none | 邀请码,8位字母和数字 | |
| credit_score | integer | true | none | 信用分(恶意行为会扣除) | |
| bank_account | object | true | none | 银行账户 | |
| grow_value | integer | true | none | 会员成长值 | 充值、发布任务、完成标注均可积累成长值。成长值达到100时会员升级至黄金,达到1000时升级至钻石。充值增加的成长值与增加的积分相同,发布方每次发布任务、标注方每次完成标注均增加10点成长值 |
| vip_expire_time | number | true | none | 会员到期时间戳 | 小于当前时间戳则为非会员 |
| is_checked | boolean | true | none | 需求方是否被审核通过 | |
| is_banned | boolean | true | none | 用户是否被违规封禁 | |
| object | true | none | 用户邮箱 | ||
| tag_score | integer | true | none | 标注方标注获得的积分 | |
| face_base64 | string | true | none | 用户面部图片的 base64 | |
| accepted_at | number | true | none | 标注用户接受任务时间戳 | 未接受任务时为none,接受任务为接受的时间戳,拒绝任务为-1 |
| is_finished | boolean | true | none | none | |
| is_check_accepted | string | true | none | none | |
| past_tag_user_list | [User] | true | none | 过去被分发到的用户列表 | 确保不重复分发 |
| user_id | integer | true | none | 用户id,主键 | |
| user_name | string | true | none | 用户名 | |
| password | string | true | none | 加密之后的密码 | |
| user_type | string | true | none | demand表示需求方,tag表示标注方,admin表示管理员,agent表示中介 | |
| score | integer | true | none | 积分(标注所得奖励) | |
| membership_level | integer | true | none | 会员等级:0表示非会员,1表示白银,2表示黄金,3表示钻石 | |
| invite_code | string | true | none | 邀请码,8位字母和数字 | |
| credit_score | integer | true | none | 信用分(恶意行为会扣除) | |
| bank_account | object | true | none | 银行账户 | |
| grow_value | integer | true | none | 会员成长值 | 充值、发布任务、完成标注均可积累成长值。成长值达到100时会员升级至黄金,达到1000时升级至钻石。充值增加的成长值与增加的积分相同,发布方每次发布任务、标注方每次完成标注均增加10点成长值 |
| vip_expire_time | number | true | none | 会员到期时间戳 | 小于当前时间戳则为非会员 |
| is_checked | boolean | true | none | 需求方是否被审核通过 | |
| is_banned | boolean | true | none | 用户是否被违规封禁 | |
| object | true | none | 用户邮箱 | ||
| tag_score | integer | true | none | 标注方标注获得的积分 | |
| face_base64 | string | true | none | 用户面部图片的 base64 | |
| progress | [object] | true | none | 用户标注进展 | 分发时即将相应的用户加入,进展为0 |
| tag_user | User | true | none | 任务发布者 | none |
| user_id | integer | true | none | 用户id,主键 | |
| user_name | string | true | none | 用户名 | |
| password | string | true | none | 加密之后的密码 | |
| user_type | string | true | none | demand表示需求方,tag表示标注方,admin表示管理员,agent表示中介 | |
| score | integer | true | none | 积分(标注所得奖励) | |
| membership_level | integer | true | none | 会员等级:0表示非会员,1表示白银,2表示黄金,3表示钻石 | |
| invite_code | string | true | none | 邀请码,8位字母和数字 | |
| credit_score | integer | true | none | 信用分(恶意行为会扣除) | |
| bank_account | object | true | none | 银行账户 | |
| grow_value | integer | true | none | 会员成长值 | 充值、发布任务、完成标注均可积累成长值。成长值达到100时会员升级至黄金,达到1000时升级至钻石。充值增加的成长值与增加的积分相同,发布方每次发布任务、标注方每次完成标注均增加10点成长值 |
| vip_expire_time | number | true | none | 会员到期时间戳 | 小于当前时间戳则为非会员 |
| is_checked | boolean | true | none | 需求方是否被审核通过 | |
| is_banned | boolean | true | none | 用户是否被违规封禁 | |
| object | true | none | 用户邮箱 | ||
| tag_score | integer | true | none | 标注方标注获得的积分 | |
| face_base64 | string | true | none | 用户面部图片的 base64 | |
| q_id | integer | true | none | 用户标注到的题号 | none |
| result_type | string | true | none | none | |
| accept_method | string | true | none | 验收方式 | 分为自动验收和人工验收两种 |
| tag_type | [string] | true | none | none | |
| categories | [string] | true | none | 任务的标签:e.g. animal、plant... | |
| agent | string | true | none | 委托人 |
无
POST /task/check_task/{task_id}¶
审核任务
请求附带 JSON 格式的正文。
样例:
{
"result": "string"
}
正文的 JSON 包含一个字典,字典的各字段含义如下:
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| result | body | string | 是 | accept:审核通过;refuse:审核拒绝 |
审核任务。可以选择不通过该任务
- 成功
200 OK
{
"code": 0,
"message": "succeed",
"data": {}
}
- 重复审核
400 Bad Request
{
"code": 51,
"message": "recheck"
}
审核相关¶
POST /review/manual_check/{task_id}/{user_id}¶
需求方人工审核
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| task_id | path | integer | 是 | none | |
| user_id | path | string | 是 | none |
请求附带 JSON 格式的正文。
样例:
{
"check_method": "select"
}
正文的 JSON 包含一个字典,字典的各字段含义如下:
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| check_method | body | string | 是 | none |
前端发送任务id及标注用户user_id以及审核方式(抽查审核/全量审核),后端检查请求的用户是否为发布任务的需求方,并发送task_id相关数据
- 成功
200 OK
{
"code": 0,
"message": "string",
"data": {
"q_info": [
{
"q_id": 0,
"data": "string",
"data_type": "string",
"result": {}
}
]
}
}
data 各字段含义如下:
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|---|---|---|---|---|---|
| q_info | [object] | true | none | none | |
| q_id | integer | false | none | 题号 | |
| data | string | false | none | 题目数据 | |
| data_type | string | false | none | 题目数据类型 | |
| result | any | true | none | 标注结果 | none |
| anonymous | object | false | none | 标注任务 | none |
| result | string | true | none | 标签结果 | none |
| anonymous | object | false | none | 三元组 | none |
| result | [string] | true | none | 三元组结果 | 数组中有两个sttring |
| anonymous | object | false | none | 自定义 | none |
| result | [object] | true | none | 标注结果 | none |
| input_type | string | true | none | none | |
| input_res | string | true | none | none | |
| input_result | [object] | true | none | 文本框结果 | 数组 |
| input_type | string | true | none | none | |
| input_res | string | true | none | none | |
| anonymous | object | false | none | 人脸识别 | none |
| result | [string] | true | none | 识别点数组 | 数组 |
- 无权限
400 Bad Request
{
"code": 16,
"message": "no permissions",
"data": {}
}
404 Not Found
{
"code": 14,
"message": "task not created",
"data": {}
}
400 Bad Request
{
"code": 24,
"message": "task not distributed",
"data": {}
}
POST /review/accept/{task_id}/{user_id}¶
审核通过
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| task_id | path | string | 是 | none | |
| user_id | path | string | 是 | none |
审核通过指定用户在指定题目上的标注
- 成功
200 OK
{
"code": 0,
"message": "string"
}
- 无权限
400 Bad Request
{
"code": 16,
"message": "no permissions",
"data": {}
}
404 Not Found
{
"code": 14,
"message": "task not created",
"data": {}
}
400 Bad Request
{
"code": 24,
"message": "task not distributed",
"data": {}
}
POST /review/refuse/{task_id}/{user_id}¶
审核拒绝
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| task_id | path | string | 是 | none | |
| user_id | path | string | 是 | none |
审核拒绝指定用户在指定题目上的标注结果
- 成功
200 OK
{
"code": 0,
"message": "string"
}
- 无权限
400 Bad Request
{
"code": 16,
"message": "no permissions",
"data": {}
}
404 Not Found
{
"code": 14,
"message": "task not created",
"data": {}
}
400 Bad Request
{
"code": 24,
"message": "task not distributed",
"data": {}
}
GET /review/download/{task_id}/{user_id}¶
导出单个用户的结果
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| task_id | path | string | 是 | none | |
| user_id | path | string | 是 | none |
返回指定用户在指定题目上的标注结果,为 csv 文件
- 成功
200 OK
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|---|---|---|---|---|---|
| result.csv | file | true | none | none |
- 无权限
400 Bad Request
{
"code": 16,
"message": "no permissions",
"data": {}
}
404 Not Found
{
"code": 14,
"message": "task not created",
"data": {}
}
400 Bad Request
{
"code": 24,
"message": "task not distributed",
"data": {}
}
GET /review/download/{task_id}¶
导出全部用户的结果
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| task_id | path | string | 是 | none | |
| type | query | string | 否 | none |
返回该题目的标注文件,为 csv 文件
- 成功
200 OK
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|---|---|---|---|---|---|
| result.csv | file | true | none | none |
- 无权限
400 Bad Request
{
"code": 16,
"message": "no permissions",
"data": {}
}
404 Not Found
{
"code": 14,
"message": "task not created",
"data": {}
}
400 Bad Request
{
"code": 24,
"message": "task not distributed",
"data": {}
}
400 Bad Request
{
"code": 25,
"message": "review not finish"
}
POST /review/upload_stdans¶
需求方上传部分标准答案
file: string
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| file | body | string(binary) | 否 | 一个压缩包 | none |
上传包含部分标准答案的csv文件
- 成功
200 OK
{
"code": 0,
"message": "succeed",
"data": {
"tag": "string"
}
}
data 各字段含义如下:
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|---|---|---|---|---|---|
| tag | string | true | none | 唯一标识 | none |
- csv 文件缺少或多出字段
400 Bad Request
{
"code": 20,
"message": "field error",
"data": {}
}
POST /review/report/{task_id}/{user_id}¶
上传包含部分标准答案的csv文件
请求附带 JSON 格式的正文。
样例:
{
"reason": "string"
}
正文的 JSON 包含一个字典,字典的各字段含义如下:
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| reason | body | string | 是 | 举报原因 | none |
需求方对恶意刷题作弊用户进行举报,或者标注方对恶意审核的需求方进行举报,判断举报者身份后,判断双方的身份,创建关联了题目和用户的举报申请
- 成功
200 OK
{
"code": 0,
"message": "succeed",
"data": {}
}
- 任务不存在
400 Bad Request
{
"code": 33,
"message": "task not exists"
}
404 Not Found
{
"code": 34,
"message": "user is not this task's tagger"
}
404 Not Found
{
"code": 34,
"message": "user is not this task's tagger"
}
GET /review/reportmessage¶
获取举报信息
无
管理员获取所有的举报消息,其中包含任务信息,标注者信息,和被举报人信息,若被举报人和标注者不是同一人,则意为标注者举报需求方
- 成功
200 OK
{
"code": 0,
"message": "succeed",
"data": [
{
"task_id": 0,
"task_type": "string",
"task_name": "string",
"tagger_id": 0,
"reportee_id": "string",
"reportee_name": "string",
"credit_score": 100,
"reason": "string"
}
]
}
data 各字段含义如下:
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|---|---|---|---|---|---|
| task_id | integer | true | none | 任务id | 主键,唯一标识 |
| task_type | string | true | none | 任务类型 | none |
| task_name | string | true | none | 任务名 | 长度在4-24之间的字符串 |
| tagger_id | integer | true | none | 用户id,主键 | |
| reportee_id | string | true | none | none | |
| reportee_name | string | true | none | 用户名 | |
| credit_score | integer | true | none | 信用分(恶意行为会扣除) | |
| reason | string | true | none | 举报原因 | none |
无
POST /review/acceptreport/{task_id}/{user_id}¶
审批通过举报用户
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| task_id | path | string | 是 | 任务 id | none |
| user_id | path | string | 是 | 举报方 id | none |
通过举报,扣除用户信用分
- 成功
200 OK
{
"code": 0,
"message": "succeed",
"data": {}
}
- 举报记录不存在
404 Not Found
{
"code": 35,
"message": "report record not found"
}
POST /review/rejectreport/{task_id}/{user_id}¶
通过举报,扣除用户信用分
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| task_id | path | string | 是 | 任务 id | none |
| user_id | path | string | 是 | 举报方 id | none |
拒绝举报,删除举报信息
- 成功
200 OK
{
"code": 0,
"message": "string",
"data": {}
}
无
广告相关¶
POST /advertise/publish¶
发布广告
请求附带 JSON 格式的正文。
样例:
{
"time": 0,
"type": "horizontal",
"url": "string"
}
正文的 JSON 包含一个字典,字典的各字段含义如下:
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| time | body | integer | 是 | 发布广告的时长 | none |
| type | body | string | 是 | 广告类型 | none |
| url | body | string | 是 | 图片 url | none |
花多少积分,广告获得相同秒数的有效期,单次广告上传时间不少于30分钟
- 成功
200 OK
{
"code": 0,
"message": "string",
"data": {}
}
- 积分不足
400 Bad Request
{
"code": 83,
"message": "string",
"data": {}
}
GET /advertise/get_ad¶
获取广告
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| type | query | string | 否 | 获取广告的类型 | none |
| num | query | number | 否 | 获取广告数量 | none |
从广告池中随机抽取指定格式的指定数量的图片
- 成功
200 OK
{
"code": 0,
"message": "string",
"data": [
"string"
]
}
data 各字段含义如下:
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|---|---|---|---|---|---|
| data | [string] | true | none | url的列表 |
无
GET /advertise/get_my_ad¶
获取我发布的广告
无
获取当前广告商发布过的所有广告,其他身份无权限
- 成功
200 OK
{
"code": 0,
"message": "string",
"data": [
{
"src": "string",
"expire_at": 0,
"publish_at": 0,
"ad_id": 0
}
]
}
data 各字段含义如下:
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|---|---|---|---|---|---|
| src | string | true | none | 图片地址 | |
| expire_at | integer | true | none | 过期时间 | |
| publish_at | integer | true | none | 发布时间 | |
| ad_id | integer | true | none | 广告id |
无
POST /advertise/renew/{ad_id}¶
给广告续费
请求附带 JSON 格式的正文。
样例:
{
"time": 0
}
正文的 JSON 包含一个字典,字典的各字段含义如下:
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| time | body | integer | 是 | 续费时长 | none |
花费积分给指定广告续费指定时间
- 成功
200 OK
{
"code": 0,
"message": "string",
"data": {}
}
- 积分不足
400 Bad Request
{
"code": 83,
"message": "string",
"data": {}
}
400 Bad Request
{
"code": 86,
"message": "string",
"data": {}
}
图床¶
POST /picbed/¶
上传图片
img: [ ]
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| img | body | string(binary) | 是 | 上传的图片 | none |
上传一张图片,返回该图片的url
- 成功
200 OK
{
"code": 0,
"message": "Succeed",
"data": {
"url": "string"
}
}
data 各字段含义如下:
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|---|---|---|---|---|---|
| url | string | true | none | none |
无
GET /{url}¶
获取图片
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| url | path | string | 是 | 获取图片的 url | 在上传图片时返回的url |
返回指定图床中的指定图片
- 成功
200 OK
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|---|---|---|---|---|---|
| *.jpg | image | true | none |
- 图片不存在
404 Not Found
{
"code": 18,
"message": "picture not found"
}
DELETE /{url}¶
删除图片
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| url | path | string | 是 | 图片的 url | 在上传图片时返回的url |
删除图床中的指定图片
- 成功
200 OK
{
"code": 0,
"message": "Succeed"
}
- 图片不存在
404 Not Found
{
"code": 18,
"message": "picture not found"
}
媒体床¶
POST /video/¶
上传媒体
video: [ ]
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| video | body | string(binary) | 是 | 上传的媒体文件 | none |
上传媒体文件,返回该媒体文件的url
- 成功
200 OK
{
"code": 0,
"message": "succeed",
"data": {
"url": "string"
}
}
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| url | body | string | 是 | none |
无
GET /video/{url}¶
获取媒体
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| url | path | string | 是 | 媒体的 url | none |
以流形式返回指定媒体文件
- 成功
200 OK
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|---|---|---|---|---|---|
| .mp4/.mp3 | file | true | none |
- 视频不存在
404 Not Found
{
"code": 18,
"message": "video not found"
}
DELETE /video/{url}¶
删除媒体
| 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|---|
| url | path | string | 是 | 媒体的 url | none |
删除指定媒体文件
- 成功
200 OK
{
"code": 0,
"message": "succeed",
"data": {}
}
- 视频不存在
404 Not Found
{
"code": 18,
"message": "video not found"
}