2024-12-01 11:06:09 +08:00
|
|
|
package user
|
|
|
|
|
2024-12-01 12:00:49 +08:00
|
|
|
import "context"
|
|
|
|
|
2024-12-01 11:06:09 +08:00
|
|
|
type Service interface {
|
2024-12-01 14:54:54 +08:00
|
|
|
AdminService
|
|
|
|
UserService
|
|
|
|
}
|
|
|
|
|
|
|
|
type AdminService interface {
|
|
|
|
// 更新用户状态
|
|
|
|
UpdateUserStatus(context.Context, *UpdateUserStatusRequest) (*User, error)
|
2024-12-01 17:17:51 +08:00
|
|
|
// 查询某个具体的用户详情
|
|
|
|
DescribeUser(context.Context, *DescribeUserRequest) (*User, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
// UserId Or Username
|
|
|
|
type DescribeUserRequest struct {
|
|
|
|
DescribeBy DESCRIBE_BY `json:"describe_by"`
|
|
|
|
Value string `json:"value"`
|
2024-12-01 14:54:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
type UserService interface {
|
2024-12-01 11:06:09 +08:00
|
|
|
// 注册
|
2024-12-01 12:00:49 +08:00
|
|
|
Registry(context.Context, *RegistryRequest) (*User, error)
|
|
|
|
|
|
|
|
// 用户更新
|
|
|
|
// 用户秘密更新, 安全等级弱, 用于已经提供了原来的密码
|
|
|
|
UpdatePassword(context.Context, *UpdatePasswordRequest) error
|
|
|
|
// 忘了密码,需要重置, 安全等级高,有很多限制条件
|
|
|
|
ResetPassword(context.Context, *ResetPasswordRequest) error
|
|
|
|
// 更新Profile信息, 邮箱之类的
|
|
|
|
UpdateProfile(context.Context, *UpdateProfileRequest) (*User, error)
|
|
|
|
|
2024-12-01 11:06:09 +08:00
|
|
|
// 注销
|
2024-12-01 12:00:49 +08:00
|
|
|
UnRegistry(context.Context, *UnRegistryRequest)
|
|
|
|
}
|
|
|
|
|
2024-12-01 14:54:54 +08:00
|
|
|
type UpdateUserStatusRequest struct {
|
|
|
|
// 用户Id
|
|
|
|
UserId string `json:"user_id"`
|
|
|
|
//
|
|
|
|
Status
|
|
|
|
}
|
|
|
|
|
2024-12-01 12:00:49 +08:00
|
|
|
type UpdateProfileRequest struct {
|
|
|
|
// 用户Id
|
|
|
|
UserId string `json:"user_id"`
|
|
|
|
// 需要更新的Profile
|
|
|
|
Profile
|
|
|
|
}
|
|
|
|
|
|
|
|
type UpdatePasswordRequest struct {
|
|
|
|
// 用户名
|
|
|
|
Username string `json:"username"`
|
|
|
|
// 原来的密码
|
|
|
|
OldPassword string `json:"old_password"`
|
|
|
|
// 新的密码
|
|
|
|
NewPassword string `json:"new_password"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type ResetPasswordRequest struct {
|
|
|
|
// 用户名
|
|
|
|
Username string `json:"username"`
|
|
|
|
// 新的密码
|
|
|
|
NewPassword string `json:"new_password"`
|
|
|
|
// 验证码
|
|
|
|
VerifyCode string `json:"verify_code"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type UnRegistryRequest struct {
|
|
|
|
// 用户名
|
|
|
|
Username string `json:"username"`
|
2024-12-01 11:06:09 +08:00
|
|
|
}
|