Files
easygoadmin-wiki/EasyGoAdmin_Gin_NaiveVue/zh/appendix/api-cheatsheet.md
T
2026-10-25 17:24:27 +08:00

75 lines
3.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# E. API 接口速查表
:::tip 说明
按模块速查接口形态。标准 CRUD 按统一模式列出;实际清单以 /api.json 与 /swagger 为准(运行时生成)。
:::
## 标准模式(多数模块)
| 动作 | 方法与路径模式 | 权限码模式 |
|---|---|---|
| 分页 | GET /api/{模块}/page | sys:{模块}:page |
| 列表 | GET /api/{模块}/list | sys:{模块}:list |
| 详情 | GET /api/{模块}/detail/:id | sys:{模块}:detail |
| 新增 | POST /api/{模块}/add | sys:{模块}:add |
| 修改 | PUT /api/{模块}/update | sys:{模块}:update |
| 删除 | DELETE /api/{模块}/delete/:id | sys:{模块}:delete |
| 批量删除 | DELETE /api/{模块}/batchDelete | sys:{模块}:batchDelete |
## 认证与个人中心
| 接口 | 说明 |
|---|---|
| GET /api/captcha | 验证码(公开) |
| POST /api/login | 登录(公开) |
| POST /api/oauth2/token | 刷新/兑换(公开) |
| GET /api/oauth2/check/token | 校验令牌 |
| DELETE /api/oauth2/remove/:token | 撤销令牌 |
| GET /api/logout | 登出 |
| GET /api/index/getUser / getMenus | 当前用户/菜单 |
| PUT /api/index/updatePassword / updateProfile | 改密/资料 |
| GET /api/health | 健康检查(公开) |
## 模块域名对照
| 域 | 路径前缀 |
|---|---|
| 组织权限 | /api/user、/api/role、/api/menu、/api/dept、/api/level、/api/position、/api/tenant |
| 内容 | /api/article、/api/category、/api/notice、/api/link |
| 数据配置 | /api/dict(字典项 /api/dict/item/*、业务别名 /api/dictionary/*)、/api/param、/api/config(配置项 /api/config/item/*、网站配置 /api/config/web/*)、/api/city |
| 定时任务 | /api/job(任务日志 /api/job/log/*) |
| 在线用户 | /api/onlineUser |
| 日志(特殊前缀) | 操作日志 /api/oper/log/*、登录日志 /api/login/log/*(权限码 sys:operLog:* / sys:loginLog:*) |
| 监控(单接口) | GET /api/server/info、GET /api/cache/info |
| 文件 | /api/upload/uploadFile(s)、/api/file/template/* |
| 工具 | /api/example/*、/api/generator/*(page/preview/generate/batchGenerate) |
## 常用非标准接口
| 接口 | 说明 |
|---|---|
| PUT /api/example/status | 单列状态(status 型模块同构) |
| POST /api/example/import / GET /api/example/export | 导入导出 |
| PUT /api/user/resetPwd | 重置用户密码 |
| GET /api/user/document/:id | 用户打印信息 |
| POST /api/role/menu/save | 保存角色菜单权限 |
| POST /api/tenant/account | 添加租户账号 |
| GET /api/tenant/users/:tenantId | 查询租户用户 |
| GET /api/dict/item/getDictItemList/:code | 字典项快捷查询(登录即可) |
| GET /api/dict/refreshCache | 刷新字典缓存 |
| GET /api/job/runOnce/:id、pause/:id、resume/:id | 任务执行/暂停/恢复 |
| GET /api/onlineUser/forceLogout/:id | 强制下线指定会话 |
| GET /api/onlineUser/forceLogoutUser/:userId | 踢出用户全部设备 |
注:用户的角色分配没有独立接口——Add/Update 请求的 `roles` 字段在事务内重写 gin_user_role。
## 约定提醒
- 请求/响应字段小驼峰;分页 pageNo/pageSize → PageData
- 信封 0/1/401;Bearer access token
- 精确清单与 schema:`GET /api.json`
## 相关
- [8.8 API 接口总览](/zh/api-spec/overview.html)