dkqrlogin

package module
v0.0.0-...-abfc968 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: MIT Imports: 14 Imported by: 0

README

钉钉扫码登陆,依赖dingtalk服务,封装了部分请求实现

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DingQrClient

type DingQrClient struct {
	Dc         DingTalk
	TokenCatch *TTLCache
}

func Init

func Init(client DingTalk) *DingQrClient

type DingTalk

type DingTalk struct {
	InternalUrl string   //dingtalk 内网地址
	PublicUrl   string   //dingtalk 外网地址
	App         string   // app 名称
	Admins      []string // 管理员
	Secret      string   // 密钥
	// contains filtered or unexported fields
}

func (*DingTalk) QRUrl

func (d *DingTalk) QRUrl(redirect string) string

func (*DingTalk) UserInfo

func (d *DingTalk) UserInfo(ctx context.Context, code, codeType string) (*User, error)

UserInfo 根据登录的code获取用户信息

type ResultResponse

type ResultResponse struct {
	Message string
	Data    interface{}
}

type TTLCache

type TTLCache struct {
	// contains filtered or unexported fields
}

func NewTTL

func NewTTL() *TTLCache

func (*TTLCache) Load

func (c *TTLCache) Load(key interface{}) interface{}

func (*TTLCache) Store

func (c *TTLCache) Store(key, value interface{}, ttl time.Duration)

type User

type User struct {
	Active  bool
	Admin   bool
	Avatar  string
	Mobile  string
	Name    string
	Title   string
	UserID  string
	IsAdmin bool
}

Jump to

Keyboard shortcuts

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