user

package
v1.0.21 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2024 License: MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	ChangePwCaptchaType  = "captcha"
	ChangePwPasswordType = "password"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Department added in v1.0.15

type Department struct {
	Id      uint32 `json:"id"`
	Name    string `json:"name"`
	Keyword string `json:"keyword"`
}

type GetUserLoginCaptchaReply added in v1.0.15

type GetUserLoginCaptchaReply struct {
	Uuid    string `json:"uuid"`
	Captcha string `json:"captcha"`
	Expire  uint32 `json:"expire"`
}

type GetUserRequest added in v1.0.15

type GetUserRequest struct {
	Id    *uint32 `json:"id"`
	Phone *string `json:"phone"`
	Email *string `json:"email"`
}

type Job added in v1.0.15

type Job struct {
	Id      uint32 `json:"id"`
	Name    string `json:"name"`
	Keyword string `json:"keyword"`
}

type ListUserRequest added in v1.0.15

type ListUserRequest struct {
	Page          uint32   `json:"page"`
	PageSize      uint32   `json:"pageSize"`
	Order         *string  `json:"order"`
	OrderBy       *string  `json:"orderBy"`
	DepartmentId  *uint32  `json:"departmentId"`
	RoleId        *uint32  `json:"roleId"`
	Name          *string  `json:"name"`
	Phone         *string  `json:"phone"`
	Email         *string  `json:"email"`
	Status        *bool    `json:"status"`
	LoggedAts     []int64  `json:"loggedAts"`
	CreatedAts    []int64  `json:"createdAts"`
	DepartmentIds []uint32 `json:"departmentIds"` // fixed code
}

type Repo

type Repo interface {
	// GetUser 获取指定的用户信息
	GetUser(ctx kratosx.Context, id uint32) (*User, error)

	// ListUser 获取用户信息列表
	ListUser(ctx kratosx.Context, req *ListUserRequest) ([]*User, uint32, error)

	// CreateUser 创建用户信息
	CreateUser(ctx kratosx.Context, req *User) (uint32, error)

	// UpdateUser 更新用户信息
	UpdateUser(ctx kratosx.Context, req *User) error

	// UpdateUserStatus 更新用户信息状态
	UpdateUserStatus(ctx kratosx.Context, id uint32, status bool) error

	// DeleteUser 删除用户信息
	DeleteUser(ctx kratosx.Context, ids []uint32) (uint32, error)

	// GetUserByPhone 获取指定的用户信息
	GetUserByPhone(ctx kratosx.Context, phone string) (*User, error)

	// GetUserByEmail 获取指定的用户信息
	GetUserByEmail(ctx kratosx.Context, email string) (*User, error)

	// GetDepartmentDataScope 获取指定用户的部门权限
	GetDepartmentDataScope(ctx kratosx.Context, uid uint32) (bool, []uint32, error)

	// GetRoleDataScope 获取指定角色的角色权限
	GetRoleDataScope(ctx kratosx.Context, uid uint32) (bool, []uint32, error)

	// HasUserDataScope 获取某个用户是否具有另一个用户的权限
	HasUserDataScope(ctx kratosx.Context, pid, uid uint32) (bool, error)

	// GetUserToken 获取用户的token信息
	GetUserToken(ctx kratosx.Context, id uint32) (*string, int64, error)

	// GetUserPassword 获取用户的password
	GetUserPassword(ctx kratosx.Context, id uint32) (string, error)
}

type Role added in v1.0.15

type Role struct {
	Id      uint32 `json:"id"`
	Name    string `json:"name"`
	Keyword string `json:"keyword"`
	Status  *bool  `json:"status"`
}

type SendCurrentUserCaptchaReply added in v1.0.15

type SendCurrentUserCaptchaReply struct {
	Uuid    string `json:"uuid"`
	Captcha string `json:"captcha"`
	Expire  uint32 `json:"expire"`
}

type UpdateCurrentUserPasswordRequest added in v1.0.15

type UpdateCurrentUserPasswordRequest struct {
	Password    string  `json:"password"`
	OldPassword *string `json:"oldPassword"`
	CaptchaId   *string `json:"captchaId"`
	Captcha     *string `json:"captcha"`
}

type UpdateCurrentUserRequest

type UpdateCurrentUserRequest struct {
	Avatar   *string `json:"avatar"`
	Nickname string  `json:"nickname"`
	Gender   string  `json:"gender"`
}

type UseCase

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

func NewUseCase

func NewUseCase(config *conf.Config, repo Repo) *UseCase

func (*UseCase) CreateUser added in v1.0.15

func (u *UseCase) CreateUser(ctx kratosx.Context, req *User) (uint32, error)

CreateUser 创建用户信息 fixed code

func (*UseCase) DeleteUser

func (u *UseCase) DeleteUser(ctx kratosx.Context, ids []uint32) (uint32, error)

DeleteUser 删除用户信息 fixed code

func (*UseCase) GetCurrentUser added in v1.0.15

func (u *UseCase) GetCurrentUser(ctx kratosx.Context) (*User, error)

GetCurrentUser 获取当前的用户信息

func (*UseCase) GetUser added in v1.0.15

func (u *UseCase) GetUser(ctx kratosx.Context, req *GetUserRequest) (*User, error)

GetUser 获取指定的用户信息 fixed code

func (*UseCase) GetUserLoginCaptcha added in v1.0.15

func (u *UseCase) GetUserLoginCaptcha(ctx kratosx.Context) (*GetUserLoginCaptchaReply, error)

GetUserLoginCaptcha 获取用户登陆验证吗

func (*UseCase) ListUser added in v1.0.15

func (u *UseCase) ListUser(ctx kratosx.Context, req *ListUserRequest) ([]*User, uint32, error)

ListUser 获取用户信息列表 fixed code

func (*UseCase) ResetUserPassword

func (u *UseCase) ResetUserPassword(ctx kratosx.Context, id uint32) error

ResetUserPassword 重置用户密码

func (*UseCase) SendCurrentUserCaptcha added in v1.0.15

func (u *UseCase) SendCurrentUserCaptcha(ctx kratosx.Context, tp string) (*SendCurrentUserCaptchaReply, error)

SendCurrentUserCaptcha 发送当前用户验证吗

func (*UseCase) UpdateCurrentUser

func (u *UseCase) UpdateCurrentUser(ctx kratosx.Context, req *UpdateCurrentUserRequest) error

UpdateCurrentUser 更新当前的基础信息

func (*UseCase) UpdateCurrentUserPassword added in v1.0.15

func (u *UseCase) UpdateCurrentUserPassword(ctx kratosx.Context, req *UpdateCurrentUserPasswordRequest) error

UpdateCurrentUserPassword 修改当前用户密码

func (*UseCase) UpdateCurrentUserRole added in v1.0.15

func (u *UseCase) UpdateCurrentUserRole(ctx kratosx.Context, rid uint32) error

UpdateCurrentUserRole 切换当前用户角色

func (*UseCase) UpdateCurrentUserSetting added in v1.0.15

func (u *UseCase) UpdateCurrentUserSetting(ctx kratosx.Context, setting string) error

UpdateCurrentUserSetting 保存当前用户设置

func (*UseCase) UpdateUser

func (u *UseCase) UpdateUser(ctx kratosx.Context, req *User) error

UpdateUser 更新用户信息 fixed code

func (*UseCase) UpdateUserStatus added in v1.0.15

func (u *UseCase) UpdateUserStatus(ctx kratosx.Context, id uint32, status bool) error

UpdateUserStatus 更新用户信息状态 fixed code

func (*UseCase) UserLogin

func (u *UseCase) UserLogin(ctx kratosx.Context, in *UserLoginRequest) (string, error)

func (*UseCase) UserLogout

func (u *UseCase) UserLogout(ctx kratosx.Context) error

UserLogout 退出登陆

func (*UseCase) UserRefreshToken

func (u *UseCase) UserRefreshToken(ctx kratosx.Context) (string, error)

UserRefreshToken 用户刷新token

type User

type User struct {
	Id           uint32      `json:"id"`
	DepartmentId uint32      `json:"departmentId"`
	RoleId       uint32      `json:"roleId"`
	Name         string      `json:"name"`
	Nickname     string      `json:"nickname"`
	Gender       string      `json:"gender"`
	Avatar       *string     `json:"avatar"`
	Phone        string      `json:"phone"`
	Email        string      `json:"email"`
	Password     string      `json:"password"`
	Status       *bool       `json:"status"`
	Setting      *string     `json:"setting"`
	Token        *string     `json:"token"`
	LoggedAt     int64       `json:"loggedAt"`
	CreatedAt    int64       `json:"createdAt"`
	UpdatedAt    int64       `json:"updatedAt"`
	UserJobs     []*UserJob  `json:"userJobs"`
	UserRoles    []*UserRole `json:"userRoles"`
	Roles        []*Role     `json:"roles"`
	Jobs         []*Job      `json:"jobs"`
	Department   *Department `json:"department"`
	Role         *Role       `json:"role"`
}

type UserJob

type UserJob struct {
	JobId uint32 `json:"jobId"`
}

type UserLoginRequest

type UserLoginRequest struct {
	Username  string `json:"username"`
	Password  string `json:"password"`
	CaptchaId string `json:"captchaId"`
	Captcha   string `json:"captcha"`
}

type UserRole

type UserRole struct {
	RoleId uint32 `json:"roleId"`
}

Jump to

Keyboard shortcuts

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