Documentation
¶
Index ¶
- type ChangePasswordRequest
- type ChangePasswordResponse
- type GameInfo
- type Handler
- type ProfileGame
- type ProfileGamesRequest
- type ProfileGamesResponse
- type ProfileGetRequest
- type ProfileGetResponse
- type ProfileInfo
- type ProfilePasswordRequest
- type ProfilePermission
- type ProfilePermissionsRequest
- type ProfilePermissionsResponse
- type ProfileUpdateRequest
- type ProfileUpdateResponse
- type Service
- func (s *Service) ChangePassword(ctx context.Context, username string, req *ChangePasswordRequest) (*ChangePasswordResponse, error)
- func (s *Service) GetPermissions(ctx context.Context, username string) (*ProfilePermissionsResponse, error)
- func (s *Service) GetProfile(ctx context.Context, username string) (*ProfileGetResponse, error)
- func (s *Service) GetUserGames(ctx context.Context, username string) (*ProfileGamesResponse, error)
- func (s *Service) UpdateProfile(ctx context.Context, username string, req *ProfileUpdateRequest) (*ProfileUpdateResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChangePasswordRequest ¶
type ChangePasswordRequest struct {
OldPassword string `json:"oldPassword" binding:"required"`
NewPassword string `json:"newPassword" binding:"required,min=6"`
}
ChangePasswordRequest 修改密码请求
type ChangePasswordResponse ¶
type ChangePasswordResponse struct {
Ok bool `json:"ok"`
}
ChangePasswordResponse 修改密码响应
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func (*Handler) ChangePassword ¶
ChangePassword 修改密码
func (*Handler) GetPermissions ¶
GetPermissions 获取当前用户的权限列表
func (*Handler) UpdateProfile ¶
UpdateProfile 更新个人资料
type ProfileGame ¶
type ProfileGame struct {
GameId string `json:"gameId"`
GameName string `json:"gameName"`
Color string `json:"color"`
Envs []string `json:"envs"`
EnvMeta interface{} `json:"envMeta"`
Permissions []string `json:"permissions"`
}
ProfileGame 游戏资料
type ProfileGamesResponse ¶
type ProfileGamesResponse struct {
Games []ProfileGame `json:"games"`
}
ProfileGamesResponse 获取我的游戏响应
type ProfileGetResponse ¶
type ProfileGetResponse struct {
ProfileInfo
}
ProfileGetResponse 获取个人资料响应
type ProfileInfo ¶
type ProfileInfo struct {
Id int64 `json:"id"`
Username string `json:"username"`
Nickname string `json:"nickname"`
Email string `json:"email"`
Phone string `json:"phone"`
Active bool `json:"active"`
Roles []string `json:"roles"`
Avatar string `json:"avatar"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
LastLoginAt string `json:"lastLoginAt,omitempty"`
}
ProfileInfo 个人资料信息
type ProfilePasswordRequest ¶
type ProfilePasswordRequest struct {
OldPassword string `json:"oldPassword"`
NewPassword string `json:"newPassword"`
}
ProfilePasswordRequest 修改密码请求
type ProfilePermission ¶
type ProfilePermission struct {
Resource string `json:"resource"`
Actions []string `json:"actions"`
GameId string `json:"gameId,omitempty"`
Env string `json:"env,omitempty"`
}
ProfilePermission 权限
type ProfilePermissionsRequest ¶
ProfilePermissionsRequest 获取权限列表请求
type ProfilePermissionsResponse ¶
type ProfilePermissionsResponse struct {
Permissions []ProfilePermission `json:"permissions"`
Admin bool `json:"admin"`
Roles []string `json:"roles"`
PermissionIDs []string `json:"permissionIDs,omitempty"`
}
ProfilePermissionsResponse 获取权限列表响应
type ProfileUpdateRequest ¶
type ProfileUpdateRequest struct {
Nickname string `json:"nickname"`
Email string `json:"email"`
Phone string `json:"phone"`
Avatar string `json:"avatar"`
}
ProfileUpdateRequest 更新个人资料请求
type ProfileUpdateResponse ¶
type ProfileUpdateResponse struct {
Ok bool `json:"ok"`
}
ProfileUpdateResponse 更新个人资料响应
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(adminModel *model.AdminModel, gameModel *model.GameModel, roleModel *model.RoleModel, opsStore ...*svc.OpsStateStore) *Service
func (*Service) ChangePassword ¶
func (s *Service) ChangePassword(ctx context.Context, username string, req *ChangePasswordRequest) (*ChangePasswordResponse, error)
ChangePassword 修改密码
func (*Service) GetPermissions ¶
func (s *Service) GetPermissions(ctx context.Context, username string) (*ProfilePermissionsResponse, error)
GetPermissions 获取用户权限列表
func (*Service) GetProfile ¶
GetProfile 获取个人资料
func (*Service) GetUserGames ¶
GetUserGames 获取用户的游戏列表
func (*Service) UpdateProfile ¶
func (s *Service) UpdateProfile(ctx context.Context, username string, req *ProfileUpdateRequest) (*ProfileUpdateResponse, error)
UpdateProfile 更新个人资料
Click to show internal directories.
Click to hide internal directories.