Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterMessageHandler ¶
func RegisterMessageHandler(msgKind message.MessageKind, handler message.MessageHandler) error
Types ¶
type ApiWxoa ¶
type ApiWxoa interface {
api.ApiCommon
/*
* 参考:Js SDK签名:https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html
*/
GetJsSdkSignature(url string) (*JsSdkSignatureResult, error) // jsapi_ticket获取签名
/*
* 校验微信公众号服务器
* https://developers.weixin.qq.com/doc/offiaccount/Basic_Information/Access_Overview.html
*/
VerifyServer(signature, token, timestamp, nonce string) bool
/*
* 获取用户信息
* 参考:https://developers.weixin.qq.com/doc/offiaccount/User_Management/Get_users_basic_information_UnionID.html#UinonId
*/
GetUserInfo(openid string) (*UserInfoResult, error)
/*
* 接收普通消息,接收事件消息以及被动回复消息
* 参考:https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Receiving_standard_messages.html
*/
HandleMessage(data []byte) ([]byte, error)
/*
* 发送模板消息
* 参考:https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Template_Message_Interface.html
*/
SendTemplateMessage(toUser string, msg *TemplateMessage) error
}
type JsSdkSignatureResult ¶
type JsSdkSignatureResult struct {
api.ApiResult
AppID string `json:"appId"`
Ticket string `json:"ticket"`
Noncestr string `json:"noncestr"`
Url string `json:"Url"`
Timestamp int64 `json:"timestamp"`
Signature string `json:"signature"`
}
JsSdkSignatureResult signature接口返回结果
type JsSdkTicketResult ¶
type JsSdkTicketResult struct {
api.ApiResult
Value string `json:"ticket,omitempty"`
ExpiresIn int `json:"expires_in,omitempty"`
}
JsSdkTicketResult 类型
type TemplateMessage ¶
type TemplateMessage struct {
// 必要参数
ToUser string `json:"touser"` // 发送给哪个openId
TemplateId string `json:"template_id"` // 模板ID
Data any `json:"data"`
// 非必须的参数
Url string `json:"url"` // 跳转链接
MiniProgram *templateMessageMiniProgram `json:"miniprogram"` // 跳小程序所需数据
ClientMsgId string `json:"client_msg_id"` // 防重入id。对于同一个openid + client_msg_id, 只发送一条消息,10分钟有效,超过10分钟不保证效果。若无防重入需求,可不填
}
func NewTemplateMessage ¶
func NewTemplateMessage(templateId string, contents map[string]string) *TemplateMessage
func (*TemplateMessage) LinkMiniProgram ¶
func (m *TemplateMessage) LinkMiniProgram(appId, pagePath string) *TemplateMessage
LinkMiniProgram 链接小程序
func (*TemplateMessage) LinkUrl ¶
func (m *TemplateMessage) LinkUrl(url string) *TemplateMessage
LinkUrl 链接外部URL
type UserInfoResult ¶
type UserInfoResult struct {
api.ApiResult
Subscribe int8 `json:"subscribe"`
Openid string `json:"openid"`
Language string `json:"language"`
SubscribeTime int64 `json:"subscribe_time"`
UnionId string `json:"unionid"`
Remark string `json:"remark"`
GroupId int `json:"groupid"`
TagIdList []int `json:"tagid_list"`
SubscribeScene string `json:"subscribe_scene"`
QrScene int `json:"qr_scene"`
QrSceneStr string `json:"qr_scene_str"`
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.