qrcode

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TOUTIAO 今日头条
	TOUTIAO = "toutiao" // 今日头条
	// TOUTIAOLITE 今日头条极速版
	TOUTIAOLITE = "toutiao_lite" // 今日头条极速版
	// DOUYIN 抖音
	DOUYIN = "douyin" // 抖音
	// DOUYINLITE 抖音极速版
	DOUYINLITE = "douyin_lite" // 抖音极速版
	// PIPIXIA 皮皮虾
	PIPIXIA = "pipixia" // 皮皮虾
	// HUOSHAN 火山小视频
	HUOSHAN = "huoshan" // 火山小视频
	// XIGUA 西瓜视频
	XIGUA = "xigua" // 西瓜视频
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Color

type Color struct {
	R string `json:"r"`
	G string `json:"g"`
	B string `json:"b"`
}

Color QRCode color

type QRCode

type QRCode struct {
	*credential.ContextConfig
}

QRCode 小程序码

func NewQRCode

func NewQRCode(ctxCfg *credential.ContextConfig) *QRCode

NewQRCode 实例

func (*QRCode) FetchCode

func (qrCode *QRCode) FetchCode(ctx context.Context, data QRCoder) (response []byte, err error)

FetchCode 获取小程序码

type QRCoder

type QRCoder struct {
	// 服务端 API 调用标识,获取方法
	AccessToken string `json:"access_token"`
	// 是打开二维码的字节系 app 名称,默认为今日头条,取值如下表所示
	AppName string `json:"appname,omitempty"`
	// 小程序/小游戏启动参数,小程序则格式为 encode({path}?{query}),小游戏则格式为 JSON 字符串,默认为空
	Path string `json:"path,omitempty"`
	// 二维码宽度,单位 px,最小 280px,最大 1280px,默认为 430px
	Width string `json:"width,omitempty"`
	// 二维码线条颜色,默认为黑色
	LineColor Color `json:"line_color,omitempty"`
	// 二维码背景颜色,默认为白色
	Background Color `json:"background,omitempty"`
	// 是否展示小程序/小游戏 icon,默认不展示
	SetIcon bool `json:"set_icon"`
}

QRCoder 小程序码参数

Jump to

Keyboard shortcuts

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