public

package
v0.1.23 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUserNameOrPassword = errors.New("用户名或密码错误")
	ErrCaptcha            = errors.New("验证码错误")
)

Functions

func AdminLogin

func AdminLogin(ctx *gin.Context)

AdminLogin 后台登录

func Captcha

func Captcha(ctx *gin.Context)

Captcha 生成验证码

func CleanToken

func CleanToken(authorityType int, userId string) error

CleanToken 清空 token

func Clear

func Clear(ctx *gin.Context)

Clear 清空 token

func DelToken

func DelToken(token string) error

DelToken 删除token

func Group

func Group(group *gin.RouterGroup)

Group 认证模块

func Logout

func Logout(ctx *gin.Context)

Logout 退出

Types

type LoginRequest

type LoginRequest struct {
	Username      string `json:"username" form:"username" binding:"required"`
	Password      string `json:"password" form:"password" binding:"required"`
	Captcha       string `json:"captcha" form:"captcha" binding:"dev-required"`
	CaptchaId     string `json:"captchaId" form:"captchaId" binding:"dev-required"`
	AuthorityType int    `json:"authorityType" `
}

LoginRequest 登录

func (*LoginRequest) Request

func (req *LoginRequest) Request(ctx *gin.Context) error

type LoginResponse

type LoginResponse struct {
	User  interface{} `json:"user"`
	Token string      `json:"accessToken"`
}

func GetAccessToken

func GetAccessToken(req *LoginRequest) (*LoginResponse, error)

GetAccessToken 登录

type MiniCodeResponse

type MiniCodeResponse struct {
	SessionKey string `json:"sessionKey" form:"sessionKey" `
	OpenId     string `json:"openId" form:"openId" `
	UnionId    string `json:"unionId" form:"unionId"`
}

Jump to

Keyboard shortcuts

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