| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241 |
- # 由 openapi/scripts/generate.php 生成,请勿手改;补充写到 overrides/v2-user-user.yaml
- get:
- summary: 查看单个用户
- tags:
- - user
- operationId: get_api_v2_user_user_
- description: |-
- 按 userid 查询用户资料并返回(id、用户名、昵称、邮箱、角色、头像等)。
- 方法内没有任何鉴权,任何人都可以读取;查不到用户时会以空资源返回。
- 实现:`UserController@show`
- parameters:
- -
- name: user
- in: path
- required: true
- schema:
- type: integer
- description: '用户的 userid(不是表自增主键 id)'
- responses:
- 200:
- description: '成功。业务失败时 HTTP 仍可能为 200,以 ok 字段为准。'
- content:
- application/json:
- schema:
- type: object
- properties:
- ok:
- type: boolean
- message:
- type: string
- data:
- type: object
- properties:
- id:
- type: integer
- userName:
- type: string
- nickName:
- type: string
- email:
- type: string
- role:
- type: string
- created_at:
- type: string
- updated_at:
- type: string
- avatarName:
- type: string
- avatar:
- type: string
- 401:
- $ref: '../../main.yaml#/components/responses/Unauthorized'
- 422:
- $ref: '../../main.yaml#/components/responses/ValidationError'
- put:
- summary: 更新用户资料或角色
- tags:
- - user
- operationId: put_api_v2_user_user_
- description: |-
- 两种互斥的用法:请求体里带 roles 时只更新角色(整体覆盖,以 JSON 存入 role 字段);
- 不带 roles 时更新昵称、头像、邮箱三个字段(未传的会被置空)。
- 方法内没有任何鉴权,也没有校验,调用方需自行保证权限;userid 不存在时会报错。
- 实现:`UserController@update`
- parameters:
- -
- name: user
- in: path
- required: true
- schema:
- type: integer
- description: '用户的 userid(不是表自增主键 id)'
- requestBody:
- required: false
- content:
- application/json:
- schema:
- type: object
- properties:
- roles:
- type: array
- description: 角色列表,传了就只更新角色,整体覆盖原有角色
- nickName:
- type: string
- description: '昵称,未传 roles 时生效'
- avatar:
- type: string
- description: '头像文件名,未传 roles 时生效'
- email:
- type: string
- description: '邮箱,未传 roles 时生效'
- responses:
- 200:
- description: '成功。业务失败时 HTTP 仍可能为 200,以 ok 字段为准。'
- content:
- application/json:
- schema:
- type: object
- properties:
- ok:
- type: boolean
- message:
- type: string
- data:
- type: object
- properties:
- id:
- type: integer
- userName:
- type: string
- nickName:
- type: string
- email:
- type: string
- role:
- type: string
- created_at:
- type: string
- updated_at:
- type: string
- avatarName:
- type: string
- avatar:
- type: string
- 401:
- $ref: '../../main.yaml#/components/responses/Unauthorized'
- 422:
- $ref: '../../main.yaml#/components/responses/ValidationError'
- patch:
- summary: 更新用户资料或角色
- tags:
- - user
- operationId: patch_api_v2_user_user_
- description: |-
- 两种互斥的用法:请求体里带 roles 时只更新角色(整体覆盖,以 JSON 存入 role 字段);
- 不带 roles 时更新昵称、头像、邮箱三个字段(未传的会被置空)。
- 方法内没有任何鉴权,也没有校验,调用方需自行保证权限;userid 不存在时会报错。
- 实现:`UserController@update`
- parameters:
- -
- name: user
- in: path
- required: true
- schema:
- type: integer
- description: '用户的 userid(不是表自增主键 id)'
- requestBody:
- required: false
- content:
- application/json:
- schema:
- type: object
- properties:
- roles:
- type: array
- description: 角色列表,传了就只更新角色,整体覆盖原有角色
- nickName:
- type: string
- description: '昵称,未传 roles 时生效'
- avatar:
- type: string
- description: '头像文件名,未传 roles 时生效'
- email:
- type: string
- description: '邮箱,未传 roles 时生效'
- responses:
- 200:
- description: '成功。业务失败时 HTTP 仍可能为 200,以 ok 字段为准。'
- content:
- application/json:
- schema:
- type: object
- properties:
- ok:
- type: boolean
- message:
- type: string
- data:
- type: object
- properties:
- id:
- type: integer
- userName:
- type: string
- nickName:
- type: string
- email:
- type: string
- role:
- type: string
- created_at:
- type: string
- updated_at:
- type: string
- avatarName:
- type: string
- avatar:
- type: string
- 401:
- $ref: '../../main.yaml#/components/responses/Unauthorized'
- 422:
- $ref: '../../main.yaml#/components/responses/ValidationError'
- delete:
- summary: 删除用户(未实现)
- tags:
- - user
- operationId: delete_api_v2_user_user_
- description: |-
- 路由已注册 DELETE /api/v2/user/{user},但方法体为空,不会删除任何数据也不返回内容。
- 实现:`UserController@destroy`
- parameters:
- -
- name: user
- in: path
- required: true
- schema:
- type: integer
- description: '用户的 userid'
- responses:
- 200:
- description: '成功。业务失败时 HTTP 仍可能为 200,以 ok 字段为准。'
- content:
- application/json:
- schema:
- type: object
- properties:
- ok:
- type: boolean
- message:
- type: string
- data:
- type: object
- 401:
- $ref: '../../main.yaml#/components/responses/Unauthorized'
- 422:
- $ref: '../../main.yaml#/components/responses/ValidationError'
|