Documentation ¶
Overview ¶
封装微信服务器推送过来的消息(事件)处理 Handler.
Index ¶
- type DefaultMsgHandler
- func (handler DefaultMsgHandler) ImageMsgHandler(w http.ResponseWriter, r *http.Request, msg *request.Image, rawXMLMsg []byte, ...)
- func (handler DefaultMsgHandler) InvalidRequestHandler(w http.ResponseWriter, r *http.Request, err error)
- func (handler DefaultMsgHandler) LinkMsgHandler(w http.ResponseWriter, r *http.Request, msg *request.Link, rawXMLMsg []byte, ...)
- func (handler DefaultMsgHandler) LocationEventHandler(w http.ResponseWriter, r *http.Request, msg *request.LocationEvent, ...)
- func (handler DefaultMsgHandler) LocationMsgHandler(w http.ResponseWriter, r *http.Request, msg *request.Location, ...)
- func (handler DefaultMsgHandler) MassSendJobFinishEventHandler(w http.ResponseWriter, r *http.Request, msg *request.MassSendJobFinishEvent, ...)
- func (handler DefaultMsgHandler) MenuClickEventHandler(w http.ResponseWriter, r *http.Request, msg *request.MenuClickEvent, ...)
- func (handler DefaultMsgHandler) MenuLocationSelectEventHandler(w http.ResponseWriter, r *http.Request, msg *request.MenuLocationSelectEvent, ...)
- func (handler DefaultMsgHandler) MenuPicPhotoOrAlbumEventHandler(w http.ResponseWriter, r *http.Request, msg *request.MenuPicPhotoOrAlbumEvent, ...)
- func (handler DefaultMsgHandler) MenuPicSysPhotoEventHandler(w http.ResponseWriter, r *http.Request, msg *request.MenuPicSysPhotoEvent, ...)
- func (handler DefaultMsgHandler) MenuPicWeixinEventHandler(w http.ResponseWriter, r *http.Request, msg *request.MenuPicWeixinEvent, ...)
- func (handler DefaultMsgHandler) MenuScanCodePushEventHandler(w http.ResponseWriter, r *http.Request, msg *request.MenuScanCodePushEvent, ...)
- func (handler DefaultMsgHandler) MenuScanCodeWaitMsgEventHandler(w http.ResponseWriter, r *http.Request, msg *request.MenuScanCodeWaitMsgEvent, ...)
- func (handler DefaultMsgHandler) MenuViewEventHandler(w http.ResponseWriter, r *http.Request, msg *request.MenuViewEvent, ...)
- func (handler DefaultMsgHandler) MerchantOrderEventHandler(w http.ResponseWriter, r *http.Request, msg *request.MerchantOrderEvent, ...)
- func (handler DefaultMsgHandler) ScanEventHandler(w http.ResponseWriter, r *http.Request, msg *request.ScanEvent, ...)
- func (handler DefaultMsgHandler) Signature(timestamp, nonce string) (signature string)
- func (handler DefaultMsgHandler) SubscribeByScanEventHandler(w http.ResponseWriter, r *http.Request, msg *request.SubscribeByScanEvent, ...)
- func (handler DefaultMsgHandler) SubscribeEventHandler(w http.ResponseWriter, r *http.Request, msg *request.SubscribeEvent, ...)
- func (handler DefaultMsgHandler) TemplateSendJobFinishEventHandler(w http.ResponseWriter, r *http.Request, ...)
- func (handler DefaultMsgHandler) TextMsgHandler(w http.ResponseWriter, r *http.Request, msg *request.Text, rawXMLMsg []byte, ...)
- func (handler DefaultMsgHandler) UnknownMsgHandler(w http.ResponseWriter, r *http.Request, rawXMLMsg []byte, timestamp int64)
- func (handler DefaultMsgHandler) UnsubscribeEventHandler(w http.ResponseWriter, r *http.Request, msg *request.UnsubscribeEvent, ...)
- func (handler DefaultMsgHandler) VideoMsgHandler(w http.ResponseWriter, r *http.Request, msg *request.Video, rawXMLMsg []byte, ...)
- func (handler DefaultMsgHandler) VoiceMsgHandler(w http.ResponseWriter, r *http.Request, msg *request.Voice, rawXMLMsg []byte, ...)
- func (handler DefaultMsgHandler) WriteImage(w io.Writer, msg *response.Image) error
- func (handler DefaultMsgHandler) WriteMusic(w io.Writer, msg *response.Music) error
- func (handler DefaultMsgHandler) WriteNews(w io.Writer, msg *response.News) (err error)
- func (handler DefaultMsgHandler) WriteText(w io.Writer, msg *response.Text) error
- func (handler DefaultMsgHandler) WriteTransferToCustomerService(w io.Writer, msg *response.TransferToCustomerService) error
- func (handler DefaultMsgHandler) WriteTransferToSpecialCustomerService(w io.Writer, msg *response.TransferToSpecialCustomerService) error
- func (handler DefaultMsgHandler) WriteVideo(w io.Writer, msg *response.Video) error
- func (handler DefaultMsgHandler) WriteVoice(w io.Writer, msg *response.Voice) error
- type HttpHandler
- type MsgHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultMsgHandler ¶
type DefaultMsgHandler struct {
Token string
}
func (DefaultMsgHandler) ImageMsgHandler ¶
func (handler DefaultMsgHandler) ImageMsgHandler(w http.ResponseWriter, r *http.Request, msg *request.Image, rawXMLMsg []byte, timestamp int64)
func (DefaultMsgHandler) InvalidRequestHandler ¶
func (handler DefaultMsgHandler) InvalidRequestHandler(w http.ResponseWriter, r *http.Request, err error)
func (DefaultMsgHandler) LinkMsgHandler ¶
func (handler DefaultMsgHandler) LinkMsgHandler(w http.ResponseWriter, r *http.Request, msg *request.Link, rawXMLMsg []byte, timestamp int64)
func (DefaultMsgHandler) LocationEventHandler ¶
func (handler DefaultMsgHandler) LocationEventHandler(w http.ResponseWriter, r *http.Request, msg *request.LocationEvent, rawXMLMsg []byte, timestamp int64)
func (DefaultMsgHandler) LocationMsgHandler ¶
func (handler DefaultMsgHandler) LocationMsgHandler(w http.ResponseWriter, r *http.Request, msg *request.Location, rawXMLMsg []byte, timestamp int64)
func (DefaultMsgHandler) MassSendJobFinishEventHandler ¶
func (handler DefaultMsgHandler) MassSendJobFinishEventHandler(w http.ResponseWriter, r *http.Request, msg *request.MassSendJobFinishEvent, rawXMLMsg []byte, timestamp int64)
func (DefaultMsgHandler) MenuClickEventHandler ¶
func (handler DefaultMsgHandler) MenuClickEventHandler(w http.ResponseWriter, r *http.Request, msg *request.MenuClickEvent, rawXMLMsg []byte, timestamp int64)
func (DefaultMsgHandler) MenuLocationSelectEventHandler ¶
func (handler DefaultMsgHandler) MenuLocationSelectEventHandler(w http.ResponseWriter, r *http.Request, msg *request.MenuLocationSelectEvent, rawXMLMsg []byte, timestamp int64)
func (DefaultMsgHandler) MenuPicPhotoOrAlbumEventHandler ¶
func (handler DefaultMsgHandler) MenuPicPhotoOrAlbumEventHandler(w http.ResponseWriter, r *http.Request, msg *request.MenuPicPhotoOrAlbumEvent, rawXMLMsg []byte, timestamp int64)
func (DefaultMsgHandler) MenuPicSysPhotoEventHandler ¶
func (handler DefaultMsgHandler) MenuPicSysPhotoEventHandler(w http.ResponseWriter, r *http.Request, msg *request.MenuPicSysPhotoEvent, rawXMLMsg []byte, timestamp int64)
func (DefaultMsgHandler) MenuPicWeixinEventHandler ¶
func (handler DefaultMsgHandler) MenuPicWeixinEventHandler(w http.ResponseWriter, r *http.Request, msg *request.MenuPicWeixinEvent, rawXMLMsg []byte, timestamp int64)
func (DefaultMsgHandler) MenuScanCodePushEventHandler ¶
func (handler DefaultMsgHandler) MenuScanCodePushEventHandler(w http.ResponseWriter, r *http.Request, msg *request.MenuScanCodePushEvent, rawXMLMsg []byte, timestamp int64)
func (DefaultMsgHandler) MenuScanCodeWaitMsgEventHandler ¶
func (handler DefaultMsgHandler) MenuScanCodeWaitMsgEventHandler(w http.ResponseWriter, r *http.Request, msg *request.MenuScanCodeWaitMsgEvent, rawXMLMsg []byte, timestamp int64)
func (DefaultMsgHandler) MenuViewEventHandler ¶
func (handler DefaultMsgHandler) MenuViewEventHandler(w http.ResponseWriter, r *http.Request, msg *request.MenuViewEvent, rawXMLMsg []byte, timestamp int64)
func (DefaultMsgHandler) MerchantOrderEventHandler ¶
func (handler DefaultMsgHandler) MerchantOrderEventHandler(w http.ResponseWriter, r *http.Request, msg *request.MerchantOrderEvent, rawXMLMsg []byte, timestamp int64)
func (DefaultMsgHandler) ScanEventHandler ¶
func (handler DefaultMsgHandler) ScanEventHandler(w http.ResponseWriter, r *http.Request, msg *request.ScanEvent, rawXMLMsg []byte, timestamp int64)
func (DefaultMsgHandler) Signature ¶
func (handler DefaultMsgHandler) Signature(timestamp, nonce string) (signature string)
func (DefaultMsgHandler) SubscribeByScanEventHandler ¶
func (handler DefaultMsgHandler) SubscribeByScanEventHandler(w http.ResponseWriter, r *http.Request, msg *request.SubscribeByScanEvent, rawXMLMsg []byte, timestamp int64)
func (DefaultMsgHandler) SubscribeEventHandler ¶
func (handler DefaultMsgHandler) SubscribeEventHandler(w http.ResponseWriter, r *http.Request, msg *request.SubscribeEvent, rawXMLMsg []byte, timestamp int64)
func (DefaultMsgHandler) TemplateSendJobFinishEventHandler ¶
func (handler DefaultMsgHandler) TemplateSendJobFinishEventHandler(w http.ResponseWriter, r *http.Request, msg *request.TemplateSendJobFinishEvent, rawXMLMsg []byte, timestamp int64)
func (DefaultMsgHandler) TextMsgHandler ¶
func (handler DefaultMsgHandler) TextMsgHandler(w http.ResponseWriter, r *http.Request, msg *request.Text, rawXMLMsg []byte, timestamp int64)
func (DefaultMsgHandler) UnknownMsgHandler ¶
func (handler DefaultMsgHandler) UnknownMsgHandler(w http.ResponseWriter, r *http.Request, rawXMLMsg []byte, timestamp int64)
func (DefaultMsgHandler) UnsubscribeEventHandler ¶
func (handler DefaultMsgHandler) UnsubscribeEventHandler(w http.ResponseWriter, r *http.Request, msg *request.UnsubscribeEvent, rawXMLMsg []byte, timestamp int64)
func (DefaultMsgHandler) VideoMsgHandler ¶
func (handler DefaultMsgHandler) VideoMsgHandler(w http.ResponseWriter, r *http.Request, msg *request.Video, rawXMLMsg []byte, timestamp int64)
func (DefaultMsgHandler) VoiceMsgHandler ¶
func (handler DefaultMsgHandler) VoiceMsgHandler(w http.ResponseWriter, r *http.Request, msg *request.Voice, rawXMLMsg []byte, timestamp int64)
func (DefaultMsgHandler) WriteImage ¶
把 image 回复消息 msg 写入 writer w
func (DefaultMsgHandler) WriteMusic ¶
把 music 回复消息 msg 写入 writer w
func (DefaultMsgHandler) WriteTransferToCustomerService ¶
func (handler DefaultMsgHandler) WriteTransferToCustomerService(w io.Writer, msg *response.TransferToCustomerService) error
把 TransferToCustomerService 回复消息 msg 写入 writer w
func (DefaultMsgHandler) WriteTransferToSpecialCustomerService ¶
func (handler DefaultMsgHandler) WriteTransferToSpecialCustomerService(w io.Writer, msg *response.TransferToSpecialCustomerService) error
把 TransferToSpecialCustomerService 回复消息 msg 写入 writer w
func (DefaultMsgHandler) WriteVideo ¶
把 video 回复消息 msg 写入 writer w
func (DefaultMsgHandler) WriteVoice ¶
把 voice 回复消息 msg 写入 writer w
type HttpHandler ¶
type HttpHandler struct {
MsgHandler MsgHandler
}
net/http.Handler 的实现
func (HttpHandler) ServeHTTP ¶
func (handler HttpHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type MsgHandler ¶
type MsgHandler interface { // 生成签名 Signature(timestamp, nonce string) (signature string) InvalidRequestHandler(w http.ResponseWriter, r *http.Request, err error) UnknownMsgHandler(w http.ResponseWriter, r *http.Request, rawXMLMsg []byte, timestamp int64) TextMsgHandler(w http.ResponseWriter, r *http.Request, msg *request.Text, rawXMLMsg []byte, timestamp int64) ImageMsgHandler(w http.ResponseWriter, r *http.Request, msg *request.Image, rawXMLMsg []byte, timestamp int64) VoiceMsgHandler(w http.ResponseWriter, r *http.Request, msg *request.Voice, rawXMLMsg []byte, timestamp int64) VideoMsgHandler(w http.ResponseWriter, r *http.Request, msg *request.Video, rawXMLMsg []byte, timestamp int64) LocationMsgHandler(w http.ResponseWriter, r *http.Request, msg *request.Location, rawXMLMsg []byte, timestamp int64) LinkMsgHandler(w http.ResponseWriter, r *http.Request, msg *request.Link, rawXMLMsg []byte, timestamp int64) SubscribeEventHandler(w http.ResponseWriter, r *http.Request, msg *request.SubscribeEvent, rawXMLMsg []byte, timestamp int64) UnsubscribeEventHandler(w http.ResponseWriter, r *http.Request, msg *request.UnsubscribeEvent, rawXMLMsg []byte, timestamp int64) SubscribeByScanEventHandler(w http.ResponseWriter, r *http.Request, msg *request.SubscribeByScanEvent, rawXMLMsg []byte, timestamp int64) ScanEventHandler(w http.ResponseWriter, r *http.Request, msg *request.ScanEvent, rawXMLMsg []byte, timestamp int64) LocationEventHandler(w http.ResponseWriter, r *http.Request, msg *request.LocationEvent, rawXMLMsg []byte, timestamp int64) MenuClickEventHandler(w http.ResponseWriter, r *http.Request, msg *request.MenuClickEvent, rawXMLMsg []byte, timestamp int64) MenuViewEventHandler(w http.ResponseWriter, r *http.Request, msg *request.MenuViewEvent, rawXMLMsg []byte, timestamp int64) MenuScanCodePushEventHandler(w http.ResponseWriter, r *http.Request, msg *request.MenuScanCodePushEvent, rawXMLMsg []byte, timestamp int64) MenuScanCodeWaitMsgEventHandler(w http.ResponseWriter, r *http.Request, msg *request.MenuScanCodeWaitMsgEvent, rawXMLMsg []byte, timestamp int64) MenuPicSysPhotoEventHandler(w http.ResponseWriter, r *http.Request, msg *request.MenuPicSysPhotoEvent, rawXMLMsg []byte, timestamp int64) MenuPicPhotoOrAlbumEventHandler(w http.ResponseWriter, r *http.Request, msg *request.MenuPicPhotoOrAlbumEvent, rawXMLMsg []byte, timestamp int64) MenuPicWeixinEventHandler(w http.ResponseWriter, r *http.Request, msg *request.MenuPicWeixinEvent, rawXMLMsg []byte, timestamp int64) MenuLocationSelectEventHandler(w http.ResponseWriter, r *http.Request, msg *request.MenuLocationSelectEvent, rawXMLMsg []byte, timestamp int64) MassSendJobFinishEventHandler(w http.ResponseWriter, r *http.Request, msg *request.MassSendJobFinishEvent, rawXMLMsg []byte, timestamp int64) TemplateSendJobFinishEventHandler(w http.ResponseWriter, r *http.Request, msg *request.TemplateSendJobFinishEvent, rawXMLMsg []byte, timestamp int64) MerchantOrderEventHandler(w http.ResponseWriter, r *http.Request, msg *request.MerchantOrderEvent, rawXMLMsg []byte, timestamp int64) }
消息处理接口
Source Files ¶
Click to show internal directories.
Click to hide internal directories.