签入版本
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
|
||||
```bash
|
||||
# GET 请求获取验证码(返回 Base64 编码的图片 + 验证码 key)
|
||||
curl http://localhost:8000/api/captcha
|
||||
curl http://admin.laravel13.naivevue/api/captcha
|
||||
```
|
||||
|
||||
响应示例:
|
||||
@@ -52,7 +52,7 @@ curl http://localhost:8000/api/captcha
|
||||
# password → 密码
|
||||
# key → 步骤一返回的验证码 key(与 captcha 响应字段命名一致)
|
||||
# code → 验证码图片上显示的字符
|
||||
curl -X POST http://localhost:8000/api/login \
|
||||
curl -X POST http://admin.laravel13.naivevue/api/login \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"username": "admin",
|
||||
@@ -100,7 +100,7 @@ curl -X POST http://localhost:8000/api/login \
|
||||
# -----------------------------------------------------------------------------
|
||||
# pageNo=1\&pageSize=10 → 分页参数(\& 是 bash 转义,防止 & 被解释为后台运行符)
|
||||
# -H "Authorization: Bearer <token>" → 在请求头中携带 JWT Token
|
||||
curl "http://localhost:8000/api/user/page?pageNo=1&pageSize=10" \
|
||||
curl "http://admin.laravel13.naivevue/api/user/page?pageNo=1&pageSize=10" \
|
||||
-H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..."
|
||||
```
|
||||
|
||||
@@ -136,33 +136,33 @@ curl "http://localhost:8000/api/user/page?pageNo=1&pageSize=10" \
|
||||
# -----------------------------------------------------------------------------
|
||||
# 获取当前登录用户信息
|
||||
# -----------------------------------------------------------------------------
|
||||
curl http://localhost:8000/api/index/getUser \
|
||||
curl http://admin.laravel13.naivevue/api/index/getUser \
|
||||
-H "Authorization: Bearer <your_token>"
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# 获取当前用户的菜单列表(用于前端动态路由)
|
||||
# -----------------------------------------------------------------------------
|
||||
curl http://localhost:8000/api/index/getMenus \
|
||||
curl http://admin.laravel13.naivevue/api/index/getMenus \
|
||||
-H "Authorization: Bearer <your_token>"
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# 获取字典项(gender = 性别字典的编码)
|
||||
# -----------------------------------------------------------------------------
|
||||
curl http://localhost:8000/api/dict/item/getDictItemList/gender \
|
||||
curl http://admin.laravel13.naivevue/api/dict/item/getDictItemList/gender \
|
||||
-H "Authorization: Bearer <your_token>"
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# 刷新 Token(access_token 过期后,用 refresh_token 换取新的令牌对)
|
||||
# -----------------------------------------------------------------------------
|
||||
# refresh 为公开接口(无需 access_token)
|
||||
curl -X POST http://localhost:8000/api/refresh \
|
||||
curl -X POST http://admin.laravel13.naivevue/api/refresh \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"refresh_token": "<your_refresh_token>"}'
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# 登出(令牌即时失效,需携带 access_token)
|
||||
# -----------------------------------------------------------------------------
|
||||
curl -X POST http://localhost:8000/api/logout \
|
||||
curl -X POST http://admin.laravel13.naivevue/api/logout \
|
||||
-H "Authorization: Bearer <your_token>"
|
||||
```
|
||||
|
||||
@@ -224,7 +224,7 @@ HTTP 状态码为 200,前端据 body `code=401` 触发跳转登录。
|
||||
## ApiFox 配置建议
|
||||
|
||||
1. 创建环境,设置变量:
|
||||
- `base_url` = `http://localhost:8000`
|
||||
- `base_url` = `http://admin.laravel13.naivevue`
|
||||
- `token` = 登录后填入 access_token
|
||||
|
||||
2. 在请求头中使用变量:
|
||||
|
||||
Reference in New Issue
Block a user