wx

package
v1.3.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	Developer = MiniprogramState("developer")
	Trial     = MiniprogramState("trial")
	Formal    = MiniprogramState("formal")
)
View Source
const WXErrorCode = errx.ErrCode(110002)

Variables

View Source
var (
	ErrAppIDNotMatch       = errors.New("app id not match")
	ErrInvalidBlockSize    = errors.New("invalid block size")
	ErrInvalidPKCS7Data    = errors.New("invalid PKCS7 data")
	ErrInvalidPKCS7Padding = errors.New("invalid padding on input")
)

Functions

func GetPhoneNumberOld

func GetPhoneNumberOld(appId string, sessionKey string, encryptedData string, iv string) (string, error)

GetPhoneNumberOld 旧版本获取电话号码

Types

type AccessToken

type AccessToken struct {
	AccessToken string
	ExpiresIn   int64
}

func GetAccessToken

func GetAccessToken(appId, appSecret, accessTokenCacheKey string, client *redis.Redis) (*AccessToken, error)

GetAccessToken 获取微信访问token

type Code2Session

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

func GetCode2Session

func GetCode2Session(code string, appId string, appSecret string) (*Code2Session, error)

GetCode2Session 登录凭证校验

type Data added in v1.0.2

type Data map[string]Val

type MiniprogramState added in v1.0.5

type MiniprogramState string

type PhoneInfo

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

type PhoneNumber

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

type PhoneNumberResponse

type PhoneNumberResponse struct {
	ErrCode   int64     `json:"errCode"`
	ErrMsg    string    `json:"errMsg"`
	PhoneInfo PhoneInfo `json:"phone_info"`
}

func GetPhoneNumber

func GetPhoneNumber(accessToken string, code string) (*PhoneNumberResponse, error)

type PhoneNumberScrypt

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

func NewPhoneNumberScrypt

func NewPhoneNumberScrypt(appID, sessionKey string) *PhoneNumberScrypt

func (*PhoneNumberScrypt) Decrypt

func (w *PhoneNumberScrypt) Decrypt(encryptedData, iv string) (*PhoneNumber, error)

type SnsApiWxUserInfo

type SnsApiWxUserInfo struct {
	OpenId     string `json:"openid"`
	NickName   string `json:"nickname"`
	Sex        int64  `json:"sex"`
	Province   string `json:"province"`
	City       string `json:"city"`
	Country    string `json:"country"`
	HeadImgUrl string `json:"headimgurl"`
	Privilege  string `json:"privilege"`
	UnionId    string `json:"unionid"`
}

func SnsApiUserInfo

func SnsApiUserInfo(accessToken string, openId string) (*SnsApiWxUserInfo, error)

type TemplateMessage added in v1.0.2

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

func NewTemplateMesage added in v1.0.2

func NewTemplateMesage(appId, appSecret, templateId, accessTokenKey string, redisConf redis.RedisConf) TemplateMessage

func (TemplateMessage) Send added in v1.0.2

func (msg TemplateMessage) Send(page, openId string, data Data, state MiniprogramState) (err error)

type TemplateSendResponse added in v1.0.2

type TemplateSendResponse struct{}

type TokenResult added in v1.0.2

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

type UniformMessage added in v1.0.3

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

func NewUniformMessage added in v1.0.4

func NewUniformMessage(appId, appSecret, templateId, accessTokenKey string, redisConf redis.RedisConf) UniformMessage

func (UniformMessage) Send added in v1.0.3

func (msg UniformMessage) Send(page string, formId string, openId string, data Data) (err error)

type UniformMessageBody added in v1.0.3

type UniformMessageBody struct {
	ToUser           string           `json:"touser"`
	WeappTemplateMsg WeappTemplateMsg `json:"weapp_template_msg"`
}

type Val added in v1.0.2

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

type WXUserDataCrypt

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

func NewWXUserDataCrypt

func NewWXUserDataCrypt(appID, sessionKey string) *WXUserDataCrypt

func (*WXUserDataCrypt) Decrypt

func (w *WXUserDataCrypt) Decrypt(encryptedData, iv string) (*WxUserInfo, error)

type Watermark

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

type WeappTemplateMsg added in v1.0.3

type WeappTemplateMsg struct {
	TemplateId string         `json:"template_id"`
	Page       string         `json:"page"`
	FormId     string         `json:"form_id"`
	Data       map[string]Val `json:"data"`
}

type WxUserInfo

type WxUserInfo struct {
	OpenID    string `json:"openId"`
	UnionID   string `json:"unionId"`
	NickName  string `json:"nickName"`
	Gender    int    `json:"gender"`
	City      string `json:"city"`
	Province  string `json:"province"`
	Country   string `json:"country"`
	AvatarURL string `json:"avatarUrl"`
	Language  string `json:"language"`
	Watermark struct {
		Timestamp int64  `json:"timestamp"`
		AppID     string `json:"appid"`
	} `json:"watermark"`
}

Jump to

Keyboard shortcuts

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