mirror of
https://github.com/silenceper/wechat.git
synced 2026-02-23 13:42:25 +08:00
feat(miniapp): 小程序订阅消息 (#429)
1. 用户订阅消息服务端回调处理 2. 用户订阅消息订阅通知事件推送 Co-authored-by: houseme <qzg40737@163.com>
This commit is contained in:
@@ -28,11 +28,25 @@ const (
|
||||
DataTypeJSON = "json"
|
||||
)
|
||||
|
||||
const (
|
||||
//EventSubscribePopup 用户操作订阅通知弹窗事件推送,用户在图文等场景内订阅通知的操作
|
||||
EventSubscribePopup EventType = "subscribe_msg_popup_event"
|
||||
//EventSubscribeChange 用户管理订阅通知,用户在服务通知管理页面做通知管理时的操作
|
||||
EventSubscribeChange = "subscribe_msg_change_event"
|
||||
//EventSubscribeSent 发送订阅通知,调用 bizsend 接口发送通知
|
||||
EventSubscribeSent = "subscribe_msg_sent_event"
|
||||
)
|
||||
|
||||
const (
|
||||
InfoTypeAcceptSubscribeMessage InfoType = "accept"
|
||||
InfoTypeRejectSubscribeMessage = "reject"
|
||||
)
|
||||
|
||||
// CommonToken 消息中通用的结构
|
||||
type CommonToken struct {
|
||||
XMLName xml.Name `xml:"xml"`
|
||||
ToUserName string `xml:"ToUserName"`
|
||||
FromUserName string `xml:"FromUserName"`
|
||||
ToUserName CDATA `xml:"ToUserName"`
|
||||
FromUserName CDATA `xml:"FromUserName"`
|
||||
CreateTime int64 `xml:"CreateTime"`
|
||||
MsgType MsgType `xml:"MsgType"`
|
||||
}
|
||||
@@ -60,4 +74,36 @@ type MiniProgramMixMessage struct {
|
||||
// 进入会话事件
|
||||
Event string `xml:"Event"`
|
||||
SessionFrom string `xml:"SessionFrom"`
|
||||
|
||||
// 用户操作订阅通知弹窗消息回调
|
||||
SubscribeMsgPopupEvent struct {
|
||||
List []SubscribeMessageList `xml:"List"`
|
||||
} `xml:"SubscribeMsgPopupEvent"`
|
||||
|
||||
// 用户管理订阅通知回调
|
||||
SubscribeMsgChangeEvent struct {
|
||||
List []SubscribeMessageList `xml:"List"`
|
||||
} `xml:"SubscribeMsgChangeEvent"`
|
||||
|
||||
// 用户发送订阅通知回调
|
||||
SubscribeMsgSentEvent struct {
|
||||
List []SubscribeMessageList `xml:"List"`
|
||||
} `xml:"SubscribeMsgSentEvent"`
|
||||
}
|
||||
|
||||
// SubscribeMessageList 订阅消息事件列表
|
||||
type SubscribeMessageList struct {
|
||||
TemplateId string `xml:"TemplateId"`
|
||||
SubscribeStatusString string `xml:"SubscribeStatusString"`
|
||||
PopupScene string `xml:"PopupScene"`
|
||||
}
|
||||
|
||||
// EncryptedXMLMsg 安全模式下的消息体
|
||||
type EncryptedXMLMsg struct {
|
||||
XMLName struct{} `xml:"xml" json:"-"`
|
||||
ToUserName string `xml:"ToUserName" json:"toUserName"`
|
||||
EncryptedMsg string `xml:"Encrypt" json:"Encrypt"`
|
||||
}
|
||||
|
||||
// CDATA 使用这种类型,在序列化 xml 时文本会被解析器忽略
|
||||
type CDATA string
|
||||
|
||||
Reference in New Issue
Block a user