Documentation
¶
Index ¶
- Constants
- func New() routes.Routes
- type Auth
- func (a *Auth) GetAllArticles(c *gin.Context)
- func (a *Auth) GetAllMenus(c *gin.Context)
- func (a *Auth) InitGlobalRoute(g *gin.RouterGroup)
- func (a *Auth) InitRoute(g *gin.RouterGroup)
- func (a *Auth) IsValidSession(c *gin.Context)
- func (a *Auth) LoginWithEmail(c *gin.Context)
- func (a *Auth) ResetPassword(c *gin.Context)
- func (a *Auth) UserLogin(c *gin.Context)
- func (a *Auth) UserLoginRefresh(c *gin.Context)
- func (a *Auth) UserRegister(c *gin.Context)
Constants ¶
const ( RefreshTokenExpired = 24 * time.Hour * 7 AccessTokenExpired = 2 * time.Hour )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Auth ¶
type Auth struct { }
func (*Auth) GetAllArticles ¶
GetAllArticles 获取所有文章 godoc @Summary 获取所有文章 @Schemes @Description 获取所有文章 @Tags auth @Accept json @Produce json @Success 200 {object} model.CommonResponse[model.GetUserResponse] @Failure 400 {object} model.CommonResponse[any] @Router /getallArticles [get]
func (*Auth) GetAllMenus ¶
GetAllMenus 获取所有菜单 godoc @Summary 获取所有菜单 @Schemes @Description 获取所有菜单 @Tags auth @Accept json @Produce json @Success 200 {object} model.CommonResponse[[]model.MenuItem] @Failure 400 {object} model.CommonResponse[any] @Router /getAllMenus [get]
func (*Auth) InitGlobalRoute ¶
func (a *Auth) InitGlobalRoute(g *gin.RouterGroup)
InitGlobalRoute 全局api,什么角色都可以调用
func (*Auth) InitRoute ¶
func (a *Auth) InitRoute(g *gin.RouterGroup)
func (*Auth) IsValidSession ¶
IsValidSession 是否登录 godoc @Summary 是否登录 @Schemes @Description 是否登录 @Tags auth @Accept json @Produce json @Param Authorization header string true "登录返回的Token" @Success 200 {object} model.CommonResponse[model.GetUserResponse] @Failure 400 {object} model.CommonResponse[any] @Router /isvalid [get]
func (*Auth) LoginWithEmail ¶
LoginWithEmail 邮箱登录 godoc @Summary 邮箱登录 @Schemes @Description 邮箱登录 @Tags auth @Accept json @Produce json @Param LoginWithEmailRequest body model.LoginWithEmailRequest true "邮箱, 密码, 验证码" @Success 200 {object} model.CommonResponse[model.TokenResponse] @Failure 400 {object} model.CommonResponse[any] @Router /loginWithEmail [post]
func (*Auth) UserLogin ¶
UserLogin 用户名密码登录 godoc @Summary 用户名密码登录 @Schemes @Description 用户名密码登录 @Tags auth @Accept json @Produce json @Param userInfo body model.UserLoginRequest true "用户名, 密码" @Success 200 {object} model.CommonResponse[model.TokenResponse] @Failure 400 {object} model.CommonResponse[any] @Router /login [post]
func (*Auth) UserLoginRefresh ¶
UserLoginRefresh 刷新登录令牌 godoc @Summary 刷新登录令牌 @Schemes @Description 刷新登录令牌 @Tags auth @Accept json @Produce json @Param Authorization header string true "用户Refresh Token" @Success 200 {object} model.CommonResponse[model.TokenResponse] @Failure 400 {object} model.CommonResponse[any] @Router /refresh [post]
func (*Auth) UserRegister ¶
UserRegister 注册普通用户 godoc @Summary 注册普通用户 @Schemes @Description 注册普通用户 @Tags auth @Accept json @Produce json @Param registerInfo body model.RegisterUserRequest true "用户注册信息" @Success 200 {object} model.CommonResponse[string] @Failure 400 {object} model.CommonResponse[any] @Router /register [post]