Documentation
¶
Overview ¶
Package notify 接收并处理微信通知
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Card ¶
type Card struct {
Title string `json:"Title,omitempty" xml:"Title,omitempty"` // 标题
AppID string `json:"AppId,omitempty" xml:"AppId,omitempty"` // 小程序 appid
PagePath string `json:"PagePath,omitempty" xml:"PagePath,omitempty"` // 小程序页面路径
ThumbURL string `json:"ThumbUrl,omitempty" xml:"ThumbUrl,omitempty"` // 封面图片的临时cdn链接
ThumbMediaID string `json:"ThumbMediaId,omitempty" xml:"ThumbMediaId,omitempty"` // 封面图片的临时素材id
}
Card 接收的卡片消息
type EncryptedMsg ¶
type EncryptedMsg struct {
XMLName xml.Name `xml:"xml" json:"-"`
Receiver string `xml:"ToUserName" json:"ToUserName"`
Message string `xml:"Encrypt" json:"Encrypt"`
}
EncryptedMsg 经过加密的消息体
type EventType ¶
type EventType string
EventType 事件类型
const ( // UserEnterEvent 用户进入临时会话状态 UserEnterEvent EventType = "user_enter_tempsession" )
type Image ¶
type Image struct {
PicURL string `json:"PicUrl,omitempty" xml:"PicUrl,omitempty"`
MediaID string `json:"MediaId,omitempty" xml:"MediaId,omitempty"`
}
Image 接收的图片消息
type Mixture ¶
type Mixture struct {
XMLName xml.Name `xml:"xml" json:"-"`
ID int64 `json:"MsgId" xml:"MsgId"` // 消息 ID
Type message.MsgType `json:"MsgType" xml:"MsgType"` // 消息类型
Event EventType `json:"event,omitempty" xml:"event,omitempty"` // 事件类型
Sender string `json:"FromUserName" xml:"FromUserName"` // 发送者的 openID
Receiver string `json:"ToUserName" xml:"ToUserName"` // 小程序的原始ID
Datetime int64 `json:"CreateTime" xml:"CreateTime"` // 消息创建时间(整型)
Text
Card
Image
}
Mixture 从微信服务器接收的混合消息体
type Server ¶
type Server struct {
EncodingAESKey string // 消息加密密钥
Writer http.ResponseWriter
Request *http.Request
// contains filtered or unexported fields
}
Server 微信服务接收器 dev: 删除不必要的字段
func NewServer ¶
func NewServer(res http.ResponseWriter, req *http.Request) *Server
NewServer Create new Server
func (*Server) HandleCardMessage ¶
HandleCardMessage 新建 Server 并设置卡片消息处理器
func (*Server) HandleEvent ¶
HandleEvent 新建 Server 并设置事件处理器
func (*Server) HandleImageMessage ¶
HandleImageMessage 新建 Server 并设置图片消息处理器
func (*Server) HandleTextMessage ¶
HandleTextMessage 新建 Server 并设置文本消息处理器
Click to show internal directories.
Click to hide internal directories.