server

package
v0.0.0-...-f780273 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2025 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

ProviderSet is server providers.

Functions

func NewGRPCServer

func NewGRPCServer(c *conf.Server, server *Server, logger *zap.Logger) *grpc.Server

NewGRPCServer new a gRPC server.

func NewHTTPServer

func NewHTTPServer(c *conf.Server, logger *zap.Logger, svr *Server) *khttp.Server

NewHTTPServer new an HTTP server.

Types

type AuthorityApi

type AuthorityApi struct {
	*Server
}

func (*AuthorityApi) CreateAuthority

func (svr *AuthorityApi) CreateAuthority(c *gin.Context)

CreateAuthority @Tags Authority @Summary 创建角色 @Security ApiKeyAuth @accept application/json @Produce application/json @Param data body data.SysAuthority true "权限id, 权限名, 父角色id" @Success 200 {object} rhttp.Response{data=data.SysAuthority,msg=string} "创建角色,返回包括系统角色详情" @Router /authority/createAuthority [post]

func (*AuthorityApi) DeleteAuthority

func (svr *AuthorityApi) DeleteAuthority(c *gin.Context)

DeleteAuthority @Tags Authority @Summary 删除角色 @Security ApiKeyAuth @accept application/json @Produce application/json @Param data body data.SysAuthority true "删除角色" @Success 200 {object} rhttp.Response{msg=string} "删除角色" @Router /authority/deleteAuthority [post]

func (*AuthorityApi) GetAuthorityList

func (svr *AuthorityApi) GetAuthorityList(c *gin.Context)

GetAuthorityList @Tags Authority @Summary 分页获取角色列表 @Security ApiKeyAuth @accept application/json @Produce application/json @Param data body rhttp.PageInfo true "页码, 每页大小" @Success 200 {object} rhttp.Response{data=rhttp.PageResult,msg=string} "分页获取角色列表,返回包括列表,总数,页码,每页数量" @Router /authority/getAuthorityList [post]

func (*AuthorityApi) InitFileUploadAndDownloadRouter

func (svr *AuthorityApi) InitFileUploadAndDownloadRouter(Router *gin.RouterGroup)

func (*AuthorityApi) SetDataAuthority

func (svr *AuthorityApi) SetDataAuthority(c *gin.Context)

SetDataAuthority @Tags Authority @Summary 设置角色资源权限 @Security ApiKeyAuth @accept application/json @Produce application/json @Param data body data.SysAuthority true "设置角色资源权限" @Success 200 {object} rhttp.Response{msg=string} "设置角色资源权限" @Router /authority/setDataAuthority [post]

func (*AuthorityApi) UpdateAuthority

func (svr *AuthorityApi) UpdateAuthority(c *gin.Context)

UpdateAuthority @Tags Authority @Summary 更新角色信息 @Security ApiKeyAuth @accept application/json @Produce application/json @Param data body data.SysAuthority true "权限id, 权限名, 父角色id" @Success 200 {object} rhttp.Response{data=data.SysAuthority,msg=string} "更新角色信息,返回包括系统角色详情" @Router /authority/updateAuthority [post]

type CasbinApi

type CasbinApi struct {
	*Server
}

func (*CasbinApi) GetPolicyPathByAuthorityId

func (svr *CasbinApi) GetPolicyPathByAuthorityId(c *gin.Context)

GetPolicyPathByAuthorityId @Tags Casbin @Summary 获取权限列表 @Security ApiKeyAuth @accept application/json @Produce application/json @Param data body dto.CasbinInReceive true "权限id, 权限模型列表" @Success 200 {object} rhttp.Response{data=dto.PolicyPathResponse,msg=string} "获取权限列表,返回包括casbin详情列表" @Router /casbin/getPolicyPathByAuthorityId [post]

func (*CasbinApi) UpdateCasbin

func (svr *CasbinApi) UpdateCasbin(c *gin.Context)

UpdateCasbin @Tags Casbin @Summary 更新角色api权限 @Security ApiKeyAuth @accept application/json @Produce application/json @Param data body dto.CasbinInReceive true "权限id, 权限模型列表" @Success 200 {object} rhttp.Response{msg=string} "更新角色api权限" @Router /casbin/UpdateCasbin [post]

type Server

type Server struct {
	Ctx context.Context
	// contains filtered or unexported fields
}

func NewServer

func NewServer(ctx context.Context, svc *service.Service, data *data.Data, logger *zap.Logger) *Server

type UserApi

type UserApi struct {
	*Server
}

func NewUserApi

func NewUserApi(server *Server) *UserApi

func (*UserApi) ChangePassword

func (svr *UserApi) ChangePassword(c *gin.Context)

ChangePassword @Tags SysUser @Summary 用户修改密码 @Security ApiKeyAuth @Produce application/json @Param data body dto.ChangePasswordReq true "用户名, 原密码, 新密码" @Success 200 {object} rhttp.Response{msg=string} "用户修改密码" @Router /user/changePassword [post]

func (*UserApi) ClearToken

func (svr *UserApi) ClearToken(c *gin.Context)

func (*UserApi) DeleteUser

func (svr *UserApi) DeleteUser(c *gin.Context)

DeleteUser @Tags SysUser @Summary 删除用户 @Security ApiKeyAuth @accept application/json @Produce application/json @Param data body rhttp.GetById true "用户ID" @Success 200 {object} rhttp.Response{msg=string} "删除用户" @Router /user/deleteUser [delete]

func (*UserApi) GetClaims

func (svr *UserApi) GetClaims(c *gin.Context) (*data.CustomClaims, error)

func (*UserApi) GetToken

func (svr *UserApi) GetToken(c *gin.Context) string

func (*UserApi) GetUserAuthorityId

func (svr *UserApi) GetUserAuthorityId(c *gin.Context) uint

GetUserAuthorityId 从Gin的Context中获取从jwt解析出来的用户角色id

func (*UserApi) GetUserID

func (svr *UserApi) GetUserID(c *gin.Context) uint

GetUserID 从Gin的Context中获取从jwt解析出来的用户ID

func (*UserApi) GetUserInfo

func (svr *UserApi) GetUserInfo(c *gin.Context)

GetUserInfo @Tags SysUser @Summary 获取用户信息 @Security ApiKeyAuth @accept application/json @Produce application/json @Success 200 {object} rhttp.Response{data=map[string]interface{},msg=string} "获取用户信息" @Router /user/getUserInfo [get]

func (*UserApi) GetUserInfoByCtx

func (svr *UserApi) GetUserInfoByCtx(c *gin.Context) *data.CustomClaims

GetUserInfo 从Gin的Context中获取从jwt解析出来的用户角色id

func (*UserApi) GetUserList

func (svr *UserApi) GetUserList(c *gin.Context)

GetUserList @Tags SysUser @Summary 分页获取用户列表 @Security ApiKeyAuth @accept application/json @Produce application/json @Param data body rhttp.PageInfo true "页码, 每页大小" @Success 200 {object} rhttp.Response{data=rhttp.PageResult,msg=string} "分页获取用户列表,返回包括列表,总数,页码,每页数量" @Router /user/getUserList [post]

func (*UserApi) GetUserName

func (svr *UserApi) GetUserName(c *gin.Context) string

GetUserName 从Gin的Context中获取从jwt解析出来的用户名

func (*UserApi) InitRouter

func (svr *UserApi) InitRouter(server *Server, router *gin.RouterGroup)

func (*UserApi) InitUserAuthRouter

func (svr *UserApi) InitUserAuthRouter(server *Server, router *gin.RouterGroup)

func (*UserApi) JsonInBlacklist

func (svr *UserApi) JsonInBlacklist(c *gin.Context)

JsonInBlacklist @Tags Jwt @Summary jwt加入黑名单 @Security ApiKeyAuth @accept application/json @Produce application/json @Success 200 {object} rhttp.Response{msg=string} "jwt加入黑名单" @Router /jwt.proto/jsonInBlacklist [post]

func (*UserApi) Login

func (svr *UserApi) Login(c *gin.Context)

Login @Tags Base @Summary 用户登录 @Produce application/json @Param data body dto.Login true "用户名, 密码, 验证码" @Success 200 {object} rhttp.Response{data=dto.LoginResponse,msg=string} "返回包括用户信息,token,过期时间" @Router /base/login [post]

func (*UserApi) LoginToken

func (svr *UserApi) LoginToken(user data.Login) (token string, claims data.CustomClaims, err error)

func (*UserApi) Register

func (svr *UserApi) Register(c *gin.Context)

Register @Tags SysUser @Summary 用户注册账号 @Produce application/json @Param data body dto.Register true "用户名, 昵称, 密码, 角色ID" @Success 200 {object} rhttp.Response{data=dto.SysUserResponse,msg=string} "用户注册账号,返回包括用户信息" @Router /user/admin_register [post]

func (*UserApi) ResetPassword

func (svr *UserApi) ResetPassword(c *gin.Context)

ResetPassword @Tags SysUser @Summary 重置用户密码 @Security ApiKeyAuth @Produce application/json @Param data body data.SysUser true "ID" @Success 200 {object} rhttp.Response{msg=string} "重置用户密码" @Router /user/resetPassword [post]

func (*UserApi) SetSelfInfo

func (svr *UserApi) SetSelfInfo(c *gin.Context)

SetSelfInfo @Tags SysUser @Summary 设置用户信息 @Security ApiKeyAuth @accept application/json @Produce application/json @Param data body data.SysUser true "ID, 用户名, 昵称, 头像链接" @Success 200 {object} rhttp.Response{data=map[string]interface{},msg=string} "设置用户信息" @Router /user/SetSelfInfo [put]

func (*UserApi) SetToken

func (svr *UserApi) SetToken(c *gin.Context, token string, maxAge int)

func (*UserApi) SetUserAuthorities

func (svr *UserApi) SetUserAuthorities(c *gin.Context)

SetUserAuthorities @Tags SysUser @Summary 设置用户权限 @Security ApiKeyAuth @accept application/json @Produce application/json @Param data body dto.SetUserAuthorities true "用户UUID, 角色ID" @Success 200 {object} rhttp.Response{msg=string} "设置用户权限" @Router /user/setUserAuthorities [post]

func (*UserApi) SetUserAuthority

func (svr *UserApi) SetUserAuthority(c *gin.Context)

SetUserAuthority @Tags SysUser @Summary 更改用户权限 @Security ApiKeyAuth @accept application/json @Produce application/json @Param data body dto.SetUserAuth true "用户UUID, 角色ID" @Success 200 {object} rhttp.Response{msg=string} "设置用户权限" @Router /user/setUserAuthority [post]

func (*UserApi) SetUserInfo

func (svr *UserApi) SetUserInfo(c *gin.Context)

SetUserInfo @Tags SysUser @Summary 设置用户信息 @Security ApiKeyAuth @accept application/json @Produce application/json @Param data body data.SysUser true "ID, 用户名, 昵称, 头像链接" @Success 200 {object} rhttp.Response{data=map[string]interface{},msg=string} "设置用户信息" @Router /user/setUserInfo [put]

func (*UserApi) TokenNext

func (svr *UserApi) TokenNext(c *gin.Context, user data.SysUser)

TokenNext 登录以后签发jwt

Jump to

Keyboard shortcuts

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