wxoa

package
v2.0.13 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2024 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiWxoa

type ApiWxoa interface {
	GetSignature(url string) (*Signature, error) // jsapi_ticket获取签名
	GetAccessToken() (string, error)
	VerifySignature(signature, token, timestamp, nonce string) bool // 校验签名
	GetUser(openid string) (*types.UserInfo, error)
}

func New

func New(appId, appSecret string) ApiWxoa

type EventMessageHandler

type EventMessageHandler func(message *RecvEventMessage) ([]byte, error)

type MessageKind

type MessageKind int
const (
	MessageKindUnknown MessageKind = iota
	MessageKindEvent
)

func GetMessageKind

func GetMessageKind(data []byte) (MessageKind, error)

type RecvEventMessage

type RecvEventMessage struct {
	*RecvMessage
	Event    string
	EventKey string
	Ticket   string
}

type RecvMessage

type RecvMessage struct {
	XMLName      xml.Name `xml:"xml"`
	ToUserName   string
	FromUserName string
	CreateTime   int64
	MsgType      string
	MsgId        int64
}

func (*RecvMessage) ReplyText

func (m *RecvMessage) ReplyText(content string) ([]byte, error)

type RecvMessager

type RecvMessager interface {
	Handle() ([]byte, error)
	ReplyText(content string) ([]byte, error)
}

func NewDefaultRecvMessage

func NewDefaultRecvMessage(data []byte) (RecvMessager, error)

func NewEventRecvMessage

func NewEventRecvMessage(data []byte, eventHandlers map[string]EventMessageHandler) (RecvMessager, error)

type SendMessageTemplateArgument

type SendMessageTemplateArgument struct {
	AppId        string
	AppSecret    string
	ToUserOpenId string
	TemplateId   string
	Url          string // 公众号的跳转页面
	MiniProgram  *SendMessageTemplateMiniProgram
}

type SendMessageTemplateMiniProgram

type SendMessageTemplateMiniProgram struct {
	AppId    string `json:"appid"`
	PagePath string `json:"pagepath"`
}

type SendMessageText

type SendMessageText struct {
	XMLName      xml.Name `xml:"xml"`
	ToUserName   string
	FromUserName string
	CreateTime   int64
	MsgType      string
	Content      string
	MsgId        int64
}

type SendMessager

type SendMessager interface {
	Send(contents map[string]string) error
}

func NewTemplateSendMessage

func NewTemplateSendMessage(arg *SendMessageTemplateArgument) (SendMessager, error)

type Signature

type Signature struct {
	AppID     string `json:"appId"`
	Ticket    string `json:"ticket"`
	Noncestr  string `json:"noncestr"`
	Url       string `json:"Url"`
	Timestamp int64  `json:"timestamp"`
	Signature string `json:"signature"`
}

Signature signature接口返回结果

type Ticket

type Ticket struct {
	Value     string `json:"ticket,omitempty"`
	ExpiresIn int    `json:"expires_in,omitempty"`
}

Ticket 类型

Jump to

Keyboard shortcuts

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