|
|
|
|
package user
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"cls/pkg/util/page"
|
|
|
|
|
"xorm.io/builder"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// UserRepository 用户仓储接口
|
|
|
|
|
type UserRepository interface {
|
|
|
|
|
// Save 保存用户(包含Profile)
|
|
|
|
|
Save(user *User) error
|
|
|
|
|
|
|
|
|
|
//SetPassword 设置密码
|
|
|
|
|
SetPassword(phone string, ePhone string, pwd string) error
|
|
|
|
|
|
|
|
|
|
// FindByUsername 根据用户名查找用户
|
|
|
|
|
FindByUsername(username string) (*User, error)
|
|
|
|
|
|
|
|
|
|
UpdateUserInfo(user *User) error
|
|
|
|
|
//UpdateUserGiftCount 更新赠送次数
|
|
|
|
|
UpdateUserGiftCount(id uint64, count int8) error
|
|
|
|
|
//GetUserGiftCount 获取赠送次数
|
|
|
|
|
GetUserGiftCount(ePhone string) (int, error)
|
|
|
|
|
|
|
|
|
|
// FindById 根据ID查找用户
|
|
|
|
|
FindByID(id uint64) (*User, error)
|
|
|
|
|
|
|
|
|
|
// FindByPhone 根据手机号查找用户
|
|
|
|
|
FindByPhone(phone string) (*User, error)
|
|
|
|
|
|
|
|
|
|
// FindAll 查询用户列表
|
|
|
|
|
FindAll(page *page.Page, conds []builder.Cond) error
|
|
|
|
|
|
|
|
|
|
// Delete 删除用户(包含Profile)
|
|
|
|
|
Delete(id uint64) error
|
|
|
|
|
|
|
|
|
|
// UpdateLastLogin 更新最后登录信息
|
|
|
|
|
UpdateLastLogin(id uint64, ip string) error
|
|
|
|
|
|
|
|
|
|
//锁定状态
|
|
|
|
|
IsLocked(status int8) bool
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// UserAggregateRepository 用户聚合根仓储接口
|
|
|
|
|
type UserAggregateRepository interface {
|
|
|
|
|
// GetUserAggregate 获取用户聚合根
|
|
|
|
|
GetUserAggregate(phone string) (*UserAggregate, error)
|
|
|
|
|
|
|
|
|
|
// SaveUserAggregate 保存用户聚合根
|
|
|
|
|
SaveUserAggregate(aggregate *UserAggregate) error
|
|
|
|
|
}
|