miniprogram

package
v1.3.9 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCodeIsSuccess int64 = 0

ErrCodeIsSuccess 微信接口请求返回成功

Functions

func GetAccessToken

func GetAccessToken(appId, appSecret string) (data ResponseAccessTokenData, errData ResponseErrorData, err error)

GetAccessToken 获取AccessToken

Types

type PhoneInfoData

type PhoneInfoData struct {
	PhoneNumber     string        `json:"phoneNumber"`
	PurePhoneNumber string        `json:"purePhoneNumber"`
	CountryCode     string        `json:"countryCode"`
	Watermark       WatermarkData `json:"watermark"`
}

type ResponseAccessTokenData

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

ResponseAccessTokenData 返回access_token数据

type ResponseCode2SessionData

type ResponseCode2SessionData struct {
	ErrCode    int64  `json:"errcode"`
	ErrMsg     string `json:"errmsg"`
	OpenId     string `json:"openid"`
	UnionId    string `json:"unionid"`
	SessionKey string `json:"session_key"`
}

ResponseCode2SessionData 返回小程序登录凭证校验

func GetCode2Session

func GetCode2Session(appId, appSecret, jsCode string, grantTypes ...string) (data ResponseCode2SessionData, err error)

GetCode2Session 登录凭证校验

type ResponseErrorData

type ResponseErrorData struct {
	ErrCode int64  `json:"errcode"`
	ErrMsg  string `json:"errmsg"`
}

ResponseErrorData 请求返回错误时的数据

type ResponsePhoneNumberData

type ResponsePhoneNumberData struct {
	ErrCode   int64         `json:"errcode"`
	ErrMsg    string        `json:"errmsg"`
	PhoneInfo PhoneInfoData `json:"phone_info"`
}

ResponsePhoneNumberData 返回小程序的用户手机号码

func GetPhoneNumber

func GetPhoneNumber(code, accessToken string) (data ResponsePhoneNumberData, err error)

GetPhoneNumber 获取小程序的用户手机号

type WatermarkData

type WatermarkData struct {
	Timestamp int64  `json:"timestamp"`
	Appid     string `json:"appid"`
}

Jump to

Keyboard shortcuts

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