Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateUserRequest ¶
type CreateUserRequest struct {
*token.Session
Account string `bson:"account" json:"account,omitempty" validate:"required,lte=60"` // 用户账号名称
Mobile string `bson:"mobile" json:"mobile,omitempty" validate:"lte=30"` // 手机号码, 用户可以通过手机进行注册和密码找回, 还可以通过手机号进行登录
Email string `bson:"email" json:"email,omitempty" validate:"lte=30"` // 邮箱, 用户可以通过邮箱进行注册和照明密码
Phone string `bson:"phone" json:"phone,omitempty" validate:"lte=30"` // 用户的座机号码
Address string `bson:"address" json:"address,omitempty" validate:"lte=120"` // 用户住址
RealName string `bson:"real_name" json:"real_name,omitempty" validate:"lte=10"` // 用户真实姓名
NickName string `bson:"nick_name" json:"nick_name,omitempty" validate:"lte=30"` // 用户昵称, 用于在界面进行展示
Gender string `bson:"gender" json:"gender,omitempty" validate:"lte=10"` // 性别
Avatar string `bson:"avatar" json:"avatar,omitempty" validate:"lte=300"` // 头像
Language string `bson:"language" json:"language,omitempty" validate:"lte=40"` // 用户使用的语言
City string `bson:"city" json:"city,omitempty" validate:"lte=40"` // 用户所在的城市
Province string `bson:"province" json:"province,omitempty" validate:"lte=40"` // 用户所在的省
ExpiresDays int `bson:"expires_days" json:"expires_days,omitempty"` // 用户多久未登录时(天), 冻结改用户, 防止僵尸用户的账号被利用
Password string `bson:"-" json:"password,omitempty" validate:"required,lte=80"` // 密码相关信息
}
CreateUserRequest 创建用户请求
func NewCreateUserRequest ¶
func NewCreateUserRequest() *CreateUserRequest
NewCreateUserRequest 创建请求
func (*CreateUserRequest) Validate ¶
func (req *CreateUserRequest) Validate() error
Validate 校验请求是否合法
type DescriptAccountRequest ¶
type DescriptAccountRequest struct {
ID string `json:"id,omitempty"`
Account string `json:"account,omitempty"`
}
DescriptAccountRequest 查询用户详情请求
func NewDescriptAccountRequest ¶
func NewDescriptAccountRequest() *DescriptAccountRequest
NewDescriptAccountRequest 查询详情请求
func NewDescriptAccountRequestWithID ¶
func NewDescriptAccountRequestWithID(id string) *DescriptAccountRequest
NewDescriptAccountRequestWithID 查询详情请求
func (*DescriptAccountRequest) String ¶
func (req *DescriptAccountRequest) String() string
func (*DescriptAccountRequest) Validate ¶
func (req *DescriptAccountRequest) Validate() error
Validate 校验详情查询
type Password ¶
type Password struct {
Password string `bson:"password" json:"password,omitempty"` // hash过后的密码
ExpireAt ftime.Time `bson:"expire_at" json:"expire_at,omitempty" ` // 密码过期时间
CreateAt ftime.Time `bson:"create_at" json:"create_at,omitempty" ` // 密码创建时间
UpdateAt ftime.Time `bson:"update_at" json:"update_at,omitempty"` // 密码更新时间
}
Password user's password
func NewHashedPassword ¶
NewHashedPassword 生产hash后的密码对象
func (*Password) CheckPassword ¶
CheckPassword 判断password 是否正确
type QueryAccountRequest ¶
type QueryAccountRequest struct {
*request.PageRequest
*DescriptAccountRequest
DomainID string `json:"domain_id,omitempty"`
ProjectID string `json:"project_id,omitempty"`
}
QueryAccountRequest 获取子账号列表
func NewQueryAccountRequest ¶
func NewQueryAccountRequest(pageReq *request.PageRequest) *QueryAccountRequest
NewQueryAccountRequest 列表查询请求
type Service ¶
type Service interface {
// 查询用户
QueryAccount(types.Type, *QueryAccountRequest) (*Set, error)
// 创建用户
CreateAccount(types.Type, *CreateUserRequest) (*User, error)
// 更新用户密码
UpdateAccountPassword(userName, oldPass, newPass string) error
// 获取账号Profile
DescribeAccount(req *DescriptAccountRequest) (*User, error)
// 警用账号
BlockAccount(id, reason string) error
// DeleteAccount 删除用户
DeleteAccount(id string) error
}
Service 用户服务
type Set ¶
type Set struct {
*request.PageRequest
Total int64 `json:"total"`
Items []*User `json:"items"`
}
Set 用户列表
type Status ¶
type Status struct {
Locked bool `bson:"locked" json:"locked"` // 是否冻结
LockedTime ftime.Time `bson:"locked_time" json:"locked_time,omitempty"` // 冻结时间
LockedReson string `bson:"locked_reson" json:"locked_reson,omitempty"` // 冻结原因
UnLockTime ftime.Time `bson:"unlock_time" json:"unlock_time,omitempty"` // 解冻时间
}
Status 用户状态
type User ¶
type User struct {
ID string `bson:"_id" json:"id,omitempty"` // 用户UUID
CreateAt ftime.Time `bson:"create_at" json:"create_at,omitempty"` // 用户创建的时间
UpdateAt ftime.Time `bson:"update_at" json:"update_at,omitempty"` // 修改时间
DomainID string `bson:"domain_id" json:"domain_id,omitempty"` // 如果是子账号和服务账号 都需要继承主用户Domain
Type types.Type `bson:"type" json:"type"` // 是否是主账号
*CreateUserRequest `bson:",inline"`
HashedPassword *Password `bson:"password" json:"password,omitempty"` // 密码相关信息
Status *Status `bson:"status" json:"status,omitempty"` // 用户状态
}
User info
Click to show internal directories.
Click to hide internal directories.