API参考
认证接口
登录接口
接口地址:/api/sysAuth/Login
请求方法:POST
请求参数:
| 参数名 | 类型 | 必需 | 描述 |
|---|---|---|---|
| account | string | 是 | 账号 |
| password | string | 是 | 加密后的密码 |
| code | string | 是 | 验证码 |
| codeId | number | 是 | 验证码ID |
响应格式:
json
{
"type": "success",
"result": {
"accessToken": "...",
"refreshToken": "..."
}
}获取验证码
接口地址:/api/sysAuth/captcha
请求方法:GET
响应格式:
json
{
"type": "success",
"result": {
"id": 123,
"img": "base64编码的图片"
}
}获取用户信息
接口地址:/api/sysAuth/userInfo
请求方法:GET
请求头:
- Authorization: Bearer
响应格式:
json
{
"type": "success",
"result": {
"userName": "...",
"roles": ["user", "vip"]
}
}其他接口
接口规范
- 所有接口返回格式统一
- 成功响应:
{"type": "success", "result": {...}} - 失败响应:
{"type": "error", "message": "错误信息"}
错误码
| 错误码 | 描述 |
|---|---|
| 401 | 未授权 |
| 403 | 无权限 |
| 404 | 资源不存在 |
| 500 | 服务器内部错误 |