Documentation ¶
Overview ¶
Package qapp QQ小程序SDK
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommonError ¶
type CommonError struct { ErrCode int `json:"errcode"` // 错误码 ErrMSG string `json:"errmsg"` // 错误描述 }
CommonError 微信返回错误信息
func IMGSecCheck ¶
func IMGSecCheck(token, filename string) (*CommonError, error)
IMGSecCheck 本地图片检测 官方文档: https://developers.weixin.qq.com/miniprogram/dev/api/imgSecCheck.html
filename 要检测的图片本地路径 token 接口调用凭证(access_token)
func IMGSecCheck2 ¶
func IMGSecCheck2(token, url string) (*CommonError, error)
func MSGSecCheck ¶
func MSGSecCheck(token, content string) (*CommonError, error)
MSGSecCheck 文本检测 官方文档: https://developers.weixin.qq.com/miniprogram/dev/api/msgSecCheck.html
content 要检测的文本内容,长度不超过 500KB,编码格式为utf-8 token 接口调用凭证(access_token)
func (*CommonError) GetResponseError ¶
func (err *CommonError) GetResponseError() error
GetResponseError 获取微信服务器错返回误信息
type CommonResult ¶
type CommonResult struct { ResultCode int `json:"resultcode"` // 错误码 ResultMsg string `json:"resultmsg"` // 错误描述 }
CommonResult 微信返回错误信息
func (*CommonResult) GetResponseError ¶
func (err *CommonResult) GetResponseError() error
GetResponseError 获取微信服务器错返回误信息
type GetPaidUnionIDResponse ¶
type GetPaidUnionIDResponse struct { CommonError UnionID string `json:"unionid"` }
GetPaidUnionIDResponse response data
func GetPaidUnionID ¶
func GetPaidUnionID(accessToken, openID, transactionID string) (*GetPaidUnionIDResponse, error)
GetPaidUnionID 用户支付完成后,通过微信支付订单号(transaction_id)获取该用户的 UnionId,
func GetPaidUnionIDWithMCH ¶
func GetPaidUnionIDWithMCH(accessToken, openID, outTradeNo, mchID string) (*GetPaidUnionIDResponse, error)
GetPaidUnionIDWithMCH 用户支付完成后,通过微信支付商户订单号和微信支付商户号(out_trade_no 及 mch_id)获取该用户的 UnionId,
type LoginResponse ¶
type LoginResponse struct { CommonError OpenID string `json:"openid"` SessionKey string `json:"session_key"` // 用户在开放平台的唯一标识符 // 只在满足一定条件的情况下返回 UnionID string `json:"unionid"` }
LoginResponse 返回给用户的数据
func Login ¶
func Login(appID, secret, code string) (*LoginResponse, error)
Login 登录凭证校验。通过 wx.login 接口获得临时登录凭证 code 后传到开发者服务器调用此接口完成登录流程。
appID 小程序 appID secret 小程序的 app secret code 小程序登录时获取的 code
type TokenResponse ¶
type TokenResponse struct { CommonError AccessToken string `json:"access_token"` // 获取到的凭证 ExpiresIn uint `json:"expires_in"` // 凭证有效时间,单位:秒。目前是7200秒之内的值。 }
TokenResponse 获取 access_token 成功返回数据
func GetAccessToken ¶
func GetAccessToken(appID, secret string) (*TokenResponse, error)
GetAccessToken 获取小程序全局唯一后台接口调用凭据(access_token)。 调调用绝大多数后台接口时都需使用 access_token,开发者需要进行妥善保存,注意缓存。