service

package
v0.0.0-...-db9179b Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LoginLimitKeyPrefix = "admin:login_limit"
)

Variables

This section is empty.

Functions

func NewAdminService

func NewAdminService(rdb redis.Cmdable, repo IAdminRepo, adminRoleRepo IAdminRoleRepo, menuRepo IMenuRepo) v1.IAdminServer

func NewMenuService

func NewMenuService(repo IMenuRepo) v1.IMenuServer

func NewRoleService

func NewRoleService(repo IRoleRepo) v1.IRoleServer

Types

type IAdminRepo

type IAdminRepo interface {
	// HasUsername
	// 1.查询字段少。
	// 2.不能通过
	HasUsername(ctx context.Context, req *dto.UniqueUsernameQuery) (*dto.UniqueResult, error)
	HasEmail(ctx context.Context, req *dto.UniqueEmailQuery) (*dto.UniqueResult, error)
	FindByUsername(ctx context.Context, username string) (*model.Admin, error)
	FindByID(ctx context.Context, ID int64) (*model.Admin, error)
	Find(ctx context.Context, req *v1.AdminListRequest) (*page.Data[*model.Admin], error)
	// 创建admin
	Insert(ctx context.Context, record ...*model.Admin) error
	// 更新admin相关
	Update(ctx context.Context, data *v1.AdminUpdateRequest) error
	UpdateLoginTime(ctx context.Context, ID int64, loginTime time.Time) error
	UpdatePwd(ctx context.Context, ID int64, pwd string) error
	UpdateStatus(ctx context.Context, ID int64, status bool) error
	// 删除admin
	Delete(ctx context.Context, ID int64) error
}

type IAdminRoleRepo

type IAdminRoleRepo interface {
	FindAdminRole(ctx context.Context, adminID int64) ([]*model.Role, error)
	UpdateRole(ctx context.Context, adminID int64, role []int64) error
}

type IMenuRepo

type IMenuRepo interface {
	Find(ctx context.Context, req *v1.MenuListRequest) ([]*model.Menu, int64, error)
	FindOne(ctx context.Context, req *v1.MenuRequest) (*model.Menu, error)
	Create(ctx context.Context, data *model.Menu) error
	Update(ctx context.Context, req *v1.MenuUpdateRequest) error
	UpdateHidden(ctx context.Context, ID int64, hidden *bool) error
	Delete(ctx context.Context, req *v1.MenuDeleteRequest) error
}

type IRoleRepo

type IRoleRepo interface {
	Find(ctx context.Context, req *v1.RoleListRequest) ([]*model.Role, int64, error)
	FindOne(ctx context.Context, req *v1.RoleRequest) (*model.Role, error)
	Create(ctx context.Context, data *model.Role) error
	Update(ctx context.Context, req *v1.RoleUpdateRequest) error
	UpdateStatus(ctx context.Context, id int64, status bool) error
	Delete(ctx context.Context, req *v1.RoleDeleteRequest) error
}

Jump to

Keyboard shortcuts

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