Skip to content

User 接口

源码:src/business/controller/user/index.ts
前缀:/api/user

接口一览

方法路径鉴权说明
POST/loginignore登录,返回 token 等
POST/logoutignore退出
GET/check_loginignore检查登录态
GET/profile登录当前用户资料
POST/profile/update登录 + RepeatSubmit改资料
POST/profile/password登录 + RepeatSubmit改密码
POST/page登录用户分页
POST/createROLE_admin + system:user:create + RepeatSubmit创建
POST/updateROLE_admin + system:user:update + RepeatSubmit修改
POST/get/:idsystem:user:read + RateLimiter(IP)详情
GET/get_role/:id登录用户角色
POST/bind_roleROLE_admin绑定角色
POST/delete/:idROLE_admin + system:user:delete删除

写操作多带 @Log;创建接口示例使用 @Validate() + CreateUserDTO;详情接口示例限流:time=10, count=3, type=IP

校验与序列化见 ValidateJson

登录示例

http
POST /api/user/login
Content-Type: application/json

{
  "username": "admin",
  "password": "******"
}

后续请求:

http
Authorization: <token>

(也可使用 Bearer <token>,取决于 AuthtokenPrefix;当前入口默认空前缀。)

分层文件

路径
Controllerbusiness/controller/user
Servicebusiness/service/user.ts
Mapper / Entitybusiness/mapper/user*entity/user*

基于 VitePress 构建