注册api
/api/login?username=test1&password=123456
参数
username (required)
password (required)
如果用户名或者密码参数为空
{
status: 0,
msg: "用户名和密码皆不可为空"
}
如果用户名已经存在
{
status: 0,
msg: "用户名已经存在"
}
成功注册返回id
{
status: 1,
id: 10
}
登录api
/api/login?username=test1&password=123456
参数
username (required)
password (required)
如果用户名或者密码为空
{
status: 0,
msg: "用户名和密码皆不可为空"
}
密码不正确
{
status: 0,
msg: "密码不正确"
}
成功登录
{
status: 1,
msg: "登录成功"
}
退出登录api
/api/logout
{
status: 1,
msg: "登出成功"
}
评论api
添加评论
参数
question_id
answer_id
reply_to
(三选一 必须) 优先级 question_id > answer_id >reply_to
content 必须
reply_to
/api/comment/add/content=reply_to测试回复&reply_to=4
question_id
/api/comment/add/content=reply_to测试回复&question_id=4
answer_id
/api/comment/add/content=reply_to测试回复&answer_id=4
question_id or answer_id or reply_id 都没有,返回
{
status: 0,
msg: "question_id or answer_id or reply_to is required"
}
没有content,返回
{
status: 0,
msg: "content is required"
}
不允许reply_to 自己的评论,返回
{
status: 0,
msg: "cannot reply to yourself"
}
成功评论,返回id
{
status: 1,
id: 6
}