You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.7 KiB
50 lines
1.7 KiB
syntax = "v1"
|
|
|
|
// ========== 类型定义 ==========
|
|
type (
|
|
// 创建用户请求
|
|
CreateUserRequest {
|
|
Username string `json:"username" validate:"required,min=3,max=32"` // 用户名
|
|
Email string `json:"email" validate:"required,email"` // 邮箱
|
|
Password string `json:"password" validate:"required,min=6,max=32"` // 密码
|
|
Phone string `json:"phone,optional"` // 手机号
|
|
}
|
|
// 用户信息
|
|
UserInfo {
|
|
Id int64 `json:"id"` // 用户ID
|
|
Username string `json:"username"` // 用户名
|
|
Email string `json:"email"` // 邮箱
|
|
Phone string `json:"phone"` // 手机号
|
|
Status int `json:"status"` // 状态 1-正常 2-禁用
|
|
CreatedAt string `json:"createdAt"` // 创建时间
|
|
UpdatedAt string `json:"updatedAt"` // 更新时间
|
|
}
|
|
// 更新用户请求
|
|
UpdateUserRequest {
|
|
Id int64 `path:"id" validate:"required,min=1"` // 用户ID
|
|
Username string `json:"username,optional"` // 用户名
|
|
Email string `json:"email,optional"` // 邮箱
|
|
Phone string `json:"phone,optional"` // 手机号
|
|
Status int `json:"status,optional"` // 状态
|
|
}
|
|
// 用户列表查询请求
|
|
UserListRequest {
|
|
Page int `form:"page,default=1"` // 页码
|
|
PageSize int `form:"pageSize,default=10"` // 每页数量
|
|
Keyword string `form:"keyword,optional"` // 关键词搜索
|
|
Status int `form:"status,optional"` // 状态筛选
|
|
}
|
|
// 用户列表响应
|
|
UserListResponse {
|
|
Total int64 `json:"total"` // 总数
|
|
List []UserInfo `json:"list"` // 用户列表
|
|
}
|
|
// 删除用户请求
|
|
DeleteUserRequest {
|
|
Id int64 `path:"id" validate:"required,min=1"` // 用户ID
|
|
}
|
|
// 获取用户详情请求
|
|
GetUserRequest {
|
|
Id int64 `path:"id" validate:"required,min=1"` // 用户ID
|
|
}
|
|
)
|
|
|