mirror of
https://github.com/silenceper/wechat.git
synced 2026-02-11 16:22:26 +08:00
feature: 公众号客服消息增加「小程序卡片消息」类型;添加 GetCustomerMessageManager (#320)
* fix officialaccount customer_message * fix golint comment Co-authored-by: huangxiang <huangxiang@didichuxing.com>
This commit is contained in:
@@ -73,6 +73,20 @@ func NewCustomerVoiceMessage(toUser, mediaID string) *CustomerMessage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//NewCustomerMiniprogrampageMessage 小程序卡片消息的构造方法
|
||||||
|
func NewCustomerMiniprogrampageMessage(toUser, title, appID, pagePath, thumbMediaID string) *CustomerMessage {
|
||||||
|
return &CustomerMessage{
|
||||||
|
ToUser: toUser,
|
||||||
|
Msgtype: MsgTypeMiniprogrampage,
|
||||||
|
Miniprogrampage: &MediaMiniprogrampage{
|
||||||
|
Title: title,
|
||||||
|
AppID: appID,
|
||||||
|
Pagepath: pagePath,
|
||||||
|
ThumbMediaID: thumbMediaID,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//MediaText 文本消息的文字
|
//MediaText 文本消息的文字
|
||||||
type MediaText struct {
|
type MediaText struct {
|
||||||
Content string `json:"content"`
|
Content string `json:"content"`
|
||||||
@@ -134,7 +148,7 @@ type MediaWxcard struct {
|
|||||||
//MediaMiniprogrampage 小程序消息
|
//MediaMiniprogrampage 小程序消息
|
||||||
type MediaMiniprogrampage struct {
|
type MediaMiniprogrampage struct {
|
||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
Appid string `json:"appid"`
|
AppID string `json:"appid"`
|
||||||
Pagepath string `json:"pagepath"`
|
Pagepath string `json:"pagepath"`
|
||||||
ThumbMediaID string `json:"thumb_media_id"`
|
ThumbMediaID string `json:"thumb_media_id"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ const (
|
|||||||
MsgTypeVoice = "voice"
|
MsgTypeVoice = "voice"
|
||||||
//MsgTypeVideo 表示视频消息
|
//MsgTypeVideo 表示视频消息
|
||||||
MsgTypeVideo = "video"
|
MsgTypeVideo = "video"
|
||||||
|
//MsgTypeMiniprogrampage 表示小程序卡片消息
|
||||||
|
MsgTypeMiniprogrampage = "miniprogrampage"
|
||||||
//MsgTypeShortVideo 表示短视频消息[限接收]
|
//MsgTypeShortVideo 表示短视频消息[限接收]
|
||||||
MsgTypeShortVideo = "shortvideo"
|
MsgTypeShortVideo = "shortvideo"
|
||||||
//MsgTypeLocation 表示坐标消息[限接收]
|
//MsgTypeLocation 表示坐标消息[限接收]
|
||||||
|
|||||||
@@ -93,6 +93,11 @@ func (officialAccount *OfficialAccount) GetTemplate() *message.Template {
|
|||||||
return message.NewTemplate(officialAccount.ctx)
|
return message.NewTemplate(officialAccount.ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetCustomerMessageManager 客服消息接口
|
||||||
|
func (officialAccount *OfficialAccount) GetCustomerMessageManager() *message.Manager {
|
||||||
|
return message.NewMessageManager(officialAccount.ctx)
|
||||||
|
}
|
||||||
|
|
||||||
// GetDevice 获取智能设备的实例
|
// GetDevice 获取智能设备的实例
|
||||||
func (officialAccount *OfficialAccount) GetDevice() *device.Device {
|
func (officialAccount *OfficialAccount) GetDevice() *device.Device {
|
||||||
return device.NewDevice(officialAccount.ctx)
|
return device.NewDevice(officialAccount.ctx)
|
||||||
|
|||||||
Reference in New Issue
Block a user