first commit
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
package dto
|
||||
|
||||
// AdminLoginRequest 管理员登录请求。
|
||||
type AdminLoginRequest struct {
|
||||
Username string `json:"username" binding:"required,max=32"`
|
||||
Password string `json:"password" binding:"required,min=6,max=64"`
|
||||
}
|
||||
|
||||
// AdminInfo 管理员信息。
|
||||
type AdminInfo struct {
|
||||
ID int64 `json:"id"`
|
||||
Username string `json:"username"`
|
||||
Nickname string `json:"nickname"`
|
||||
Role int8 `json:"role"` // 1=超级管理员 2=普通管理员
|
||||
Status int8 `json:"status"` // 1=启用 2=禁用
|
||||
LastLoginTime int64 `json:"last_login_time"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
}
|
||||
|
||||
// AdminLoginResponse 登录响应(双 token + 管理员信息)。
|
||||
type AdminLoginResponse struct {
|
||||
AccessToken string `json:"access_token"`
|
||||
RefreshToken string `json:"refresh_token"`
|
||||
ExpireTime int64 `json:"expire_time"` // access_token 过期时间(秒)
|
||||
AdminInfo AdminInfo `json:"admin_info"`
|
||||
}
|
||||
|
||||
// AdminRefreshTokenRequest 刷新 token 请求。
|
||||
type AdminRefreshTokenRequest struct {
|
||||
RefreshToken string `json:"refresh_token" binding:"required"`
|
||||
AccessToken string `json:"access_token"` // 可选:传入后立即吊销旧 access token
|
||||
}
|
||||
|
||||
// AdminRefreshTokenResponse 刷新 token 响应。
|
||||
type AdminRefreshTokenResponse struct {
|
||||
AccessToken string `json:"access_token"`
|
||||
RefreshToken string `json:"refresh_token"`
|
||||
ExpireTime int64 `json:"expire_time"`
|
||||
}
|
||||
|
||||
// AdminChangePasswordRequest 修改自己密码请求。
|
||||
type AdminChangePasswordRequest struct {
|
||||
OldPassword string `json:"old_password" binding:"required,min=6,max=64"`
|
||||
NewPassword string `json:"new_password" binding:"required,min=6,max=64"`
|
||||
}
|
||||
|
||||
// AdminListRequest 管理员列表请求。
|
||||
type AdminListRequest struct {
|
||||
PageRequest
|
||||
Status int8 `form:"status" binding:"omitempty,oneof=1 2"` // 1=启用 2=禁用;不传=全部
|
||||
}
|
||||
|
||||
// AdminListResponse 管理员列表响应。
|
||||
type AdminListResponse struct {
|
||||
PageResponse
|
||||
List []AdminInfo `json:"list"`
|
||||
}
|
||||
|
||||
// AdminCreateRequest 创建管理员请求(仅超级管理员)。
|
||||
type AdminCreateRequest struct {
|
||||
Username string `json:"username" binding:"required,min=3,max=32"`
|
||||
Password string `json:"password" binding:"required,min=6,max=64"`
|
||||
Nickname string `json:"nickname" binding:"omitempty,max=32"`
|
||||
Role int8 `json:"role" binding:"required,oneof=1 2"`
|
||||
}
|
||||
|
||||
// AdminUpdateRequest 更新管理员请求(仅超级管理员;传什么改什么)。
|
||||
type AdminUpdateRequest struct {
|
||||
Nickname string `json:"nickname" binding:"omitempty,max=32"`
|
||||
Password string `json:"password" binding:"omitempty,min=6,max=64"`
|
||||
Role int8 `json:"role" binding:"omitempty,oneof=1 2"`
|
||||
Status int8 `json:"status" binding:"omitempty,oneof=1 2"`
|
||||
}
|
||||
Reference in New Issue
Block a user