minip

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AICrop

func AICrop(imgPath string, result *ResultAICrop) wx.Action

AICrop 图像处理 - 图片智能裁切

func AICropByURL

func AICropByURL(imgURL string, result *ResultAICrop) wx.Action

AICropByURL 图像处理 - 图片智能裁切

func AddSubscribeTemplate

func AddSubscribeTemplate(params *ParamsSubscribeTemplAdd, result *ResultSubscribeTemplAdd) wx.Action

AddSubscribeTemplate 订阅消息 - 组合模板并添加至帐号下的个人模板库

func ApplyPlugin

func ApplyPlugin(pluginAppID, reason string) wx.Action

ApplyPlugin 向插件开发者发起使用插件的申请

func CheckEncryptedData

func CheckEncryptedData(encryptedData string, result *ResultEncryptedDataCheck) wx.Action

CheckEncryptedData 用户信息 - 检查加密信息是否由微信生成(当前只支持手机号加密数据),只能检测最近3天生成的加密数据

func CreateQRCode

func CreateQRCode(pagepath string, width int, qrcode *QRCode) wx.Action

CreateQRCode 创建小程序二维码(数量有限)

func DeleteSubscribeTemplate

func DeleteSubscribeTemplate(priTmplID string) wx.Action

DeleteSubscribeTemplate 订阅消息 - 删除帐号下的个人模板

func GenerateScheme

func GenerateScheme(params *ParamsSchemeGenerate, result *ResultSchemeGenerate) wx.Action

GenerateScheme 获取小程序 scheme 码,适用于短信、邮件、外部网页、微信内等拉起小程序的业务场景。

func GenerateShortLink(pageURL, pageTitle string, isPermanent bool, result *ResultShortLink) wx.Action

GenerateShortLink Short Link - 获取小程序 Short Link,适用于微信内拉起小程序的业务场景。目前只开放给电商类目(具体包含以下一级类目:电商平台、商家自营、跨境电商)。

func GenerateURLLink(params *ParamsURLLinkGenerate, result *ResultURLLinkGenerate) wx.Action

GenerateURLLink 获取小程序 URL Link,适用于短信、邮件、网页、微信内等拉起小程序的业务场景。

func GetPaidUnionIDByOutTradeNO

func GetPaidUnionIDByOutTradeNO(openid, mchid, outTradeNO string, result *ResultPaidUnionID) wx.Action

GetPaidUnionIDByOutTradeNO 用户信息 - 用户支付完成后,获取该用户的 UnionId,无需用户授权

func GetPaidUnionIDByTransactionID

func GetPaidUnionIDByTransactionID(openid, transactionID string, result *ResultPaidUnionID) wx.Action

GetPaidUnionIDByTransactionID 用户信息 - 用户支付完成后,获取该用户的 UnionId,无需用户授权

func GetPhoneNumber added in v1.2.1

func GetPhoneNumber(code string, result *ResultPhoneNumber) wx.Action

func GetPubTemplateKeyWords

func GetPubTemplateKeyWords(tid string, result *ResultPubTemplKeywords) wx.Action

GetPubTemplateKeyWords 订阅消息 - 获取模板标题下的关键词列表

func GetPubTemplateTitles

func GetPubTemplateTitles(ids string, start, limit int, result *ResultPubTemplTitles) wx.Action

GetPubTemplateTitles 订阅消息 - 获取帐号所属类目下的公共模板标题(多个类目id用逗号隔开)

func GetQRCode

func GetQRCode(params *ParamsQRCodeGet, qrcode *QRCode) wx.Action

GetQRCode 获取小程序二维码(数量有限)

func GetSubscribeCategory

func GetSubscribeCategory(result *ResultSubscribeCategory) wx.Action

GetSubscribeCategory 订阅消息 - 获取小程序账号的类目

func GetTempMedia

func GetTempMedia(mediaID string, media *Media) wx.Action

GetTempMedia 客服消息 - 获取客服消息内的临时素材

func GetUnlimitQRCode

func GetUnlimitQRCode(params *ParamsQRCodeUnlimit, qrcode *QRCode) wx.Action

GetUnlimitQRCode 获取小程序二维码(数量不限)

func GetUserRiskRank

func GetUserRiskRank(params *ParamsUserRisk, result *ResultUserRisk) wx.Action

GetUserRiskRank 安全风控 - 获取用户的安全等级(无需用户授权)

func ImageSecCheck

func ImageSecCheck(imgPath string) wx.Action

ImageSecCheck 校验一张图片是否含有违法违规内容

func InvokeService

func InvokeService(params *ParamsServiceInvoke, result *ResultServiceInvoke) wx.Action

InvokeService 服务市场 - 调用服务平台提供的服务

func ListPlugin

func ListPlugin(result *ResultPluginList) wx.Action

ListPlugin 查询已添加的插件

func ListPluginDevApply

func ListPluginDevApply(page, num int, result *ResultPluginDevApplyList) wx.Action

ListPluginDevApply 获取当前所有插件使用方(供插件开发者调用)

func ListSubscribeTemplate

func ListSubscribeTemplate(result *ResultSubscribeTemplList) wx.Action

ListSubscribeTemplate 订阅消息 - 获取当前帐号下的个人模板列表

func MediaCheckAsync

func MediaCheckAsync(params *ParamsMediaCheckAsync, result *ResultMediaCheckAsync) wx.Action

MediaCheckAsync 异步校验图片/音频是否含有违法违规内容

func MsgSecCheck

func MsgSecCheck(params *ParamsMsgCheck, result *ResultMsgCheck) wx.Action

MsgSecCheck 检查一段文本是否含有违法违规内容

func OCRBankCard

func OCRBankCard(mode OCRMode, imgPath string, result *ResultBankCardOCR) wx.Action

OCRBankCard OCR - 银行卡识别

func OCRBankCardByURL

func OCRBankCardByURL(mode OCRMode, imgURL string, result *ResultBankCardOCR) wx.Action

OCRBankCardByURL OCR - 银行卡识别

func OCRBusinessLicense

func OCRBusinessLicense(mode OCRMode, imgPath string, result *ResultBusinessLicenseOCR) wx.Action

OCRBusinessLicense OCR - 营业执照识别

func OCRBusinessLicenseByURL

func OCRBusinessLicenseByURL(mode OCRMode, imgURL string, result *ResultBusinessLicenseOCR) wx.Action

OCRBusinessLicenseByURL OCR - 营业执照识别

func OCRComm

func OCRComm(mode OCRMode, imgPath string, result *ResultCommOCR) wx.Action

OCRComm OCR - 通用印刷体识别

func OCRCommByURL

func OCRCommByURL(mode OCRMode, imgURL string, result *ResultCommOCR) wx.Action

OCRCommByURL OCR - 通用印刷体识别

func OCRDriverLicense

func OCRDriverLicense(mode OCRMode, imgPath string, result *ResultDriverLicenseOCR) wx.Action

OCRDriverLicense OCR - 驾照识别

func OCRDriverLicenseByURL

func OCRDriverLicenseByURL(mode OCRMode, imgURL string, result *ResultDriverLicenseOCR) wx.Action

OCRDriverLicenseByURL OCR - 驾照识别

func OCRIDCardBack

func OCRIDCardBack(mode OCRMode, imgPath string, result *ResultIDCardBackOCR) wx.Action

OCRIDCardBack OCR - 身份证背面识别

func OCRIDCardBackByURL

func OCRIDCardBackByURL(mode OCRMode, imgURL string, result *ResultIDCardBackOCR) wx.Action

OCRIDCardBackByURL OCR - 身份证背面识别

func OCRIDCardFront

func OCRIDCardFront(mode OCRMode, imgPath string, result *ResultIDCardFrontOCR) wx.Action

OCRIDCardFront OCR - 身份证前面识别

func OCRIDCardFrontByURL

func OCRIDCardFrontByURL(mode OCRMode, imgURL string, result *ResultIDCardFrontOCR) wx.Action

OCRIDCardFrontByURL OCR - 身份证前面识别

func OCRPlateNumber

func OCRPlateNumber(mode OCRMode, imgPath string, result *ResultPlateNumberOCR) wx.Action

OCRPlateNumber OCR - 车牌号识别

func OCRPlateNumberByURL

func OCRPlateNumberByURL(mode OCRMode, imgURL string, result *ResultPlateNumberOCR) wx.Action

OCRPlateNumberByURL OCR - 车牌号识别

func OCRVehicleLicense

func OCRVehicleLicense(mode OCRMode, imgPath string, result *ResultVehicleLicenseOCR) wx.Action

OCRVehicleLicense OCR - 行驶证识别

func OCRVehicleLicenseByURL

func OCRVehicleLicenseByURL(mode OCRMode, imgURL string, result *ResultVehicleLicenseOCR) wx.Action

OCRVehicleLicenseByURL OCR - 行驶证识别

func QueryScheme

func QueryScheme(scheme string, result *ResultSchemeQuery) wx.Action

QueryScheme 查询小程序 scheme 码,及长期有效 quota。

func QueryURLLink(urllink string, result *ResultURLLinkQuery) wx.Action

QueryURLLink 查询小程序 url_link 配置,及长期有效 quota。

func ScanQRCode

func ScanQRCode(imgPath string, result *ResultQRCodeScan) wx.Action

ScanQRCode 图像处理 - 条码/二维码识别

func ScanQRCodeByURL

func ScanQRCodeByURL(imgURL string, result *ResultQRCodeScan) wx.Action

ScanQRCodeByURL 图像处理 - 条码/二维码识别

func SendKFImageMsg

func SendKFImageMsg(openid, mediaID string) wx.Action

SendKFImageMsg 客服消息 - 发送客服图片消息(媒体ID,通过素材接口上传获得)

func SendKFLinkMsg

func SendKFLinkMsg(openid string, link *KFLink) wx.Action

SendKFLinkMsg 客服消息 - 发送客服图文链接消息

func SendKFMinipMsg

func SendKFMinipMsg(openid string, minipPage *KFMinipPage) wx.Action

SendKFMinipMsg 客服消息 - 发送客服小程序卡片消息

func SendKFTextMsg

func SendKFTextMsg(openid, content string) wx.Action

SendKFTextMsg 客服消息 - 发送客服文本消息(支持插入跳小程序的文字链)

func SendKFTyping

func SendKFTyping(openid string, cmd TypingCmd) wx.Action

SendKFTyping 客服消息 - 下发当前输入状态(仅支持客服消息)

func SendSubscribeMsg

func SendSubscribeMsg(msg *SubscribeMsg) wx.Action

SendSubscribeMsg 订阅消息 - 发送订阅消息

func SendUniformMsg

func SendUniformMsg(touser string, msg *TemplateMsg) wx.Action

SendUniformMsg 统一服务消息 - 发送统一服务消息

func SetDevPluginApplyStatus

func SetDevPluginApplyStatus(action PluginAction, appid string, reason string) wx.Action

SetDevPluginApplyStatus 修改插件使用申请的状态(供插件开发者调用)

func SoterVerify

func SoterVerify(openID, jsonStr, jsonSign string, result *ResultSoterVerify) wx.Action

SoterVerify 生物认证 - 生物认证秘钥签名验证

func SuperreSolution

func SuperreSolution(imgPath string, result *ResultSuperreSolution) wx.Action

SuperreSolution 图像处理 - 图片高清化

func SuperreSolutionByURL

func SuperreSolutionByURL(imgURL string, result *ResultSuperreSolution) wx.Action

SuperreSolutionByURL 图像处理 - 图片高清化

func UnbindPlugin

func UnbindPlugin(pluginAppID string) wx.Action

UnbindPlugin 删除已添加的插件

func UploadTempMedia

func UploadTempMedia(mediaType MediaType, mediaPath string, result *ResultMediaUpload) wx.Action

UploadTempMedia 客服消息 - 上传临时素材到微信服务器

func UploadTempMediaByURL

func UploadTempMediaByURL(mediaType MediaType, filename, url string, result *ResultMediaUpload) wx.Action

UploadTempMediaByURL 客服消息 - 上传临时素材到微信服务器

Types

type AccessToken

type AccessToken struct {
	Token     string `json:"access_token"`
	ExpiresIn int64  `json:"expires_in"`
}

AccessToken 小程序access_token

type AuthInfo

type AuthInfo struct {
	OpenID    string    `json:"openId"`
	Language  string    `json:"language"`
	City      string    `json:"city"`
	Province  string    `json:"province"`
	AvatarURL string    `json:"avatarUrl"`
	Nickname  string    `json:"nickName"`
	Gender    int       `json:"gender"`
	Country   string    `json:"country"`
	UnionID   string    `json:"unionId"`
	Watermark Watermark `json:"watermark"`
}

AuthInfo 用户信息

type AuthSession

type AuthSession struct {
	SessionKey string `json:"session_key"`
	OpenID     string `json:"openid"`
	UnionID    string `json:"unionid"`
}

AuthSession 小程序授权Session

type CloudBase

type CloudBase struct {
	Env           string `json:"env"`
	Domain        string `json:"domain,omitempty"`
	Path          string `json:"path,omitempty"`
	Query         string `json:"query,omitempty"`
	ResourceAppID string `json:"resource_appid,omitempty"`
}

type CommOCRItem

type CommOCRItem struct {
	Text string        `json:"text"`
	Pos  ImagePosition `json:"pos"`
}

CommOCRItem 通用印刷体内容项

type CropPosition

type CropPosition struct {
	CropLeft   int `json:"crop_left"`
	CropTop    int `json:"crop_top"`
	CropRight  int `json:"crop_right"`
	CropBottom int `json:"crop_bottom"`
}

CropPosition 裁切位置

type EnvVersion

type EnvVersion string
const (
	EnvRelease EnvVersion = "release"
	EnvTrial   EnvVersion = "trial"
	EnvDevelop EnvVersion = "develop"
)

type ImagePosition

type ImagePosition struct {
	LeftTop     Position `json:"left_top"`
	RightTop    Position `json:"right_top"`
	RightBottom Position `json:"right_bottom"`
	LeftBottom  Position `json:"left_bottom"`
}

ImagePosition 图片位置

type ImageSize

type ImageSize struct {
	W int `json:"w"`
	H int `json:"h"`
}

ImageSize 图片尺寸

type KFLink struct {
	Title       string `json:"title"`       // 消息标题
	Description string `json:"description"` // 图文链接消息
	URL         string `json:"url"`         // 图文链接消息被点击后跳转的链接
	ThumbURL    string `json:"thumb_url"`   // 图文链接消息的图片链接,支持 JPG、PNG 格式,较好的效果为大图 640 wx.M 320,小图 80 wx.M 80
}

KFLink 客服消息链接

type KFMedia

type KFMedia struct {
	MediaID string `json:"media_id"`
}

KFMedia 客服消息媒体(图片等)

type KFMinipPage

type KFMinipPage struct {
	Title        string `json:"title"`          // 消息标题
	PagePath     string `json:"pagepath"`       // 小程序的页面路径,跟app.json对齐,支持参数,比如pages/index/index?foo=bar
	ThumbMediaID string `json:"thumb_media_id"` // 小程序消息卡片的封面, image 类型的 media_id,通过 新增素材接口 上传图片文件获得,建议大小为 520*416
}

KFMinipPage 客服小程序卡片

type KFMsg

type KFMsg struct {
	ToUser    string        `json:"touser"`
	MsgType   event.MsgType `json:"msgtype"`
	Text      *KFText       `json:"text,omitempty"`
	Image     *KFMedia      `json:"image,omitempty"`
	Link      *KFLink       `json:"link,omitempty"`
	MinipPage *KFMinipPage  `json:"miniprogrampage,omitempty"`
}

type KFText

type KFText struct {
	Content string `json:"content"`
}

KFText 客服消息文本

type KFTyping

type KFTyping struct {
	ToUser  string    `json:"touser"`
	Command TypingCmd `json:"command"`
}

type KeywordEnumValue

type KeywordEnumValue struct {
	EnumValueList []string `json:"enumValueList"`
	KeywordCode   string   `json:"keywordCode"`
}

type Media

type Media struct {
	Buffer []byte
}

Media 临时素材

type MediaType

type MediaType string

MediaType 素材类型

const MediaImage MediaType = "image" // 图片

微信支持的素材类型

type Minip

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

Minip 微信小程序

func New

func New(appid, appsecret string, options ...Option) *Minip

New returns new wechat mini program

func (*Minip) AccessToken

func (mp *Minip) AccessToken(ctx context.Context, options ...wx.HTTPOption) (*AccessToken, error)

AccessToken 获取小程序的access_token

func (*Minip) AppID

func (mp *Minip) AppID() string

AppID returns appid

func (*Minip) AppSecret

func (mp *Minip) AppSecret() string

AppSecret returns app secret

func (*Minip) Code2Session

func (mp *Minip) Code2Session(ctx context.Context, code string, options ...wx.HTTPOption) (*AuthSession, error)

Code2Session 获取小程序授权的session_key

func (*Minip) DecryptAuthInfo

func (mp *Minip) DecryptAuthInfo(sessionKey, iv, encryptedData string, result *AuthInfo) error

DecryptAuthInfo 解密授权信息

func (*Minip) DecryptEventMessage

func (mp *Minip) DecryptEventMessage(encrypt string) (wx.WXML, error)

DecryptEventMessage 事件消息解密

func (*Minip) Do

func (mp *Minip) Do(ctx context.Context, accessToken string, action wx.Action, options ...wx.HTTPOption) error

Do exec action

func (*Minip) VerifyEventSign

func (mp *Minip) VerifyEventSign(signature string, items ...string) bool

VerifyEventSign 验证事件消息签名 验证消息来自微信服务器,使用:signature、timestamp、nonce(若验证成功,请原样返回echostr参数内容) 验证事件消息签名,使用:msg_signature、timestamp、nonce、msg_encrypt [参考](https://developers.weixin.qq.com/miniprogram/dev/framework/server-ability/message-push.html)

type MinipState

type MinipState string

MinipState 小程序类型

const (
	MinipDeveloper MinipState = "developer" // 开发版
	MinipTrial     MinipState = "trial"     // 体验版
	MinipFormal    MinipState = "formal"    // 正式版
)

type MsgCheckItem added in v1.2.4

type MsgCheckItem struct {
	Strategy string `json:"strategy"`
	ErrCode  int    `json:"errcode"`
	Suggest  string `json:"suggest"`
	Label    int    `json:"label"`
	Keyword  string `json:"keyword"`
	Prob     int    `json:"prob"`
}

type MsgCheckRet added in v1.2.4

type MsgCheckRet struct {
	Suggest string `json:"suggest"`
	Label   int    `json:"label"`
}

type MsgMinip

type MsgMinip struct {
	AppID    string `json:"appid"`    // 所需跳转到的小程序appid(该小程序appid必须与发模板消息的公众号是绑定关联关系,暂不支持小游戏)
	PagePath string `json:"pagepath"` // 所需跳转到小程序的具体页面路径,支持带参数,(示例index?foo=bar),要求该小程序已发布,暂不支持小游戏
}

MsgMinip 跳转小程序

type MsgTemplData

type MsgTemplData map[string]*MsgTemplValue

MsgTemplData 消息模板内容

type MsgTemplValue

type MsgTemplValue struct {
	Value string `json:"value"`
	Color string `json:"color,omitempty"`
}

type OCRMode

type OCRMode string

OCRMode 识别模式

var (
	OCRPhoto OCRMode = "photo" // 拍照模式
	OCRScan  OCRMode = "scan"  // 扫描模式
)

微信支持的识别模式

type OCRPosition

type OCRPosition struct {
	Pos ImagePosition `json:"pos"`
}

OCRPosition 识别位置

type Option added in v1.3.0

type Option func(mp *Minip)

Option 小程序配置项

func WithClient added in v1.3.0

func WithClient(c *http.Client) Option

WithClient 设置 HTTP Client

func WithMockClient added in v1.3.0

func WithMockClient(c wx.HTTPClient) Option

WithMockClient 设置 Mock Client

func WithNonce added in v1.3.0

func WithNonce(f func() string) Option

WithNonce 设置 Nonce(加密随机串)

func WithServerConfig added in v1.3.0

func WithServerConfig(token, aeskey string) Option

WithServerConfig 设置服务器配置 [参考](https://developers.weixin.qq.com/doc/offiaccount/Basic_Information/Access_Overview.html)

type ParamsDevPluginApplyStatus

type ParamsDevPluginApplyStatus struct {
	Action PluginAction `json:"action"`
	AppID  string       `json:"appid,omitempty"`
	Reason string       `json:"reason,omitempty"`
}

type ParamsEncryptedDataCheck

type ParamsEncryptedDataCheck struct {
	EncryptedMsgHash string `json:"encrypted_msg_hash"` // 加密数据的sha256,通过Hex(Base16)编码后的字符串
}

type ParamsMediaCheckAsync

type ParamsMediaCheckAsync struct {
	MediaType SecMediaType  `json:"media_type"`
	MediaURL  string        `json:"media_url"`
	Version   int           `json:"version"` // 接口版本号,2.0版本为固定值2
	Scene     SecCheckScene `json:"scene"`   // 场景枚举值
	OpenID    string        `json:"openid"`  // 用户的openid(用户需在近两小时访问过小程序)
}

type ParamsMsgCheck added in v1.2.4

type ParamsMsgCheck struct {
	Content   string        `json:"content"`             // 需检测的文本内容,文本字数的上限为2500字,需使用UTF-8编码
	Version   int           `json:"version"`             // 接口版本号,2.0版本为固定值2
	Scene     SecCheckScene `json:"scene"`               // 场景枚举值
	OpenID    string        `json:"openid"`              // 用户的openid(用户需在近两小时访问过小程序)
	Title     string        `json:"title,omitempty"`     // 文本标题,需使用UTF-8编码
	Nickname  string        `json:"nickname,omitempty"`  // 用户昵称,需使用UTF-8编码
	Signature string        `json:"signature,omitempty"` // 个性签名,该参数仅在资料类场景有效(scene=1),需使用UTF-8编码
}

type ParamsPhoneNumber added in v1.2.1

type ParamsPhoneNumber struct {
	Code string `json:"code"`
}

type ParamsPluginApply

type ParamsPluginApply struct {
	Action      PluginAction `json:"action"`
	PluginAppID string       `json:"plugin_appid"`
	Reason      string       `json:"reason"`
}

type ParamsPluginDevApplyList

type ParamsPluginDevApplyList struct {
	Action PluginAction `json:"action"`
	Page   int          `json:"page"`
	Num    int          `json:"num"`
}

type ParamsPluginList

type ParamsPluginList struct {
	Action PluginAction `json:"action"`
}

type ParamsPluginUnbind

type ParamsPluginUnbind struct {
	Action      PluginAction `json:"action"`
	PluginAppID string       `json:"plugin_appid"`
}

type ParamsQRCodeCreate

type ParamsQRCodeCreate struct {
	Path  string `json:"path"`            // 扫码进入的小程序页面路径,最大长度 128 字节,不能为空;对于小游戏,可以只传入 query 部分,来实现传参效果,如:传入 "?foo=bar",即可在 wx.getLaunchOptionsSync 接口中的 query 参数获取到 {foo:"bar"}。
	Width int    `json:"width,omitempty"` // 二维码的宽度,单位 px。最小 280px,最大 1280px
}

type ParamsQRCodeGet

type ParamsQRCodeGet struct {
	Path      string `json:"path"`                 // 扫码进入的小程序页面路径,最大长度 128 字节,不能为空;对于小游戏,可以只传入 query 部分,来实现传参效果,如:传入 "?foo=bar",即可在 wx.getLaunchOptionsSync 接口中的 query 参数获取到 {foo:"bar"}。
	Width     int    `json:"width,omitempty"`      // 二维码的宽度,单位 px。最小 280px,最大 1280px
	AutoColor bool   `json:"auto_color,omitempty"` // 自动配置线条颜色,如果颜色依然是黑色,则说明不建议配置主色调
	LineColor *RGB   `json:"line_color,omitempty"` // auto_color 为 false 时生效,使用 rgb 设置颜色,十进制表示,默认:{"r":0,"g":0,"b":0}
	IsHyaline bool   `json:"is_hyaline,omitempty"` // 是否需要透明底色,为 true 时,生成透明底色的小程序码
}

type ParamsQRCodeUnlimit

type ParamsQRCodeUnlimit struct {
	Scene      string     `json:"scene"`                 // 最大32个可见字符,只支持数字,大小写英文以及部分特殊字符:!#$&'()*+,/:;=?@-._~,其它字符请自行编码为合法字符(因不支持 %,中文无法使用 urlencode 处理,请使用其他编码方式)
	Page       string     `json:"page,omitempty"`        // 页面 page,例如 pages/index/index,根路径前不要填加 /,不能携带参数(参数请放在scene字段里),如果不填写这个字段,默认跳主页面
	CheckPath  bool       `json:"check_path,omitempty"`  // 检查page 是否存在,为 true 时 page 必须是已经发布的小程序存在的页面(否则报错);为 false 时允许小程序未发布或者 page 不存在, 但 page 有数量上限(60000个)请勿滥用
	EnvVersion EnvVersion `json:"env_version,omitempty"` // 要打开的小程序版本。正式版为 "release",体验版为 "trial",开发版为 "develop"
	Width      int        `json:"width,omitempty"`       // 二维码的宽度,单位 px。最小 280px,最大 1280px
	AutoColor  bool       `json:"auto_color,omitempty"`  // 自动配置线条颜色,如果颜色依然是黑色,则说明不建议配置主色调
	LineColor  *RGB       `json:"line_color,omitempty"`  // auto_color 为 false 时生效,使用 rgb 设置颜色,十进制表示,默认:{"r":0,"g":0,"b":0}
	IsHyaline  bool       `json:"is_hyaline,omitempty"`  // 是否需要透明底色,为 true 时,生成透明底色的小程序码
}

type ParamsSchemeGenerate

type ParamsSchemeGenerate struct {
	JumpWxa        *SchemeJumpWxa `json:"jump_wxa,omitempty"`
	IsExpire       bool           `json:"is_expire,omitempty"`
	ExpireType     int            `json:"expire_type,omitempty"`
	ExpireTime     int64          `json:"expire_time,omitempty"`
	ExpireInterval int            `json:"expire_interval,omitempty"`
}

type ParamsSchemeQuery

type ParamsSchemeQuery struct {
	Scheme string `json:"scheme"`
}

type ParamsServiceInvoke

type ParamsServiceInvoke struct {
	Service     string `json:"service"`       // 服务ID
	API         string `json:"api"`           // 接口名
	Data        wx.M   `json:"data"`          // 服务提供方接口定义的 JSON 格式的数据
	ClientMsgID string `json:"client_msg_id"` // 随机字符串ID,调用方请求的唯一标识
}

ParamsServiceInvoke 服务调用参数

type ParamsShortLink struct {
	PageURL     string `json:"page_url"`
	PageTitle   string `json:"page_title"`
	ISPermanent bool   `json:"is_permanent"`
}

type ParamsSoterVerify

type ParamsSoterVerify struct {
	OpenID        string `json:"openid"`         // 用户 openid
	JSONString    string `json:"json_string"`    // 通过 wx.startSoterAuthentication 成功回调获得的 resultJSON 字段
	JSONSignature string `json:"json_signature"` // 通过 wx.startSoterAuthentication 成功回调获得的 resultJSONSignature 字段
}

ParamsSoterVerify 生物认证秘钥签名验证参数

type ParamsSubscribeTemplAdd

type ParamsSubscribeTemplAdd struct {
	TID       string `json:"tid"`
	KidList   []int  `json:"kidList"`
	SceneDesc string `json:"sceneDesc"`
}

type ParamsSubscribeTemplDelete

type ParamsSubscribeTemplDelete struct {
	PriTmplID string `json:"priTmplId"`
}

type ParamsURLLinkGenerate

type ParamsURLLinkGenerate struct {
	Path           string     `json:"path,omitempty"`
	Query          string     `json:"query,omitempty"`
	IsExpire       bool       `json:"is_expire,omitempty"`
	ExpireType     int        `json:"expire_type,omitempty"`
	ExpireTime     int64      `json:"expire_time,omitempty"`
	ExpireInterval int        `json:"expire_interval,omitempty"`
	EnvVersion     EnvVersion `json:"env_version,omitempty"`
	CloudBase      *CloudBase `json:"cloud_base,omitempty"`
}

type ParamsURLLinkQuery

type ParamsURLLinkQuery struct {
	URLLink string `json:"url_link"`
}

type ParamsUserRisk

type ParamsUserRisk struct {
	AppID        string    `json:"appid"`                   // 小程序appid
	OpenID       string    `json:"openid"`                  // 用户的openid
	Scene        RiskScene `json:"scene"`                   // 场景值,0:注册,1:营销作弊
	MobileNO     string    `json:"mobile_no,omitempty"`     // 用户手机号
	ClientIP     string    `json:"client_ip"`               // 用户访问源ip
	EmailAddress string    `json:"email_address,omitempty"` // 用户邮箱地址
	ExtendedInfo string    `json:"extended_info,omitempty"` // 额外补充信息
	IsTest       bool      `json:"is_test,omitempty"`       // false:正式调用,true:测试调用
}

ParamsUserRisk 用户风控参数

type PhoneInfo

type PhoneInfo struct {
	PhoneNumber     string    `json:"phoneNumber"`     // 用户绑定的手机号(国外手机号会有区号)
	PurePhoneNumber string    `json:"purePhoneNumber"` // 没有区号的手机号
	CountryCode     string    `json:"countryCode"`     // 区号
	Watermark       Watermark `json:"watermark"`       // 数据水印
}

type PluginAction

type PluginAction string

PluginAction defines for plugin action params

var (
	PluginApply        PluginAction = "apply"          // 向插件开发者发起使用插件的申请
	PluginDevApplyList PluginAction = "dev_apply_list" // 获取当前所有插件使用方(供插件开发者调用)
	PluginList         PluginAction = "list"           // 查询已添加的插件
	PluginDevAgree     PluginAction = "dev_agree"      // 同意申请
	PluginDevRefuse    PluginAction = "dev_refuse"     // 拒绝申请
	PluginDevDelete    PluginAction = "dev_delete"     // 删除已拒绝的申请者
	PluginUnbind       PluginAction = "unbind"         // 删除已添加的插件
)

微信支持的插件行为

type PluginDevApplyInfo

type PluginDevApplyInfo struct {
	AppID      string `json:"appid"`       // 使用者的appid
	Status     int    `json:"status"`      // 插件状态
	Nickname   string `json:"nickname"`    // 使用者的昵称
	HeadImgURL string `json:"headimgurl"`  // 使用者的头像
	Categories []wx.M `json:"categories"`  // 使用者的类目
	CreateTime string `json:"create_time"` // 使用者的申请时间
	ApplyURL   string `json:"apply_url"`   // 使用者的小程序码
	Reason     string `json:"reason"`      // 使用者的申请说明
}

PluginDevApplyInfo 插件使用方信息

type PluginInfo

type PluginInfo struct {
	AppID      string `json:"appid"`      // 插件 appId
	Status     int    `json:"status"`     // 插件状态
	Nickname   string `json:"nickname"`   // 插件昵称
	HeadImgURL string `json:"headimgurl"` // 插件头像
}

PluginInfo 插件信息

type Position

type Position struct {
	X int `json:"x"`
	Y int `json:"y"`
}

Position 位置信息

type PubTemplKeywords

type PubTemplKeywords struct {
	KID     int64  `json:"kid"`
	Name    string `json:"name"`
	Example string `json:"example"`
	Rule    string `json:"rule"`
}

type PubTemplTitle

type PubTemplTitle struct {
	TID        int64  `json:"tid"`
	Title      string `json:"title"`
	Type       int    `json:"type"`
	CategoryID int64  `json:"categoryId"`
}

type QRCode

type QRCode struct {
	Buffer []byte
}

QRCode 小程序二维码

type QRCodeScanData

type QRCodeScanData struct {
	TypeName string        `json:"type_name"`
	Data     string        `json:"data"`
	Pos      ImagePosition `json:"pos"`
}

QRCodeScanData 二维码扫描数据

type RGB

type RGB struct {
	R int `json:"r"`
	G int `json:"g"`
	B int `json:"b"`
}

RGB rgb color

type ResultAICrop

type ResultAICrop struct {
	Results []*CropPosition `json:"results"`
	ImgSize ImageSize       `json:"img_size"`
}

ResultAICrop 图片裁切结果

type ResultBankCardOCR

type ResultBankCardOCR struct {
	Number string `json:"number"`
}

ResultBankCardOCR 银行卡识别结果

type ResultBusinessLicenseOCR

type ResultBusinessLicenseOCR struct {
	RegNum              string      `json:"reg_num"`              // 注册号
	Serial              string      `json:"serial"`               // 编号
	LegalRepresentative string      `json:"legal_representative"` // 法定代表人姓名
	EnterpriseName      string      `json:"enterprise_name"`      // 企业名称
	TypeOfOrganization  string      `json:"type_of_organization"` // 组成形式
	Address             string      `json:"address"`              // 经营场所/企业住所
	TypeOfEnterprise    string      `json:"type_of_enterprise"`   // 公司类型
	BusinessScope       string      `json:"business_scope"`       // 经营范围
	RegisteredCapital   string      `json:"registered_capital"`   // 注册资本
	PaidInCapital       string      `json:"paid_in_capital"`      // 实收资本
	ValidPeriod         string      `json:"valid_period"`         // 营业期限
	RegisteredDate      string      `json:"registered_date"`      // 注册日期/成立日期
	CertPosition        OCRPosition `json:"cert_position"`        // 营业执照位置
	ImgSize             ImageSize   `json:"img_size"`             // 图片大小
}

ResultBusinessLicenseOCR 营业执照

type ResultCommOCR

type ResultCommOCR struct {
	Items   []*CommOCRItem `json:"items"`
	ImgSize ImageSize      `json:"img_size"`
}

ResultCommOCR 通用印刷体识别结果

type ResultDriverLicenseOCR

type ResultDriverLicenseOCR struct {
	IDNum        string `json:"id_num"`        // 证号
	Name         string `json:"name"`          // 姓名
	Sex          string `json:"sex"`           // 性别
	Nationality  string `json:"nationality"`   // 国籍
	Address      string `json:"address"`       // 住址
	BirthDate    string `json:"birth_date"`    // 出生日期
	IssueDate    string `json:"issue_date"`    // 初次领证日期
	CarClass     string `json:"car_class"`     // 准驾车型
	ValidFrom    string `json:"valid_from"`    // 有效期限起始日
	ValidTo      string `json:"valid_to"`      // 有效期限终止日
	OfficialSeal string `json:"official_seal"` // 印章文字
}

ResultDriverLicenseOCR 驾照识别结果

type ResultEncryptedDataCheck

type ResultEncryptedDataCheck struct {
	Valid      bool  `json:"vaild"`       // 是否是合法的数据
	CreateTime int64 `json:"create_time"` // 加密数据生成的时间戳
}

type ResultIDCardBackOCR

type ResultIDCardBackOCR struct {
	ValidDate string `json:"valid_date"`
}

ResultIDCardBackOCR 身份证背面识别结果

type ResultIDCardFrontOCR

type ResultIDCardFrontOCR struct {
	Name        string `json:"name"`
	ID          string `json:"id"`
	Addr        string `json:"addr"`
	Gender      string `json:"gender"`
	Nationality string `json:"nationality"`
}

ResultIDCardFrontOCR 身份证前面识别结果

type ResultMediaCheckAsync

type ResultMediaCheckAsync struct {
	TraceID string `json:"trace_id"` // 任务id,用于匹配异步推送结果
}

ResultMediaCheckAsync 异步校验结果

type ResultMediaUpload

type ResultMediaUpload struct {
	Type      MediaType `json:"type"`
	MediaID   string    `json:"media_id"`
	CreatedAt int64     `json:"created_at"`
}

ResultMediaUpload 临时素材上传结果

type ResultMsgCheck added in v1.2.4

type ResultMsgCheck struct {
	TraceID string          `json:"trace_id"`
	Result  *MsgCheckRet    `json:"result"`
	Detail  []*MsgCheckItem `json:"detail"`
}

type ResultPaidUnionID

type ResultPaidUnionID struct {
	UnionID string `json:"unionid"`
}

ResultPaidUnionID 支付用户unionid

type ResultPhoneNumber added in v1.2.1

type ResultPhoneNumber struct {
	PhoneInfo *PhoneInfo `json:"phone_info"`
}

type ResultPlateNumberOCR

type ResultPlateNumberOCR struct {
	Number string `json:"number"`
}

ResultPlateNumberOCR 车牌号识别结果

type ResultPluginDevApplyList

type ResultPluginDevApplyList struct {
	ApplyList []*PluginDevApplyInfo `json:"apply_list"`
}

type ResultPluginList

type ResultPluginList struct {
	PluginList []*PluginInfo `json:"plugin_list"`
}

type ResultPubTemplKeywords

type ResultPubTemplKeywords struct {
	Data []*PubTemplKeywords `json:"data"`
}

type ResultPubTemplTitles

type ResultPubTemplTitles struct {
	Count int              `json:"count"`
	Data  []*PubTemplTitle `json:"data"`
}

type ResultQRCodeScan

type ResultQRCodeScan struct {
	CodeResults []*QRCodeScanData `json:"code_results"`
	ImgSize     ImageSize         `json:"img_size"`
}

ResultQRCodeScan 二维码扫描结果

type ResultSchemeGenerate

type ResultSchemeGenerate struct {
	OpenLink string `json:"openlink"`
}

type ResultSchemeQuery

type ResultSchemeQuery struct {
	SchemeInfo  *SchemeInfo  `json:"scheme_info"`
	SchemeQuota *SchemeQuota `json:"scheme_quota"`
}

type ResultServiceInvoke

type ResultServiceInvoke struct {
	Data string `json:"data"`
}

ResultServiceInvoke 服务调用结果

type ResultShortLink struct {
	Link string `json:"link"`
}

type ResultSoterVerify

type ResultSoterVerify struct {
	IsOK bool `json:"is_ok"`
}

ResultSoterVerify 生物认证秘钥签名验证结果

type ResultSubscribeCategory

type ResultSubscribeCategory struct {
	Data []*SubscribeCategory `json:"data"`
}

type ResultSubscribeTemplAdd

type ResultSubscribeTemplAdd struct {
	PriTmplID string `json:"priTmplId"`
}

type ResultSubscribeTemplList

type ResultSubscribeTemplList struct {
	Data []*SubscribeTemplInfo `json:"data"`
}

type ResultSuperreSolution

type ResultSuperreSolution struct {
	MediaID string `json:"media_id"`
}

ResultSuperreSolution 图片高清化结果

type ResultURLLinkGenerate

type ResultURLLinkGenerate struct {
	URLLink string `json:"url_link"`
}

type ResultURLLinkQuery

type ResultURLLinkQuery struct {
	URLLinkInfo  *URLLinkInfo  `json:"url_link_info"`
	URLLinkQuota *URLLinkQuota `json:"url_link_quota"`
}

type ResultUserRisk

type ResultUserRisk struct {
	RiskRank int `json:"risk_rank"`
}

ResultUserRisk 用户风控结果

type ResultVehicleLicenseOCR

type ResultVehicleLicenseOCR struct {
	VehicleType       string      `json:"vhicle_type"`         // 车辆类型
	Owner             string      `json:"owner"`               // 所有人
	Addr              string      `json:"addr"`                // 住址
	UseCharacter      string      `json:"use_character"`       // 使用性质
	Model             string      `json:"model"`               // 品牌型号
	VIN               string      `json:"vin"`                 // 车辆识别代号
	EngineNum         string      `json:"engine_num"`          // 发动机号码
	RegisterDate      string      `json:"register_date"`       // 注册日期
	IssueDate         string      `json:"issue_date"`          // 发证日期
	PlateNum          string      `json:"plate_num"`           // 车牌号码
	PlateNumB         string      `json:"plate_num_b"`         // 车牌号码
	Record            string      `json:"record"`              // 号牌
	PassengersNum     string      `json:"passengers_num"`      // 核定载人数
	TotalQuality      string      `json:"total_quality"`       // 总质量
	PrepareQuality    string      `json:"prepare_quality"`     // 整备质量
	OverallSize       string      `json:"overall_size"`        // 外廓尺寸
	CardPositionFront OCRPosition `json:"card_position_front"` // 卡片正面位置(检测到卡片正面才会返回)
	CardPositionBack  OCRPosition `json:"card_position_back"`  // 卡片反面位置(检测到卡片反面才会返回)
}

ResultVehicleLicenseOCR 行驶证识别结果

type RiskScene

type RiskScene int

RiskScene 风控场景

const (
	RiskRegister RiskScene = 0 // 注册
	RiskCheat    RiskScene = 1 // 营销作弊
)

微信支持的风控场景值

type SchemeInfo

type SchemeInfo struct {
	AppID      string     `json:"appid"`
	Path       string     `json:"path"`
	Query      string     `json:"query"`
	CreateTime int64      `json:"create_time"`
	ExpireTime int64      `json:"expire_time"`
	EnvVersion EnvVersion `json:"env_version"`
}

type SchemeJumpWxa

type SchemeJumpWxa struct {
	Path       string     `json:"path,omitempty"`
	Query      string     `json:"query,omitempty"`
	EnvVersion EnvVersion `json:"env_version,omitempty"`
}

type SchemeQuota

type SchemeQuota struct {
	LongTimeUsed  int `json:"long_time_used"`
	LongTimeLimit int `json:"long_time_limit"`
}

type SecCheckScene added in v1.2.4

type SecCheckScene int

SecCheckScene 检测场景

const (
	SecSceneDoc     SecCheckScene = 1 // 资料
	SecSceneComment SecCheckScene = 2 // 评论
	SecSceneForum   SecCheckScene = 3 // 论坛
	SecSceneLog     SecCheckScene = 4 // 社交日志
)

type SecCheckSuggest added in v1.2.4

type SecCheckSuggest string

SecCheckSuggest 建议

const (
	SecSuggestRisky  SecCheckSuggest = "risky"
	SecSuggestPass   SecCheckSuggest = "pass"
	SecSuggestReview SecCheckSuggest = "review"
)

type SecMediaType

type SecMediaType int

SecMediaType 检测的素材类型

const (
	SecMediaAudio SecMediaType = 1 // 音频
	SecMediaImage SecMediaType = 2 // 图片
)

微信支持的素材类型

type SubscribeCategory

type SubscribeCategory struct {
	ID   int64  `json:"id"`
	Name string `json:"name"`
}

type SubscribeMsg

type SubscribeMsg struct {
	ToUser     string       `json:"touser"`                      // 接收者(用户)的 openid
	TemplateID string       `json:"template_id"`                 // 所需下发的订阅模板ID
	Page       string       `json:"page,omitempty"`              // 点击模板卡片后的跳转页面,仅限本小程序内的页面。支持带参数,(示例index?foo=bar)。该字段不填则模板无跳转
	MinipState MinipState   `json:"miniprogram_state,omitempty"` // 跳转小程序类型:developer为开发版;trial为体验版;formal为正式版;默认为正式版
	Lang       string       `json:"lang,omitempty"`              // 进入小程序查看”的语言类型,支持zh_CN(简体中文)、en_US(英文)、zh_HK(繁体中文)、zh_TW(繁体中文),默认为zh_CN
	Data       MsgTemplData `json:"data"`                        // 模板内容,格式形如:{"key1": {"value": any}, "key2": {"value": any}}
}

SubscribeMsg 订阅消息参数

type SubscribeTemplInfo

type SubscribeTemplInfo struct {
	PriTmplId            string              `json:"priTmplId"`
	Title                string              `json:"title"`
	Content              string              `json:"content"`
	Example              string              `json:"example"`
	Type                 int                 `json:"type"`
	KeywordEnumValueList []*KeywordEnumValue `json:"keywordEnumValueList"`
}

type TemplateMsg

type TemplateMsg struct {
	AppID      string       `json:"appid"`       // 公众号appid,要求与小程序有绑定且同主体
	TemplateID string       `json:"template_id"` // 模板ID
	URL        string       `json:"url"`         // 模板跳转链接(海外帐号没有跳转能力)
	Minip      *MsgMinip    `json:"miniprogram"` // 跳转小程序
	Data       MsgTemplData `json:"data"`        // 模板内容,格式形如:{"key1": {"value": any}, "key2": {"value": any}}
}

TemplateMsg 统一服务消息数据

type TypingCmd

type TypingCmd string

TypingCmd 输入状态命令

const (
	Typing       TypingCmd = "Typing"       // 正在输入
	CancelTyping TypingCmd = "CancelTyping" // 取消输入
)

微信支持的输入状态命令

type URLLinkInfo

type URLLinkInfo struct {
	AppID      string     `json:"appid"`
	Path       string     `json:"path"`
	Query      string     `json:"query"`
	CreateTime int64      `json:"create_time"`
	ExpireTime int64      `json:"expire_time"`
	EnvVersion EnvVersion `json:"env_version"`
	CloudBase  *CloudBase `json:"cloud_base"`
}

type URLLinkQuota

type URLLinkQuota struct {
	LongTimeUsed  int `json:"long_time_used"`
	LongTimeLimit int `json:"long_time_limit"`
}

type UniformMsg

type UniformMsg struct {
	ToUser        string       `json:"touser"` // 用户openid,可以是小程序的openid,也可以是mp_template_msg.appid对应的公众号的openid
	MPTemplateMsg *TemplateMsg `json:"mp_template_msg"`
}

UniformMsg 统一服务消息参数

type Watermark added in v1.2.1

type Watermark struct {
	Timestamp int64  `json:"timestamp"`
	AppID     string `json:"appid"`
}

Watermark 水印

Jump to

Keyboard shortcuts

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