qrcode

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

README

二维码接口

Documentation

Overview

二维码接口.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Download

func Download(ticket, filepath string, clt *http.Client) (written int64, err error)

Download 通过ticket换取二维码, 写入到 filepath 路径的文件.

如果 clt == nil 则默认用 util.DefaultHttpClient.

func DownloadToWriter

func DownloadToWriter(ticket string, writer io.Writer, clt *http.Client) (written int64, err error)

DownloadToWriter 通过ticket换取二维码, 写入到 writer.

如果 clt == nil 则默认用 util.DefaultHttpClient.

func GetWxaCodeUnlimit

func GetWxaCodeUnlimit(clt *core.Client, params WxaCodeParams) (contentType string, binary []byte, err error)

CreateTempQrcode 创建临时二维码.

sceneId:       场景值ID, 为32位非0整型
expireSeconds: 二维码有效时间, 以秒为单位

func QrcodePicURL

func QrcodePicURL(ticket string) string

二维码图片的URL, 可以通过此URL下载二维码 或者 在线显示此二维码.

func ShortURL

func ShortURL(clt *core.Client, longURL string) (shortURL string, err error)

ShortURL 将一条长链接转成短链接.

Types

type PermQrcode

type PermQrcode struct {
	Ticket string `json:"ticket"`
	URL    string `json:"url"`
}

func CreatePermQrcode

func CreatePermQrcode(clt *core.Client, sceneId int32) (qrcode *PermQrcode, err error)

CreatePermQrcode 创建永久二维码

sceneId: 场景值ID

func CreateStrScenePermQrcode

func CreateStrScenePermQrcode(clt *core.Client, sceneStr string) (qrcode *PermQrcode, err error)

CreateStrScenePermQrcode 创建永久二维码

sceneStr: 场景值ID(字符串形式的ID), 字符串类型, 长度限制为1到64

type TempQrcode

type TempQrcode struct {
	ExpireSeconds int `json:"expire_seconds,omitempty"`
	PermQrcode
}

func CreateStrSceneTempQrcode

func CreateStrSceneTempQrcode(clt *core.Client, sceneStr string, expireSeconds int) (qrcode *TempQrcode, err error)

CreateStrSceneTempQrcode 创建临时二维码.

sceneStr:      场景值ID(字符串形式的ID), 字符串类型, 长度限制为1到64
expireSeconds: 二维码有效时间, 以秒为单位

func CreateTempQrcode

func CreateTempQrcode(clt *core.Client, sceneId int32, expireSeconds int) (qrcode *TempQrcode, err error)

CreateTempQrcode 创建临时二维码.

sceneId:       场景值ID, 为32位非0整型
expireSeconds: 二维码有效时间, 以秒为单位

type WxaCodeParams

type WxaCodeParams struct {
	Scene     string
	Page      string
	Width     int
	LineColor color.Color
	AutoColor bool
	IsHyaline bool
}

Jump to

Keyboard shortcuts

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