Help us shape the future of Go! Take the 2026 Go Developer Survey

urlscheme

package
v2.1.14 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: Apache-2.0 Imports: 3 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// ExpireTypeTime 指定时间戳后失效
	ExpireTypeTime TExpireType = 0
	// ExpireTypeInterval 间隔指定天数后失效
	ExpireTypeInterval TExpireType = 1

	// EnvVersionRelease 正式版为"release"
	EnvVersionRelease EnvVersion = "release"
	// EnvVersionTrial 体验版为"trial"
	EnvVersionTrial EnvVersion = "trial"
	// EnvVersionDevelop 开发版为"develop"
	EnvVersionDevelop EnvVersion = "develop"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EnvVersion

type EnvVersion string

EnvVersion 要打开的小程序版本

type JumpWxa

type JumpWxa struct {
	Path  string `json:"path"`
	Query string `json:"query"`
	// envVersion 要打开的小程序版本。正式版为 "release",体验版为 "trial",开发版为 "develop"
	EnvVersion EnvVersion `json:"env_version,omitempty"`
}

JumpWxa 跳转到的目标小程序信息

type QueryScheme

type QueryScheme struct {
	// 小程序 scheme 码
	Scheme    string `json:"scheme"`
	QueryType int    `json:"query_type"`
}

QueryScheme 获取小程序访问scheme https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/url-scheme/urlscheme.query.html#参数

type QuotaInfo added in v2.1.9

type QuotaInfo struct {
	RemainVisitQuota int64 `json:"remain_visit_quota"`
}

QuotaInfo quota 配置

type ResQueryScheme added in v2.1.9

type ResQueryScheme struct {
	// 通用错误
	util.CommonError
	// scheme 配置
	SchemeInfo SchemeInfo `json:"scheme_info"`
	// 访问该链接的openid,没有用户访问过则为空字符串
	VisitOpenid string    `json:"visit_openid"`
	QuotaInfo   QuotaInfo `json:"quota_info"`
}

ResQueryScheme 返回结构体 https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/url-scheme/urlscheme.query.html#参数

type SchemeInfo

type SchemeInfo struct {
	// 小程序 appid。
	AppID string `json:"appid"`
	// 小程序页面路径。
	Path string `json:"path"`
	// 小程序页面query。
	Query string `json:"query"`
	// 创建时间,为 Unix 时间戳。
	CreateTime int64 `json:"create_time"`
	// 到期失效时间,为 Unix 时间戳,0 表示永久生效
	ExpireTime int64 `json:"expire_time"`
	// 要打开的小程序版本。正式版为"release",体验版为"trial",开发版为"develop"。
	EnvVersion EnvVersion `json:"env_version"`
}

SchemeInfo scheme 配置

type TExpireType

type TExpireType int

TExpireType 失效类型 (指定时间戳/指定间隔)

type URLScheme

type URLScheme struct {
	*context.Context
}

URLScheme 小程序 URL Scheme

func NewURLScheme

func NewURLScheme(ctx *context.Context) *URLScheme

NewURLScheme 实例化

func (*URLScheme) Generate

func (u *URLScheme) Generate(params *USParams) (string, error)

Generate 生成url link

func (*URLScheme) GenerateNFC added in v2.1.9

func (u *URLScheme) GenerateNFC(params *USParams) (string, error)

GenerateNFC 获取 NFC 的小程序 scheme see https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/qrcode-link/url-scheme/generateNFCScheme.html

func (*URLScheme) QueryScheme

func (u *URLScheme) QueryScheme(querySchemeParams QueryScheme) (schemeInfo SchemeInfo, visitOpenid string, err error)

QueryScheme 查询小程序 scheme 码

func (*URLScheme) QuerySchemeWithRes added in v2.1.9

func (u *URLScheme) QuerySchemeWithRes(req QueryScheme) (*ResQueryScheme, error)

QuerySchemeWithRes 查询scheme码 see https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/qrcode-link/url-scheme/queryScheme.html

type USParams

type USParams struct {
	JumpWxa        *JumpWxa    `json:"jump_wxa,omitempty"`
	ExpireType     TExpireType `json:"expire_type,omitempty"`
	ExpireTime     int64       `json:"expire_time,omitempty"`
	ExpireInterval int         `json:"expire_interval,omitempty"`
	IsExpire       bool        `json:"is_expire,omitempty"`
	ModelID        string      `json:"model_id,omitempty"`
	Sn             string      `json:"sn,omitempty"`
}

USParams 请求参数 https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/url-scheme/urlscheme.generate.html#请求参数

type USResult

type USResult struct {
	util.CommonError

	OpenLink string `json:"openlink"`
}

USResult 返回的结果 https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/url-scheme/urlscheme.generate.html#返回值

Jump to

Keyboard shortcuts

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