Documentation
¶
Index ¶
- Constants
- func ConfusePassAndSalt(pass, salt string) string
- func MakeRandomInitPass() (pass string, salt string, err error)
- func MakeRandomSalt() (s string, err error)
- func MakeSmsCode() string
- type AccessBiz
- type AccessSmsBiz
- type Biz
- type CheckInRequest
- type CheckInType
- type RegisterBiz
- type UserBiz
Constants ¶
View Source
const (
CheckInBySms = 0x3
)
Variables ¶
This section is empty.
Functions ¶
func ConfusePassAndSalt ¶
func MakeRandomSalt ¶
func MakeSmsCode ¶
func MakeSmsCode() string
Types ¶
type AccessBiz ¶
type AccessBiz interface {
// 验证用户的密码
VerifyUserPass(ctx context.Context, uid int64, pass string) error
// 用户登录
CheckIn(ctx context.Context, req *CheckInRequest) (*model.Session, error)
// 检查某个sessId 不检查登录的平台
IsSessIdCheckedIn(ctx context.Context, sessId string) (*model.UserInfo, error)
// 检查某个sessId是否所属某个平台
IsSessIdCheckedInPlatform(ctx context.Context, sessId, platform string) (*model.UserInfo, error)
// 检查用户是否登录
IsCheckedIn(ctx context.Context, uid int64) (*model.UserInfo, error)
// 检查某个用户是否在某个平台登录
IsCheckedInOnPlatform(ctx context.Context, uid int64, platform string) (*model.UserInfo, error)
// 退出某个登录会话
CheckOutTarget(ctx context.Context, sessId string) error
// 全平台退登
CheckOutAll(ctx context.Context, uid int64) error
}
登录认证相关
func NewAccessBiz ¶
func NewAccessBiz() AccessBiz
type AccessSmsBiz ¶
type AccessSmsBiz interface {
// 发送短信
RequestSendSms(ctx context.Context, tel string) error
// 验证码是否正确
CheckSmsCorrect(ctx context.Context, tel, smsCode string) error
// 删除验证码
DeleteSmsCode(ctx context.Context, tel string) error
}
func NewAccessSmsBiz ¶
func NewAccessSmsBiz() AccessSmsBiz
type Biz ¶
type Biz struct {
Access AccessBiz
AccessSms AccessSmsBiz
User UserBiz
Register RegisterBiz
}
type CheckInRequest ¶
type CheckInRequest struct {
User *model.UserInfo
Type CheckInType
Data struct {
Platform string
Sms string
}
}
type CheckInType ¶
type CheckInType uint8
type RegisterBiz ¶
type RegisterBiz interface {
// 新用户注册通过手机号注册
UserRegister(ctx context.Context, tel string) (*model.UserInfo, error)
}
用户注册
func NewRegisterBiz ¶
func NewRegisterBiz() RegisterBiz
type UserBiz ¶
type UserBiz interface {
// 获取个人信息
GetUser(ctx context.Context, uid int64) (*model.UserInfo, error)
// 批量和获取用户信息
BatchGetUser(ctx context.Context, uids []int64) (map[int64]*model.UserInfo, error)
// 更新个人信息
UpdateUser(ctx context.Context, req *model.UpdateUserRequest) (*model.UserInfo, error)
// 上传头像
UpdateAvatar(ctx context.Context, uid int64, req *model.AvatarInfoRequest) (string, string, error)
// 通过手机号获取用户
GetUserByTel(ctx context.Context, tel string) (*model.UserInfo, error)
// 获取头像链接
ReplaceAvatar(u *model.UserInfo)
ReplaceAvatarUrl(url string) string
}
用户个人信息相关 包含通用功能
func NewUserBiz ¶
func NewUserBiz() UserBiz
Click to show internal directories.
Click to hide internal directories.