service.xpcool.com/api/user/auth/auth.go

34 lines
1.4 KiB
Go
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.

// Package user_auth 定义用户端认证接口(登录/刷新),路由前缀 /api。
package user_auth
import "github.com/gogf/gf/v2/frame/g"
// LoginReq 用户登录请求(支持微信/手机验证码/账号密码三种方式)。
type LoginReq struct {
g.Meta `path:"/auth/login" method:"post" tags:"User/Auth" summary:"用户登录"`
LoginType string `json:"loginType" v:"required|in:wechat,mobile,password#login type required|unsupported login type"`
Code string `json:"code"` // 微信授权码
Mobile string `json:"mobile"` // 手机号mobile 登录方式)
VerifyCode string `json:"verifyCode"` // 短信验证码
Account string `json:"account"` // 账号password 登录方式)
Password string `json:"password"` // 密码
Terminal string `json:"terminal" v:"required|in:mini,h5,app#terminal required|invalid terminal"`
}
// LoginRes 用户登录响应。
type LoginRes struct {
AccessToken string `json:"accessToken"`
RefreshToken string `json:"refreshToken"`
ExpiresIn int64 `json:"expiresIn"`
UserID uint64 `json:"userId"`
}
// RefreshReq 使用刷新令牌轮换用户令牌对。
type RefreshReq struct {
g.Meta `path:"/auth/refresh" method:"post" tags:"User/Auth" summary:"轮换用户令牌"`
RefreshToken string `json:"refreshToken" v:"required"`
}
// RefreshRes 是 RefreshReq 的响应。
type RefreshRes LoginRes