Documentation ¶
Index ¶
- type IUserService
- type UserService
- func (a *UserService) AddUser(user *models.User) bool
- func (a *UserService) CheckUser(username string, password string) bool
- func (a *UserService) DeleteUser(id uint) bool
- func (a *UserService) ExistUserByName(username string) bool
- func (a *UserService) GetUserID(username string) uint
- func (a *UserService) GetUserType(username string) uint
- func (a *UserService) GetUsers(page, pagesize uint, maps interface{}) interface{}
- func (a *UserService) RegisterUser(user *models.User) bool
- func (a *UserService) UpdateUser(modUser *models.User, userOpType string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IUserService ¶
type IUserService interface { //CheckUser 身份验证 CheckUser(username string, password string) bool //GetUserID 获取用户ID GetUserID(username string) uint //GetUserType 获取用户角色 GetUserType(username string) uint //GetUsers 获取用户信息 GetUsers(page, pagesize uint, maps interface{}) interface{} //AddUser 新建用户 AddUser(user *models.User) bool //ExistUserByName 判断用户名是否已存在 ExistUserByName(username string) bool //UpdateUser 更新用户 UpdateUser(user *models.User, userOpType string) bool //DeleteUser 删除用户 DeleteUser(id uint) bool }
IUserService UserService接口定义
type UserService ¶
type UserService struct { Repository repository.IUserRepository `inject:""` Log logger.ILogger `inject:""` }
UserService 注入IUserRepository
func (*UserService) CheckUser ¶
func (a *UserService) CheckUser(username string, password string) bool
CheckUser 身份验证
func (*UserService) ExistUserByName ¶
func (a *UserService) ExistUserByName(username string) bool
ExistUserByName 判断用户名是否已存在
func (*UserService) GetUserID ¶
func (a *UserService) GetUserID(username string) uint
GetUserID 获取用户ID
func (*UserService) GetUserType ¶
func (a *UserService) GetUserType(username string) uint
GetUserType 获取用户Type(管理员,研发)
func (*UserService) GetUsers ¶
func (a *UserService) GetUsers(page, pagesize uint, maps interface{}) interface{}
GetUsers 获取用户信息
func (*UserService) RegisterUser ¶
func (a *UserService) RegisterUser(user *models.User) bool
RegisterUser 新建用户,并不同时新建用户角色
func (*UserService) UpdateUser ¶
func (a *UserService) UpdateUser(modUser *models.User, userOpType string) bool
UpdateUser 更新用户
Click to show internal directories.
Click to hide internal directories.