134 lines
3.0 KiB
YAML
134 lines
3.0 KiB
YAML
basePath: /
|
||
definitions:
|
||
common.User:
|
||
properties:
|
||
avatar:
|
||
type: string
|
||
created_at:
|
||
type: string
|
||
gender:
|
||
type: integer
|
||
id:
|
||
type: integer
|
||
nick_name:
|
||
type: string
|
||
password:
|
||
type: string
|
||
phone:
|
||
type: string
|
||
wx_session:
|
||
type: string
|
||
wx_union_id:
|
||
type: string
|
||
type: object
|
||
user.LoginRequest:
|
||
properties:
|
||
captcha:
|
||
type: string
|
||
password:
|
||
type: string
|
||
phone:
|
||
type: string
|
||
wx_code:
|
||
type: string
|
||
type: object
|
||
user.LoginResponse:
|
||
properties:
|
||
code:
|
||
type: integer
|
||
expire:
|
||
type: string
|
||
message:
|
||
type: string
|
||
token:
|
||
type: string
|
||
type: object
|
||
user.Response-common_User:
|
||
properties:
|
||
code:
|
||
type: integer
|
||
data:
|
||
$ref: '#/definitions/common.User'
|
||
message:
|
||
type: string
|
||
type: object
|
||
user.Response-string:
|
||
properties:
|
||
code:
|
||
type: integer
|
||
data:
|
||
type: string
|
||
message:
|
||
type: string
|
||
type: object
|
||
info:
|
||
contact:
|
||
name: oneCat-user
|
||
description: 这是一个用户和登录相关的接口文档
|
||
license:
|
||
name: Apache 2.0
|
||
url: http://www.apache.org/licenses/LICENSE-2.0.html
|
||
title: 用户和登录相关接口
|
||
version: "1.0"
|
||
paths:
|
||
/api/v1/login:
|
||
post:
|
||
consumes:
|
||
- application/json
|
||
description: 如果是微信登录,需要传递 WXcode和手机号,然后调用微信接口获取 openid 和 unionid。
|
||
parameters:
|
||
- description: 请求参数
|
||
in: body
|
||
name: request
|
||
required: true
|
||
schema:
|
||
$ref: '#/definitions/user.LoginRequest'
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: 成功响应
|
||
schema:
|
||
$ref: '#/definitions/user.LoginResponse'
|
||
summary: 登录接口
|
||
tags:
|
||
- 用户模块
|
||
/api/v1/user:
|
||
get:
|
||
consumes:
|
||
- application/json
|
||
description: 通过手机号获取用户信息,只返回用户的昵称、电话、性别、ID、创建时间和头像
|
||
parameters:
|
||
- description: 用户手机号
|
||
in: query
|
||
name: phone
|
||
required: true
|
||
type: string
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: 成功响应
|
||
schema:
|
||
$ref: '#/definitions/user.Response-common_User'
|
||
"400":
|
||
description: 请求参数错误
|
||
schema:
|
||
$ref: '#/definitions/user.Response-string'
|
||
"404":
|
||
description: 用户不存在
|
||
schema:
|
||
$ref: '#/definitions/user.Response-string'
|
||
"500":
|
||
description: 服务器内部错误
|
||
schema:
|
||
$ref: '#/definitions/user.Response-string'
|
||
security:
|
||
- ApiKeyAuth: []
|
||
summary: 获取用户信息接口
|
||
tags:
|
||
- 用户模块
|
||
schemes:
|
||
- http
|
||
swagger: "2.0"
|