ticket

package
v1.1.8 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var URLGetTicket = "https://api.weixin.qq.com/cgi-bin/ticket/getticket"

Functions

This section is empty.

Types

type Config added in v1.1.8

type Config struct {
	KeySuffix string
}

type GetTicketResp

type GetTicketResp struct {
	common.BaseResp
	Ticket    string `json:"ticket"`     // string 临时票据,用于在获取授权链接时作为参数传入
	ExpiresIn int    `json:"expires_in"` // number	凭证有效时间,单位:秒。目前是7200秒之内的值
}

type Option added in v1.1.8

type Option func(*Config)

func KeySuffix added in v1.1.8

func KeySuffix(s string) Option

type SDK

type SDK struct {
	HttpCli            *http.Client
	RedisCli           redis.UniversalClient
	RedisSync          *redsync.Redsync
	GetTicketKey       string
	GetTicketLockerKey string
	Logger             common.Logger
}

func (*SDK) CallGetTicket

func (auth *SDK) CallGetTicket(ctx context.Context, accessToken string, typ string) (*GetTicketResp, error)

func (*SDK) DecodeGetTicketResp

func (auth *SDK) DecodeGetTicketResp(result map[string]string) *GetTicketResp

func (*SDK) GetTicket

func (auth *SDK) GetTicket(ctx context.Context, accessToken string, typ string, opts ...Option) (*GetTicketResp, error)

func (*SDK) GetTicketRespFromRedis

func (auth *SDK) GetTicketRespFromRedis(ctx context.Context, key string) (*GetTicketResp, error)

func (*SDK) SaveGetTicketRespToRedis

func (auth *SDK) SaveGetTicketRespToRedis(ctx context.Context, key string, tokenResp *GetTicketResp) error

Jump to

Keyboard shortcuts

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