1
0
mirror of https://github.com/silenceper/wechat.git synced 2026-02-23 13:42:25 +08:00

feat: improve subscribe msg

This commit is contained in:
houseme
2023-10-11 23:51:24 +08:00
parent b1f31feff6
commit 7371d1649f
7 changed files with 103 additions and 319 deletions

View File

@@ -28,25 +28,11 @@ 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 CDATA `xml:"ToUserName"`
FromUserName CDATA `xml:"FromUserName"`
ToUserName string `xml:"ToUserName"`
FromUserName string `xml:"FromUserName"`
CreateTime int64 `xml:"CreateTime"`
MsgType MsgType `xml:"MsgType"`
}
@@ -74,36 +60,4 @@ 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