biz

package
v1.7.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 11, 2023 License: MIT Imports: 16 Imported by: 0

README

Biz

Documentation

Index

Constants

This section is empty.

Variables

ProviderSet is biz providers.

Functions

This section is empty.

Types

type AuthRepo

type AuthRepo interface {
	GetWechatAccessToken(ctx context.Context, code string) (string, string, error)
	GetQQAccessToken(ctx context.Context, code string) (string, error)
	GetQQOpenId(ctx context.Context, token string) (string, error)
	GetGithubAccessToken(ctx context.Context, code string) (string, error)
	GetGiteeAccessToken(ctx context.Context, code, redirectUrl string) (string, error)
	GetWechatUserInfo(ctx context.Context, token, openid string) (map[string]interface{}, error)
	GetQQUserInfo(ctx context.Context, token, openId string) (map[string]interface{}, error)
	GetGithubUserInfo(ctx context.Context, token string) (map[string]interface{}, error)
	GetGiteeUserInfo(ctx context.Context, token string) (map[string]interface{}, error)
	FindUserByPhone(ctx context.Context, phone string) (*User, error)
	FindUserByEmail(ctx context.Context, email string) (*User, error)
	FindUserByWechat(ctx context.Context, wechat string) (*User, error)
	FindUserByQQ(ctx context.Context, qq string) (*User, error)
	FindUserByGithub(ctx context.Context, github int32) (*User, error)
	FindUserByGitee(ctx context.Context, gitee int32) (*User, error)
	CreateUserWithPhone(ctx context.Context, phone string) (*User, error)
	CreateUserWithEmail(ctx context.Context, email, password string) (*User, error)
	CreateUserWithWechat(ctx context.Context, wechat string) (*User, error)
	CreateUserWithQQ(ctx context.Context, qq string) (*User, error)
	CreateUserWithGithub(ctx context.Context, github int32) (*User, error)
	CreateUserWithGitee(ctx context.Context, gitee int32) (*User, error)
	CreateUserProfile(ctx context.Context, account, uuid string) error
	CreateUserProfileWithGithub(ctx context.Context, account, github, uuid string) error
	CreateUserProfileWithGitee(ctx context.Context, account, gitee, uuid string) error
	CreateUserProfileUpdate(ctx context.Context, account, uuid string) error
	CreateUserProfileUpdateWithGithub(ctx context.Context, account, uuid, github string) error
	CreateUserProfileUpdateWithGitee(ctx context.Context, account, uuid, gitee string) error
	CreateUserSearch(ctx context.Context, account, uuid string) error
	SetUserPhone(ctx context.Context, uuid, phone string) error
	SetUserEmail(ctx context.Context, uuid, email string) error
	SetUserPassword(ctx context.Context, uuid, password string) error
	SetUserWechat(ctx context.Context, uuid, wechat string) error
	SetUserQQ(ctx context.Context, uuid, qq string) error
	SetUserGitee(ctx context.Context, uuid string, gitee int32) error
	SetUserGithub(ctx context.Context, uuid string, github int32) error
	SetUserAvatar(ctx context.Context, uuid, avatar string)
	SendPhoneCode(ctx context.Context, template, phone string) error
	SendEmailCode(ctx context.Context, template, phone string) error
	VerifyPhoneCode(ctx context.Context, phone, code string) error
	VerifyEmailCode(ctx context.Context, email, code string) error
	VerifyPassword(ctx context.Context, account, password, mode string) (*User, error)
	PasswordResetByPhone(ctx context.Context, phone, password string) error
	PasswordResetByEmail(ctx context.Context, email, password string) error
	GetCosSessionKey(ctx context.Context, uuid string) (*Credentials, error)
	UnbindUserPhone(ctx context.Context, uuid string) error
	UnbindUserEmail(ctx context.Context, uuid string) error
	UnbindUserWechat(ctx context.Context, uuid string) error
	UnbindUserQQ(ctx context.Context, uuid string) error
	UnbindUserGitee(ctx context.Context, uuid string) error
	UnbindUserGithub(ctx context.Context, uuid string) error
}

type AuthUseCase

type AuthUseCase struct {
	// contains filtered or unexported fields
}

func NewAuthUseCase

func NewAuthUseCase(conf *conf.Auth, repo AuthRepo, re Recovery, userRepo UserRepo, tm Transaction, logger log.Logger) *AuthUseCase

func (*AuthUseCase) ChangeUserPassword

func (r *AuthUseCase) ChangeUserPassword(ctx context.Context, uuid, oldpassword, password string) error

func (*AuthUseCase) GetCosSessionKey

func (r *AuthUseCase) GetCosSessionKey(ctx context.Context, uuid string) (*Credentials, error)

func (*AuthUseCase) LoginByCode

func (r *AuthUseCase) LoginByCode(ctx context.Context, phone, code string) (string, error)

func (*AuthUseCase) LoginByGitee added in v1.3.0

func (r *AuthUseCase) LoginByGitee(ctx context.Context, code string) (string, error)

func (*AuthUseCase) LoginByGithub added in v1.3.0

func (r *AuthUseCase) LoginByGithub(ctx context.Context, code string) (*Github, error)

func (*AuthUseCase) LoginByPassword

func (r *AuthUseCase) LoginByPassword(ctx context.Context, account, password, mode string) (string, error)

func (*AuthUseCase) LoginByQQ added in v1.3.0

func (r *AuthUseCase) LoginByQQ(ctx context.Context, code string) (string, error)

func (*AuthUseCase) LoginByWechat added in v1.3.0

func (r *AuthUseCase) LoginByWechat(ctx context.Context, code string) (string, error)

func (*AuthUseCase) LoginPasswordReset

func (r *AuthUseCase) LoginPasswordReset(ctx context.Context, account, password, code, mode string) error

func (*AuthUseCase) SendEmailCode

func (r *AuthUseCase) SendEmailCode(ctx context.Context, template, email string) error

func (*AuthUseCase) SendPhoneCode

func (r *AuthUseCase) SendPhoneCode(ctx context.Context, template, phone string) error

func (*AuthUseCase) SetUserEmail

func (r *AuthUseCase) SetUserEmail(ctx context.Context, uuid, email, code string) error

func (*AuthUseCase) SetUserGitee added in v1.3.0

func (r *AuthUseCase) SetUserGitee(ctx context.Context, uuid, code, redirectUrl string) error

func (*AuthUseCase) SetUserGithub added in v1.3.0

func (r *AuthUseCase) SetUserGithub(ctx context.Context, uuid, code string) error

func (*AuthUseCase) SetUserPassword

func (r *AuthUseCase) SetUserPassword(ctx context.Context, uuid, password string) error

func (*AuthUseCase) SetUserPhone

func (r *AuthUseCase) SetUserPhone(ctx context.Context, uuid, phone, code string) error

func (*AuthUseCase) SetUserQQ added in v1.3.0

func (r *AuthUseCase) SetUserQQ(ctx context.Context, uuid, code string) error

func (*AuthUseCase) SetUserWechat added in v1.3.0

func (r *AuthUseCase) SetUserWechat(ctx context.Context, uuid, code string) error

func (*AuthUseCase) UnbindUserEmail

func (r *AuthUseCase) UnbindUserEmail(ctx context.Context, uuid, phone, email, account, password, code, choose, mode, redirectUri string) error

func (*AuthUseCase) UnbindUserGitee added in v1.3.0

func (r *AuthUseCase) UnbindUserGitee(ctx context.Context, uuid, phone, email, account, password, code, choose, mode, redirectUri string) error

func (*AuthUseCase) UnbindUserGithub added in v1.3.0

func (r *AuthUseCase) UnbindUserGithub(ctx context.Context, uuid, phone, email, account, password, code, choose, mode, redirectUri string) error

func (*AuthUseCase) UnbindUserPhone

func (r *AuthUseCase) UnbindUserPhone(ctx context.Context, uuid, phone, email, account, password, code, choose, mode, redirectUri string) error

func (*AuthUseCase) UnbindUserQQ added in v1.3.0

func (r *AuthUseCase) UnbindUserQQ(ctx context.Context, uuid, phone, email, account, password, code, choose, mode, redirectUri string) error

func (*AuthUseCase) UnbindUserWechat added in v1.3.0

func (r *AuthUseCase) UnbindUserWechat(ctx context.Context, uuid, phone, email, account, password, code, choose, mode, redirectUri string) error

func (*AuthUseCase) UserRegister

func (r *AuthUseCase) UserRegister(ctx context.Context, email, password, code string) error

func (*AuthUseCase) VerifyAccount added in v1.3.0

func (r *AuthUseCase) VerifyAccount(ctx context.Context, uuid, phone, email, account, password, code, choose, mode, redirectUri string) (*User, error)

type Credentials

type Credentials struct {
	TmpSecretID  string
	TmpSecretKey string
	SessionToken string
	StartTime    int64
	ExpiredTime  int64
}

type Follow

type Follow struct {
	Id       int32
	Update   time.Time
	Follow   string
	Followed string
	Status   int32
}

type Follows

type Follows struct {
	Uuid   string
	Follow int32
}

type Github added in v1.3.0

type Github struct {
	Token    string
	Avatar   string
	Register bool
	Uuid     string
}

type ImageReview

type ImageReview struct {
	Id       int32
	CreateAt string
	Uuid     string
	JobId    string
	Url      string
	Label    string
	Result   int32
	Category string
	SubLabel string
	Mode     string
	Score    int32
}

func (ImageReview) MarshalEasyJSON added in v1.2.0

func (v ImageReview) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ImageReview) MarshalJSON added in v1.2.0

func (v ImageReview) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ImageReview) UnmarshalEasyJSON added in v1.2.0

func (v *ImageReview) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ImageReview) UnmarshalJSON added in v1.2.0

func (v *ImageReview) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Profile

type Profile struct {
	Created   string
	Updated   string
	Uuid      string
	Username  string
	Avatar    string
	School    string
	Company   string
	Job       string
	Homepage  string
	Github    string
	Gitee     string
	Introduce string
}

type ProfileUpdate

type ProfileUpdate struct {
	Profile
	Mode   string
	Status int32
}

func (ProfileUpdate) MarshalEasyJSON added in v1.2.0

func (v ProfileUpdate) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ProfileUpdate) MarshalJSON added in v1.2.0

func (v ProfileUpdate) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ProfileUpdate) UnmarshalEasyJSON added in v1.2.0

func (v *ProfileUpdate) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ProfileUpdate) UnmarshalJSON added in v1.2.0

func (v *ProfileUpdate) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type ProfileUpdateMap added in v1.2.0

type ProfileUpdateMap struct {
	Username  string
	Introduce string
}

func (ProfileUpdateMap) MarshalEasyJSON added in v1.2.0

func (v ProfileUpdateMap) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ProfileUpdateMap) MarshalJSON added in v1.2.0

func (v ProfileUpdateMap) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ProfileUpdateMap) UnmarshalEasyJSON added in v1.2.0

func (v *ProfileUpdateMap) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ProfileUpdateMap) UnmarshalJSON added in v1.2.0

func (v *ProfileUpdateMap) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Recovery

type Recovery interface {
	GroupRecover(context.Context, func(ctx context.Context) error) func() error
}

type SendUserStatisticMap added in v1.2.0

type SendUserStatisticMap struct {
	Follow   string
	Followed string
	Mode     string
}

func (SendUserStatisticMap) MarshalEasyJSON added in v1.2.0

func (v SendUserStatisticMap) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (SendUserStatisticMap) MarshalJSON added in v1.2.0

func (v SendUserStatisticMap) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*SendUserStatisticMap) UnmarshalEasyJSON added in v1.2.0

func (v *SendUserStatisticMap) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*SendUserStatisticMap) UnmarshalJSON added in v1.2.0

func (v *SendUserStatisticMap) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type SetFollowMap added in v1.2.0

type SetFollowMap struct {
	Uuid   string
	UserId string
	Mode   string
}

func (SetFollowMap) MarshalEasyJSON added in v1.2.0

func (v SetFollowMap) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (SetFollowMap) MarshalJSON added in v1.2.0

func (v SetFollowMap) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*SetFollowMap) UnmarshalEasyJSON added in v1.2.0

func (v *SetFollowMap) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*SetFollowMap) UnmarshalJSON added in v1.2.0

func (v *SetFollowMap) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Transaction

type Transaction interface {
	ExecTx(context.Context, func(ctx context.Context) error) error
}

type User

type User struct {
	Uuid     string
	Phone    string
	Email    string
	Qq       string
	Wechat   string
	Gitee    int32
	Github   int32
	Password string
}

type UserRepo

type UserRepo interface {
	GetAccount(ctx context.Context, uuid string) (*User, error)
	GetProfile(ctx context.Context, uuid string) (*Profile, error)
	GetProfileList(ctx context.Context, uuids []string) ([]*Profile, error)
	GetUserFollow(ctx context.Context, uuid, userUuid string) (bool, error)
	GetUserFollows(ctx context.Context, uuid string) ([]string, error)
	GetProfileUpdate(ctx context.Context, uuid string) (*ProfileUpdate, error)
	GetFollowList(ctx context.Context, page int32, uuid string) ([]*Follow, error)
	GetFollowListCount(ctx context.Context, uuid string) (int32, error)
	GetFollowedList(ctx context.Context, page int32, uuid string) ([]*Follow, error)
	GetFollowedListCount(ctx context.Context, uuid string) (int32, error)
	GetUserSearch(ctx context.Context, page int32, search string) ([]*UserSearch, int32, error)
	GetAvatarReview(ctx context.Context, page int32, uuid string) ([]*ImageReview, error)
	GetCoverReview(ctx context.Context, page int32, uuid string) ([]*ImageReview, error)
	EditUserSearch(ctx context.Context, uuid string, profile *ProfileUpdate) error
	SetAvatarIrregular(ctx context.Context, review *ImageReview) (*ImageReview, error)
	SetAvatarIrregularToCache(ctx context.Context, review *ImageReview) error
	SetCoverIrregular(ctx context.Context, review *ImageReview) (*ImageReview, error)
	SetCoverIrregularToCache(ctx context.Context, review *ImageReview) error
	SetProfile(ctx context.Context, profile *ProfileUpdate) error
	SetProfileUpdate(ctx context.Context, profile *ProfileUpdate, status int32) (*ProfileUpdate, error)
	SetUserFollow(ctx context.Context, uuid, userId string) error
	SetUserFollowToCache(ctx context.Context, uuid, userId string) error
	SetFollowToMq(ctx context.Context, follow *Follow, mode string) error
	CancelUserFollow(ctx context.Context, uuid, userId string) error
	CancelUserFollowFromCache(ctx context.Context, uuid, userId string) error
	SendImageIrregularToMq(ctx context.Context, review *ImageReview) error
	SendProfileToMq(ctx context.Context, profile *ProfileUpdate) error
	SendUserStatisticToMq(ctx context.Context, uuid, userUuid, mode string) error
	ModifyProfileUpdateStatus(ctx context.Context, uuid, update string) error
}

type UserSearch

type UserSearch struct {
	Uuid      string
	Username  string
	Introduce string
}

type UserSearchMap added in v1.2.0

type UserSearchMap struct {
	Username  string
	Introduce string
}

func (UserSearchMap) MarshalEasyJSON added in v1.2.0

func (v UserSearchMap) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (UserSearchMap) MarshalJSON added in v1.2.0

func (v UserSearchMap) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*UserSearchMap) UnmarshalEasyJSON added in v1.2.0

func (v *UserSearchMap) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*UserSearchMap) UnmarshalJSON added in v1.2.0

func (v *UserSearchMap) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type UserUseCase

type UserUseCase struct {
	// contains filtered or unexported fields
}

func NewUserUseCase

func NewUserUseCase(repo UserRepo, re Recovery, tm Transaction, logger log.Logger) *UserUseCase

func (*UserUseCase) AddAvatarReviewDbAndCache

func (r *UserUseCase) AddAvatarReviewDbAndCache(ctx context.Context, review *ImageReview) error

func (*UserUseCase) AddCoverReviewDbAndCache

func (r *UserUseCase) AddCoverReviewDbAndCache(ctx context.Context, review *ImageReview) error

func (*UserUseCase) AvatarIrregular

func (r *UserUseCase) AvatarIrregular(ctx context.Context, review *ImageReview) error

func (*UserUseCase) CancelFollowDbAndCache

func (r *UserUseCase) CancelFollowDbAndCache(ctx context.Context, uuid, userId string) error

func (*UserUseCase) CancelUserFollow

func (r *UserUseCase) CancelUserFollow(ctx context.Context, uuid, userId string) error

func (*UserUseCase) CoverIrregular

func (r *UserUseCase) CoverIrregular(ctx context.Context, review *ImageReview) error

func (*UserUseCase) GetAccount

func (r *UserUseCase) GetAccount(ctx context.Context, uuid string) (*User, error)

func (*UserUseCase) GetAvatarReview

func (r *UserUseCase) GetAvatarReview(ctx context.Context, page int32, uuid string) ([]*ImageReview, error)

func (*UserUseCase) GetCoverReview

func (r *UserUseCase) GetCoverReview(ctx context.Context, page int32, uuid string) ([]*ImageReview, error)

func (*UserUseCase) GetFollowList

func (r *UserUseCase) GetFollowList(ctx context.Context, page int32, uuid string) ([]*Follow, error)

func (*UserUseCase) GetFollowListCount

func (r *UserUseCase) GetFollowListCount(ctx context.Context, uuid string) (int32, error)

func (*UserUseCase) GetFollowedList

func (r *UserUseCase) GetFollowedList(ctx context.Context, page int32, uuid string) ([]*Follow, error)

func (*UserUseCase) GetFollowedListCount

func (r *UserUseCase) GetFollowedListCount(ctx context.Context, uuid string) (int32, error)

func (*UserUseCase) GetProfile

func (r *UserUseCase) GetProfile(ctx context.Context, uuid string) (*Profile, error)

func (*UserUseCase) GetProfileList

func (r *UserUseCase) GetProfileList(ctx context.Context, uuids []string) ([]*Profile, error)

func (*UserUseCase) GetProfileUpdate

func (r *UserUseCase) GetProfileUpdate(ctx context.Context, uuid string) (*ProfileUpdate, error)

func (*UserUseCase) GetUserFollow

func (r *UserUseCase) GetUserFollow(ctx context.Context, uuid, userUuid string) (bool, error)

func (*UserUseCase) GetUserFollows

func (r *UserUseCase) GetUserFollows(ctx context.Context, uuid string) (map[string]bool, error)

func (*UserUseCase) GetUserSearch

func (r *UserUseCase) GetUserSearch(ctx context.Context, page int32, search string) ([]*UserSearch, int32, error)

func (*UserUseCase) ProfileReviewNotPass

func (r *UserUseCase) ProfileReviewNotPass(ctx context.Context, uuid string) error

func (*UserUseCase) ProfileReviewPass

func (r *UserUseCase) ProfileReviewPass(ctx context.Context, uuid, update string) error

func (*UserUseCase) SetFollowDbAndCache

func (r *UserUseCase) SetFollowDbAndCache(ctx context.Context, uuid, userId string) error

func (*UserUseCase) SetProfileUpdate

func (r *UserUseCase) SetProfileUpdate(ctx context.Context, profile *ProfileUpdate) error

func (*UserUseCase) SetUserFollow

func (r *UserUseCase) SetUserFollow(ctx context.Context, uuid, userId string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL