69 lines
3.0 KiB
Go
69 lines
3.0 KiB
Go
package dto
|
||
|
||
// UserWxLoginRequest 微信登录请求
|
||
type UserWxLoginRequest struct {
|
||
Code string `json:"code" binding:"required"` // 微信登录code
|
||
}
|
||
|
||
// UserWxLoginResponse 登录响应
|
||
type UserWxLoginResponse struct {
|
||
AccessToken string `json:"access_token"`
|
||
RefreshToken string `json:"refresh_token"`
|
||
ExpireTime int64 `json:"expire_time"` // access_token过期时间(秒)
|
||
UserInfo UserInfoGetBySelfResponse `json:"user_info"`
|
||
}
|
||
|
||
type UserInfoGetBySelfRequest struct{}
|
||
|
||
// UserInfoGetBySelfResponse 用户信息
|
||
type UserInfoGetBySelfResponse struct {
|
||
Username string `json:"username"`
|
||
Avatar string `json:"avatar"`
|
||
Sex int8 `json:"sex"` // 1=男 2=女
|
||
BirthDay int64 `json:"birth_day"` // 生日
|
||
Phone string `json:"phone"` // 手机号
|
||
IsNewUser bool `json:"is_new_user"` // 是否本次新注册用户
|
||
Status int8 `json:"status"` // 状态 1=正常 2=临时禁用 3=永久禁用 4=已注销
|
||
BanReason string `json:"ban_reason"` // 封禁原因
|
||
BanStart int64 `json:"ban_start"` // 封禁开始时间
|
||
BanExpire int64 `json:"ban_expire"` // 封禁到期时间
|
||
VIPType int8 `json:"vip_type"` // VIP类型 1=非会员 2=月度会员 3=年度会员 4=体验会员
|
||
VIPExpire int64 `json:"vip_expire"` // VIP到期时间
|
||
}
|
||
|
||
// UserProfileUpdateBySelfRequest 修改用户资料
|
||
type UserProfileUpdateBySelfRequest struct {
|
||
Username string `json:"username" binding:"max=32"` // 昵称
|
||
Avatar string `json:"avatar" binding:"max=500"` // 头像地址
|
||
Sex int8 `json:"sex" binding:"omitempty,oneof=0 1 2"` // 0=未知 1=男 2=女
|
||
BirthDay int64 `json:"birth_day"` // 生日
|
||
}
|
||
|
||
// UserProfileUpdateBySelfResponse 修改用户资料响应
|
||
type UserProfileUpdateBySelfResponse struct{}
|
||
|
||
// UserAvatarUploadRequest 上传头像(multipart,字段名 file)
|
||
type UserAvatarUploadRequest struct{}
|
||
|
||
// UserAvatarUploadResponse 上传头像响应
|
||
type UserAvatarUploadResponse struct {
|
||
Avatar string `json:"avatar"` // 头像可访问 URL
|
||
}
|
||
|
||
// UserRefreshTokenRequest 刷新用户token请求
|
||
type UserRefreshTokenRequest struct {
|
||
RefreshToken string `json:"refresh_token" binding:"required"`
|
||
// AccessToken 必填:旧 access token,用于刷新时立即吊销旧 access + 旧 refresh。
|
||
// 会话以 token 字符串为 key 存在 Redis 中,缺少旧 access token 无法精确删除其会话 key,
|
||
// 旧 token 会在 TTL 内继续可用;为空时返回 10000 + details:["缺少旧 access token"]。
|
||
// 注意:允许传入已过期的旧 access token(此时会话已随 TTL 消失,仅吊销旧 refresh 与集合条目)。
|
||
AccessToken string `json:"access_token"`
|
||
}
|
||
|
||
// UserRefreshTokenResponse 刷新用户token响应
|
||
type UserRefreshTokenResponse struct {
|
||
AccessToken string `json:"access_token"`
|
||
RefreshToken string `json:"refresh_token"`
|
||
ExpireTime int64 `json:"expire_time"` // access_token过期时间(秒)
|
||
}
|